Polycode::Screen Class Reference

2D rendering base. More...

Inherits Polycode::EventDispatcher.

List of all members.

Public Member Functions

 Screen ()
 Default constructor.
ScreenEntityaddChild (ScreenEntity *newEntity)
 Adds a ScreenEntity to the 2d rendering pipeline.
virtual ScreenEntityremoveChild (ScreenEntity *entityToRemove)
 Removes a ScreenEntity from the screen's render list.
void setScreenOffset (Number x, Number y)
 Sets the screen's offset.
Vector2 getScreenOffset () const
 Returns the screen's offset.
ScreenEntitygetEntityAt (Number x, Number y)
 Returns the entity at specified point.
void setNormalizedCoordinates (bool newVal, Number yCoordinateSize=1.0f)
 Changes the screen's coordinate system.
void setScreenShader (const String &shaderName)
 Sets the shader material to use for post processing on this screen.
void clearScreenShader ()
 Removes the current screen shader for this screen.
void handleEvent (Event *event)
 This method gets called by an EventDispatcher that the handler is listening to if the dispatching event's code matches the code that handler is listening for.
void sortChildren ()
 Sorts the screen's children based on their z index.
bool hasFilterShader () const
 Returns true if the screen has a shader applied to it.
ScreenEntitygetRootEntity ()
 Returns the root entity.
const std::vector
< ShaderBinding * > & 
getLocalShaderOptions () const
 Returns the local shader options for the camera post processing material.
Material * getScreenShaderMaterial () const
 Returns the shader material applied to the camera.

Public Attributes

bool enabled
 If set to false, the screen will not be rendered or updated.
bool processTouchEventsAsMouse
 If set to true, will process touch events as mouse clicks.
bool ownsChildren
 If ownsChildren is set to true, the scene will delete its children upon destruction (defaults to false).

Detailed Description

2D rendering base.

The Screen is the container for all 2D rendering in Polycode. Screens are automatically rendered and need only be instantiated to immediately add themselves to the rendering pipeline. Each screen has a root entity.


Member Function Documentation

ScreenEntity * Screen::addChild ( ScreenEntity newEntity  ) 

Adds a ScreenEntity to the 2d rendering pipeline.

Parameters:
newEntity Entity to add.
Returns:
Returns the same entity for convenience.
ScreenEntity * Screen::getEntityAt ( Number  x,
Number  y 
)

Returns the entity at specified point.

This is a deprecated method which does not take rotation or scale into account. Please use the 2d physics and collision module for proper collision detection.

ScreenEntity* Polycode::Screen::getRootEntity (  )  [inline]

Returns the root entity.

The root entity can be used to transform the entire screen and change its color.

Returns:
The root entity.
Vector2 Screen::getScreenOffset (  )  const

Returns the screen's offset.

Returns:
The screen's offset as 2d vector.
void Screen::handleEvent ( Event event  )  [virtual]

This method gets called by an EventDispatcher that the handler is listening to if the dispatching event's code matches the code that handler is listening for.

Typically, you subclass EventHandler and implement the handleEvent method to handle specific events.

See also:
EventDispatcher

Reimplemented from Polycode::EventHandler.

ScreenEntity * Screen::removeChild ( ScreenEntity entityToRemove  )  [virtual]

Removes a ScreenEntity from the screen's render list.

Parameters:
entityToRemove Entity to remove.
Returns:
Returns the same entity for convenience.
void Screen::setNormalizedCoordinates ( bool  newVal,
Number  yCoordinateSize = 1.0f 
)

Changes the screen's coordinate system.

By default, screens' dimensions are in pixels. To accommodate changing resolutions without changing the dimensions of a screen's content, you can call this method to make it use normalized coordinates.

Parameters:
newVal If true, the screen will use normalized coordinates, if false, it will use pixel coordinates.
yCoordinateSize The normalized size of the screen vertically. The horizontal size will be calculated based on the resolution.
void Screen::setScreenOffset ( Number  x,
Number  y 
)

Sets the screen's offset.

You can also translate the root entity to do the same thing.

Parameters:
x New x offset.
y New y offset.
void Screen::setScreenShader ( const String shaderName  ) 

Sets the shader material to use for post processing on this screen.

Parameters:
shaderName Name of the shader material to use.

Member Data Documentation

If set to true, will process touch events as mouse clicks.

Defaults to false.

Generated on Sat Aug 11 18:04:11 2012 for Polycode by  doxygen 1.6.3