View renderer

Each time you create a State class, a view renderer is created and associated.

Note that you're free to have a different view renderer by states, for example your game is made with a StarlingView whereas the about part will be made on the display list using a SpriteView because you won't need huge performances and it will be quicker to design it in Flash Pro.

ACitrusView

All the different views extend this abstract class. It defines the LoadManager, the Camera and a bunch of functions for accessing, adding and removing arts. You will mostly use getArt(citrusObject:Object) and getObjectFromArt(art:Object) functions if you have some interaction with arts: mouse click, drag and drop, etc. Others functions will be automatically called by the engine itself when you add or remove an object.

SpriteView

The SpriteView class defines a Sprite object as the viewRoot. Everything will be added on this viewRoot.

The group property from the ISpriteView interface defines a z-index for the objects. For example, an object with a group property equal to 5 will be in front of an object with a group property equal to 4. Default group value is 0. To manage object's group with accuracy, we create automatically a new container each time a new group is requested. Each time a new object is added to the State, it is added to its group container.

The update function calls the camera update method, check if the object group value has changed and perform an update on each art object.

StarlingView

The StarlingView class is identical to the SpriteView class. However, if you want to create a HUD (or show a menu) on top of your game, using Starling sprites is the perfect solution!

Away3DView

The Away3DView class is identical to the SpriteView class. v

BlittingView

Blitting is a higher-performance alternative to using the built-in display list in Adobe Flash for drawing objects on the Stage. This technique involves copying the individual pixels of an existing image directly on to the screen—a bit like painting all of your game's spaceships and monsters onto a canvas.

Due to its nature, the BlittingView class is different from the others. The BlittingView will manage canvas rendering and objects properties. Now that Stage3D is available, we don't recommend to use anymore Blitting, you should use Starling framework.

  citrus/views.txt · Last modified: 2014/07/05 10:18 by 177.6.47.186
 
Powered by DokuWiki