- Editado
Cocos2d-x Multi Resolution
Hello everyone!
I am currently working on a game which is being developed on cocos2d-x and spine. I was wondering if there is a way to use high res assets for the same animations that were built in low res. For example loading high res spritesheet for ipad and low res for iphone, and using the same bones and and animations.
I want to create animations from spine, I can't afford to make them twice. If I make them for iphone they will look bad on ipad retina but on the other hand, if I make them for ipad then I will have issues with the limited memory of iphone.
Is there any way to solve this problem without making separate animations for high res and low res?
thanks
Hi! My exp in libGDX:
I've made 2 texture atlases (low and high res).
In spine i've made animation only fo low res pictures.
When i upload atlas with high res like so
SkeletonJson json = new SkeletonJson(Assets.highres_atlas);
it works fine!
The thing with Cocos2d-x, if you're developing in XCode, is to add the images directories under Resources as actual directories and not groups. Once that's done, in your AppDelegate.cpp, you can switch based upon screen size to different directories based on resolutions. As per the example:
vector<string> searchPath;
CCSize frameSize = view->getFrameSize();
if (frameSize.height > 640) {
searchPath.push_back("hd);
}
This will effectively ignore asests of the wrong size and only load asets of the correct size.
If you're not developing in XCode, then you need to alter you build file depending upon the resolution the target is aimed at.