Filledpolygon - I think would be usefull (e.g. for rendering some polygon landscape areas filled with a texture) addon for game developer. I used it in my game.
There is cocos2d (iPhone) project at: https://github.com/asinesio/cocos2d-PRKit
I’ve ported it to cocos2dx, may attach my files if necessary.
Would be useful to have wrapped text node (that will wrap text to specified width) - to render descriptions, stories, etc. for game. Unfortunatelly have no code for that.
Would be useful to have Clip node - might be used for scroll boxes, wrapped text, etc. Also have no code for this.
Woudl be useful to have FileExists functionality. E.g. if some “game objects” have additional textures (with definite naming convention) and some don’t and we need to create these additional textures if files exists and not create otherwise - I used this approach in my game (had to use native marmalade API). I know e.g. CCTextureCache::addImage will return NULL texture if file doesn’t exist but why make redundant operations if file simply doesn’t exist?
How about to include some TTF to FNT converting tool to cocos? TTF is already implemented for all platforms but it still performs slower than BMFont (?). I used hiero.jnlp - java tool, since TTF was not implemented in 0.9.x.
Hello everyone,
I’ve ported Additions Filledpolygon from cocos2d-iphone (project at: https://github.com/asinesio/cocos2d-PRKit) to cocos2d-x.
>
I hope can be useful.
D.
I used your cocos2d-x 2.0 PRKit code, But it cann’t draw the PRFilledPolygon on the layer, following is my test code and I also attach the image file watermelon.png:
Vector2dVector vc;
vc.push_back(Vector2d(5,15));
vc.push_back(Vector2d(6,13));
vc.push_back(Vector2d(32,5));
vc.push_back(Vector2d(48,7));
vc.push_back(Vector2d(6,14));
vc.push_back(Vector2d(34,59));
vc.push_back(Vector2d(28,59));
CCTexture2D* texture = CCTextureCache::sharedTextureCache()>addImage;
PRFilledPolygon *filledPolygon = PRFilledPolygon::filledPolygonWithPointsAndTexture;
filledPolygon>setPosition(0,320);
this->addChild(filledPolygon,1);
Do you know what is wrong?
I’m also trying to get this to work. I’m running a cocos2d-iphone PRKit example alongside it with the same texture, and have confirmed that the polygon is correctly triangulated and all the texture coordinates are the same going into the draw function, but no texture appears on screen.
What would be a really great feature for CCDrawingPrimitives would be a ccDrawTexturedPoly(…) =)
Hi all,
sorry but I’ve been away for the holidays
>
I attach the new version of PRKit for cocos2d-x 2.0.
>
I hope you find it useful,
D.
The port is buggy on windows (and it crashes), BUT both on Windows and OS X iOS simulator, it doesnt triangulate as it should. I’ve attached an image to show what I mean.
Damiano Mazzella wrote:
> Hi all,
> sorry but I’ve been away for the holidays
>
> I attach the new version of PRKit for cocos2d-x 2.0.
>
> I hope you find it useful,
> D.
>
The port is buggy on windows (and it crashes), BUT both on Windows and OS X iOS simulator, it doesnt triangulate as it should. I’ve attached an image to show what I mean.
>
Here’s the code:
>
init method:@
Vector2dVector vc;
CCTexture2D texture = CCTextureCache::sharedTextureCache~~>addImage;
filledPolygon = PRFilledPolygon::filledPolygonWithPointsAndTexture;
this~~>addChild;
@
>
update method:@
Vector2dVector vc;
for ; it != particles.end; ++it) {
Particlep = *it;
vc.push_back(Vector2d(mul * p~~>x, mul * p~~>y));
}
filledPolygon->setPoints(vc);
@
Hi,
is you image NPOT?
Can you post slime_1.png used for test?
Hi,
is you image NPOT?
Can you post slime_1.png used for test?
>
Ciao,
D.
Image is POT, I’m sending it as attachment. Does the point list need to be inputted in specific order or does the triangulator sort them out in format compatible with OpenGL?