• Editor
  • cocos2d-x 3.0 beta runtime

Hi,

Just to let you know been working on a module version of the spine runtime for cocos2d-x which has the changes needed to use the new rendering engine and latest fixes.

Since in cocos they have removed the CC prefix, I can't really do the same in the module as this causes conflicts, so going to prefix with ES instead until they remove spine from Cocos due to license changes.

My hope is this will come in handy once FFD etc is implemented into the runtime and save time for implementing the cocos2d-x 3 needed changes. Also once has been pulled into the main repo I can then fork to add some nice additional functionality.

P.S. sorry should of put this in runtime section :S

Question: I have recreated the spineboy atlas's using the spine-love assets and created 3 versions, one full scale, one 50% and one 25%. I have done appropriate code to set the content scale factor for the 3 scales, however the debug bones size of spine boy are correct however it is not grabbing the correct regions of the atlas image. I have attached my atlas files incase it helps...

Related Discussions
...

Cool, thanks! I would like to work on cocos2dx 3 support, but it may be a while. 🙁

Did you pack 3 separate atlases? You can't use a single atlas with different size images, you need to pack it again, since image scaling could cause images to be off by a +/- 1 pixel. Support for auto resizing in the packer is planned, just haven't gotten to it.

Yes as mentioned above I used the original assets from spine-love and created 3 versions of the atlas from that using texture packer (rather than trying to just scale the png's which i know won't work). At moment the problem I'm getting is if I'm using a device with correct design/screen ratio then everything looks fine, how ever when different it is not grabbing the correct regions of the atlas, and thus spine boys head could be either the whole sprite sheet, or something between. Its as if the content scale factor is being used correctly to render the bones sizes, but not being used correctly to grab the regions from the atlas.

Only way to seem to hide problem is to use atlas files all of the same size across all 3 resolutions which isn't ideal.

I guess something is wrong with your code that loads the textures.

void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) {
	CCTexture2D* texture = CCTextureCache::sharedTextureCache()->addImage(path);
	CCTextureAtlas* textureAtlas = CCTextureAtlas::createWithTexture(texture, 128);
	textureAtlas->retain();
	self->rendererObject = textureAtlas;
	self->width = texture->getPixelsWide();
	self->height = texture->getPixelsHigh();
}

Nope I'm using same code, but also tried version where it takes into effect content size. if you used the atlas files i provided in existing cocos runtime solution you will see issue (with some minor tweaks).

Ill see if i can zip up a cocos2dx v2 example showing the problem.

Are you sure the correct atlas file and image file are being used? The content scale should not affect how the UVs are calculated.

Well this is embarrassing, i just knocked up a cocos2d-x v2 to show you and works as expected, I'm going to check thru my v3 code to see whats happened there. :S