Cocos2D-X Resources Management

Cocos2D-X provides a class to help you easily manage your Resources – CCFileUtils

Resources Search Path

You can add additional folders to your default search path.This is helpful to select resources according to device resolution.

Read contents from File

Custom TTF Fonts

Note: for some reason in an Android project I have to put the ttf fonts under fonts folder or they wont be found.

Parse Xml with TinyXml2

  • Here is a complete example with reading contents of a file(xml) and parsing it
  • All the siblings of first element are being iterated
  • You can actually paste it into a method

Extract files from zip

  • This is actually an example from stackoverflow someone had post
  • Unfortunately I lost my bookmarks after reinstalling my linux, otherwise I would post the link
  • You can actually paste it into a method

Download File

  • Be sure to add/configure certificates for android, because https wont work out of the box

Recent Posts