Polycode::Screen Class Reference

2D rendering base. More...

Inherits Polycode::EventDispatcher.

List of all members.

Public Member Functions

 Screen ()
 Default constructor.
void addChild (ScreenEntity *newEntity)
 Adds a ScreenEntity to the 2d rendering pipeline.
void addEntity (ScreenEntity *newEntity)
 Adds a ScreenEntity to the 2d rendering pipeline.
virtual void removeChild (ScreenEntity *entityToRemove)
 Removes a ScreenEntity from the screen's root entity.
void setScreenOffset (Number x, Number y)
 Sets the screen's offset.
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.
bool hasFilterShader () const
 Returns true if the screen has a shader applied to it.
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

void Screen::addChild ( ScreenEntity newEntity)

Adds a ScreenEntity to the 2d rendering pipeline.

Parameters:
newEntityEntity to add.
void Screen::addEntity ( ScreenEntity newEntity)

Adds a ScreenEntity to the 2d rendering pipeline.

Parameters:
newEntityEntity to add.
void Screen::removeChild ( ScreenEntity entityToRemove) [virtual]

Removes a ScreenEntity from the screen's root entity.

Parameters:
entityToRemoveEntity to remove.
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:
newValIf true, the screen will use normalized coordinates, if false, it will use pixel coordinates.
yCoordinateSizeThe 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:
xNew x offset.
yNew y offset.
void Screen::setScreenShader ( const String shaderName)

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

Parameters:
shaderNameName of the shader material to use.

Member Data Documentation

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

Defaults to false.