开发者

How make a stretchable image in Cocos2d-x (C++ openGL)

开发者 https://www.devze.com 2023-03-25 02:13 出处:网络
I\'m studying about Cocos2D and OpenGLES. I want make [[UIImage imageNamed:@\"green.png\"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:14.0];

I'm studying about Cocos2D and OpenGLES.

I want make

[[UIImage imageNamed:@"green.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:14.0];

- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight

with OpenGL in C++(Cocos2D-x).

So Prototype I want to make will be

(CCSprite*) stretchableSpriteWithFile(const char *pszFileName, float leftCap, float topCap, float width, float height);

before image : http://postfiles6.naver.net/20091019_85/jun0683_1255941958601C1KQo_png/green_jun0683.png?type=w2

after image : http://postfiles5.naver.net/20091019_84/jun0683_12559419613787bC6n_png/green4_jun0683.png?type=w2

Th开发者_如何学Cank you for your advice.

Tae-ho.


Found one code snippet at http://www.crocodella.com.br/2011/07/resizable-decorated-box-using-cocos2d/ Fixed codes in the comment part of above page are held at https://github.com/jgrimaul/DecoratedBox


Take a look to the test projects, in cocos2d-2.0-rc0a-x-2.0/tests running the Android.mk and launching the apk with eclipse (In linux). There are some examples to manage texture and effects.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号