Tae-ho Lee
Tae-ho Lee

Reputation: 39

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

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

Thank you for your advice.

Tae-ho.

Upvotes: 2

Views: 1276

Answers (2)

vgonisanz
vgonisanz

Reputation: 11930

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.

Upvotes: 2

cxase
cxase

Reputation: 241

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

Upvotes: 2

Related Questions