Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

CSDReader (Architecture & Idea)

psineur edited this page May 17, 2011 · 5 revisions

CSDElement

CSDElement is generic element, that holds information about one element(Sprite, Background, Label, etc...) CSDElement gives user interface to specific element representation. In common case different CSDElements should work as fabriques for generating different Cocos2D nodes.

CSDElement's SubClasses

  • CSDElementSprite - can create CCSprites or CCSprites for given CCSpriteBatchNode (since 0.1)
  • CSDElementCustomNode - can apply it's CCNode Properties to any given CCNode subclass.
  • CSDElementLabel - can create CCLabelBMFont's
  • CSDElementBackgroundLayer - creates CCLayerColor for background, that was set in CSD File.

CSDReader

CSDReader's instances are created from CSD File. After init it can be used to automatically create CCNode with sprites, or node with sprites for given CCSpriteBatchNode. Also it gives public access to an NSDictionary, containing all loaded CSDEelement's.

User can retain & remove some CSDElement from this Dictionary to use it later, creating Cocos2D Nodes from that CSDElement manually. CSDelements that are left in Dictionary within CSDReader will be used for next automatic node generation by this CSDReader.

CSDReader's dictionary will contain info about background, but it will not add it in autocreated node, if opacity of the background is zero.

Clone this wiki locally