Polycode::ScreenEntity Class Reference

2D Entity base. More...

Inherits Polycode::Entity.

Inherited by Polycode::ScreenEntityInstance, Polycode::ScreenMesh, Polycode::ScreenParticleEmitter, Polycode::ScreenSound, and Polycode::ScreenSoundListener.

List of all members.

Public Member Functions

virtual EntityClone (bool deepClone, bool ignoreEditorOnly)
 Clones the entity, return an exact copy.
virtual void applyClone (Entity *clone, bool deepClone, bool ignoreEditorOnly)
 This method must be implemented by all subvlasses implementing Clone.
void addEntity (Entity *newChild)
void setPosition (Number x, Number y)
 Set 2d position.
void setPosition (const Vector2 &v)
 Set 2d position.
void setScale (Number x, Number y)
 Set 2d scale.
void setScale (const Vector2 &v)
 Set 2d scale.
void setRotation (Number rotation)
 Set 2d rotation.
Number getRotation () const
 Returns current rotation.
Number getWidth () const
 Returns the width of the screen entity.
Number getHeight () const
 Returns the height of the screen entity.
void setWidth (Number w)
 Sets the width of the screen entity.
void setHeight (Number h)
 Sets the height of the screen entity.
void setBlendingMode (int newBlendingMode)
 Sets the entity's blending mode.
void setPositionMode (int newPositionMode)
 Changes the positioning mode of the screen entity.

Public Attributes

bool blockMouseInput
 If set to true, will block mouse events for underlaying entities.
bool snapToPixels
 If this option is true, the screen entity's positions will be roudnded to whole pixels.

Detailed Description

2D Entity base.

The ScreenEntity is the base class for all 2D elements in Polycode. They can be added to a screen or to other ScreenEntities and are rendered automatically. If you want to create custom screen objects, subclass this. ScreenEntity subclasses Entity, which use 3d positioning and tranformation, but provides some 2d-only versions of the transformation functions for convenience.


Member Function Documentation

void ScreenEntity::addEntity ( Entity newChild) [virtual]
See also:
addChild()

Reimplemented from Polycode::Entity.

Entity * ScreenEntity::Clone ( bool  deepClone,
bool  ignoreEditorOnly 
) [virtual]

Clones the entity, return an exact copy.

This method must be implemented in an Entity subclass for you to be able to clone it.

Parameters:
deepCloneIf true, perform a deep clone, cloning all the children.
ignoreEditorOnlyIf true, ignore all child entities where editorOnly is set to true (will still clone the entity you call Clone() on even if its editorOnly flag is set to true.
Returns:
The clone of the entity.

Reimplemented from Polycode::Entity.

Reimplemented in Polycode::ScreenParticleEmitter, Polycode::ScreenImage, Polycode::ScreenLabel, Polycode::ScreenShape, Polycode::ScreenSound, and Polycode::ScreenSprite.

Number ScreenEntity::getRotation ( ) const

Returns current rotation.

Returns:
Current rotation value.
Number ScreenEntity::getWidth ( ) const

Returns the width of the screen entity.

Returns:
Height of the screen entity.
void ScreenEntity::setBlendingMode ( int  newBlendingMode)

Sets the entity's blending mode.

Parameters:
newBlendingModeNew blending mode to set. Possible values are Renderer::BLEND_MODE_NORMAL, Renderer::BLEND_MODE_LIGHTEN, Renderer::BLEND_MODE_COLOR, Renderer::BLEND_MODE_PREMULTIPLIED, Renderer::BLEND_MODE_MULTIPLY. See the Renderer class for details on individual blending modes.
See also:
Renderer

Reimplemented from Polycode::Entity.

void Polycode::ScreenEntity::setHeight ( Number  h) [inline]

Sets the height of the screen entity.

Parameters:
hNew height value.
void ScreenEntity::setPosition ( Number  x,
Number  y 
)

Set 2d position.

Parameters:
xHorizontal position.
yVertical position.
void ScreenEntity::setPosition ( const Vector2 v)

Set 2d position.

Parameters:
vNew 2D position vector.
void ScreenEntity::setPositionMode ( int  newPositionMode)

Changes the positioning mode of the screen entity.

If the positioning mode is ScreenEntity::POSITION_TOPLEFT, the entity is translated by half its width and half its height when it's rendered, making all other transformations relative to its top-left cornder.instead of the center. If the mode is ScreenEntity::POSITION_CENTER, the entity is rendered as is. Set to POSITION_CENTER by default.

Parameters:
newPositionModeThe new positioning mode.
void ScreenEntity::setRotation ( Number  rotation)

Set 2d rotation.

Parameters:
rotationNew rotation value in degrees.
void ScreenEntity::setScale ( Number  x,
Number  y 
)

Set 2d scale.

Parameters:
xHorizontal scale.
yVertical scale.
void ScreenEntity::setScale ( const Vector2 v)

Set 2d scale.

Parameters:
vNew 2D scale vector.
void Polycode::ScreenEntity::setWidth ( Number  w) [inline]

Sets the width of the screen entity.

Parameters:
wNew height value.

Member Data Documentation

If set to true, will block mouse events for underlaying entities.

(NOTE: processInputEvents must be set to true)

If this option is true, the screen entity's positions will be roudnded to whole pixels.

This only works if the screen is using pixel coordinates.