2D Entity base.
More...
Inherits Polycode::Entity, and Polycode::EventDispatcher.
Inherited by Polycode::ScreenMesh, Polycode::ScreenParticleEmitter, Polycode::ScreenSound, and Polycode::ScreenSoundListener.
List of all members.
Public Member Functions |
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 | setPositionMode (int newPositionMode) |
| Changes the positioning mode of the screen entity.
|
Public Attributes |
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
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 Polycode::ScreenEntity::setHeight |
( |
Number |
h | ) |
[inline] |
Sets the height of the screen entity.
- Parameters:
-
void ScreenEntity::setPosition |
( |
Number |
x, |
|
|
Number |
y |
|
) |
| |
Set 2d position.
- Parameters:
-
x | Horizontal position. |
y | Vertical position. |
void ScreenEntity::setPosition |
( |
const Vector2 & |
v | ) |
|
Set 2d position.
- Parameters:
-
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:
-
newPositionMode | The new positioning mode. |
void ScreenEntity::setRotation |
( |
Number |
rotation | ) |
|
Set 2d rotation.
- Parameters:
-
rotation | New rotation value in degrees. |
void ScreenEntity::setScale |
( |
Number |
x, |
|
|
Number |
y |
|
) |
| |
Set 2d scale.
- Parameters:
-
x | Horizontal scale. |
y | Vertical scale. |
void ScreenEntity::setScale |
( |
const Vector2 & |
v | ) |
|
Set 2d scale.
- Parameters:
-
void Polycode::ScreenEntity::setWidth |
( |
Number |
w | ) |
[inline] |
Sets the width of the screen entity.
- Parameters:
-
Member Data Documentation
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.