Public Member Functions | Protected Member Functions | Protected Attributes

psastras::engine::graphics::Scene Class Reference

Collaboration diagram for psastras::engine::graphics::Scene:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Scene ()
CopyOnWriteArrayList< SceneEntityitems ()
Bitmap backgroundImage ()
int backgroundColor ()
void setBackgroundBitmap (Bitmap b)
void setBackgroundColor (int color)
void draw (final Canvas c, final Engine e, final Viewport v)
void addEntity (SceneEntity e)
void addAnimation (Animation a)
CopyOnWriteArrayList< SceneEntitytouchables ()
SceneEntity locateSceneObject (Vec2F virtualCoords)

Protected Member Functions

void prepareSceneForDraw ()

Protected Attributes

CopyOnWriteArrayList< SceneEntityscene_ = new CopyOnWriteArrayList<SceneEntity>()
CopyOnWriteArrayList< Animationanimations_ = new CopyOnWriteArrayList<Animation>()
CopyOnWriteArrayList< SceneEntitytouchables_ = new CopyOnWriteArrayList<SceneEntity>()
boolean isSceneDirty_ = true
int backgroundColor_ = Color.BLACK
Bitmap backgroundBitmap_ = null

Detailed Description

Scene which contains a set number of SceneEntities. The Scene is what contains all of the elements to be drawn at a time. The SceneEntities are stored in a SceneGraph with a SceneNode as the root node, where transformations are composed to find the child transformations. Multiple scenes may be created (and probably should), but a DrawHandler can only have one scene set at a time.


Constructor & Destructor Documentation

psastras::engine::graphics::Scene::Scene (  )  [inline]

The scene constructor. Currently doesn't do anything. A scene must be created by adding items to the root node.


Member Function Documentation

void psastras::engine::graphics::Scene::addEntity ( SceneEntity  e  )  [inline]

Adds an entity to the scene. When adding entities, touch and physics handlers should be already applied, otherwise they may not necessarily have any effect.

Parameters:
e The SceneEntity to add.
void psastras::engine::graphics::Scene::draw ( final Canvas  c,
final Engine  e,
final Viewport  v 
) [inline]

Responsible for calling the draw methods of all the entities contained within the scene that should appear on the screen. If the root node is null, this returns, doing nothing. Otherwise, it checks if the scene is dirty (objects have been added or removed since the last draw), and if it is dirty, it prepares the scene for drawing by zsorting all of the scene entities, and culling objects outside of the viewport. Finally, it draws all of the SceneEntities.

Parameters:
c The application drawing canvas.
e The Engine instance.
v The current viewport.

The documentation for this class was generated from the following file:
 All Classes Functions Variables