Search code examples
androidioswindows-phone-8cocos2d-x

How do I organise my assets for a multi platform cocos2d-x project?


I am using cocos2d-x v2.2.3 The "create_project.py" script, creates the following folder structure (in the projects folder where cocos2dx has been setup) for my project "stanly"

projects
   |->stanly
      |->Classes
      |->proj.android
      |->proj.blackberry
      |->proj.ios
      .....
      |->Resources

I am using TexturePacker to create my sprite sheets. I understand how to use texture packer to create different sheets, and have them placed in different folders, so that cocos2dx can look in the correct folder for the appropriate sprite sheet.

I have 5 resolutions (5 spritesheets) I am supporting: IR,I,IPW,IPR,IP (the actual size of each sheet doesn't matter, I'm just using the letters on the left to show that I have one for iPad Retina, iPad, iPhone Wide, iPhone Retina, iPhone.) All of the sheets are called "sprites" (sprites.plist / sprites.png), and will be stored in the appropriate folder for each screen size mentioned.

I intend to use all the sprite sheets for each platform that I intend to support.(iOS, Android, WP8)

The problem: I don't understand where to place these folders in relation to the already created folder hierarchy above. Since I intend to use the same sheets for all the platforms I support. Where do I create a folder to store the subfolders that will contain each sheet?

I'm used to coding with cocos2d-iphone, and have so far read the following docs for cocos2d-x, so I think I understand how cocos2dx handles multiple resolutions. What I don't understand is from the HelloCpp example, is where the directories it is looking at should be to satisfy all platforms.

Does putting all the folders in the resources directory mean that all platforms will have access to it ?

http://www.cocos2d-x.org/wiki/Detailed_explanation_of_Cocos2d-x_Multi-resolution_adaptation http://www.cocos2d-x.org/wiki/Multi_resolution_supporthttp://www.cocos2d-x.org/wiki/Mechanism_of_loading_resources


Solution

  • I use Resources for everything. You put everything in it. Then in your IDE and/or makefile you just bring in the ones you need for that platform.