Class Transform2D
Every 2D entity must have a Transform2D component. It's used to store and manipulate the position, rotation and scale of the entity.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework.Graphics
Assembly: Evergine.Framework.dll
Syntax
public sealed class Transform2D : Transform3D, IDependencyObject
Constructors
Transform2D()
Initializes a new instance of the Transform2D class.
Declaration
public Transform2D()
Properties
DrawOrder
Gets or sets the draw order (%) in world space. It's included in [0, 1] where 0 represents the closest position to the camera, and 1 the farthest. The draw order is also "contained" in layers, so the order on these last ones act prior to this value (i.e. an instance with draw order 1 in GUI layer will be always drawn closer than another one with draw order 0 in Alpha, as GUI layer is before than Alpha one).
Declaration
public float DrawOrder { get; set; }
Property Value
Type | Description |
---|---|
float | The draw order (%). |
FlipMode
Gets or sets the sprite effect.
Declaration
[RenderProperty(Tooltip = "Flip mode (FlipHorizontally, FlipVertically)")]
public FlipMode FlipMode { get; set; }
Property Value
Type | Description |
---|---|
FlipMode | The sprite effect. |
GlobalOpacity
Gets the global opacity. It's included in [0, 1] where 0 means fully transparent and 1 fully opaque.
Declaration
public float GlobalOpacity { get; }
Property Value
Type | Description |
---|---|
float | The opacity. |
LocalDrawOrder
Gets or sets the draw order (%) in local space. It's included in [0, 1] where 0 represents the closest position to the camera, and 1 the farthest. The draw order is also "contained" in layers, so the order on these last ones act prior to this value (i.e. an instance with draw order 1 in GUI layer will be always drawn closer than another one with draw order 0 in Alpha, as GUI layer is before than Alpha one).
Declaration
[RenderProperty(CustomPropertyName = "Local Draw Order", Tooltip = "It's included in [0, 1] where 0 represents the closest position \nto the camera, and 1 the farthest. The draw order is also 'contained' in layers, so the order \non these last ones act prior to this value (i.e. an instance with draw order 1 in GUI layer will be \n always drawn closer than another one with draw order 0 in Alpha, as GUI layer is before than Alpha one).")]
public float LocalDrawOrder { get; set; }
Property Value
Type | Description |
---|---|
float | The draw order (%). |
LocalPosition
Gets or sets the entity position in local space.
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = Transform2D.TransformMode.Standard, CustomPropertyName = "Local Position", Tooltip = "The entity position in local space")]
public Vector2 LocalPosition { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
LocalRotation
Gets or sets the local rotation expressed in its Roll euler angle.
Declaration
[RenderProperty(typeof(FloatRadianToDegreeConverter), CustomPropertyName = "Local Rotation", Tooltip = "The local rotation expressed in its Roll euler angle.")]
public float LocalRotation { get; set; }
Property Value
Type | Description |
---|---|
float |
LocalScale
Gets or sets the entity scale in local space.
Declaration
[RenderProperty(CustomPropertyName = "Local Scale", Tooltip = "The entity scale in local space")]
public Vector2 LocalScale { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
LocalX
Gets or sets the local space X position (px). 0 is considered to be at the left side of the screen, growing to the right as it increases.
Declaration
public float LocalX { get; set; }
Property Value
Type | Description |
---|---|
float | The X (px). |
LocalXScale
Gets or sets the X scale in local space. It's included in [0, infinity] where 1 represents the original size.
Declaration
public float LocalXScale { get; set; }
Property Value
Type | Description |
---|---|
float | The X scale (%). |
LocalY
Gets or sets the local space Y position (px). 0 is considered to be at the top side of the screen, growing to down as it increases.
Declaration
public float LocalY { get; set; }
Property Value
Type | Description |
---|---|
float | The Y (px). |
LocalYScale
Gets or sets the Y scale in local space. It's included in [0, infinity] where 1 represents the original size.
Declaration
public float LocalYScale { get; set; }
Property Value
Type | Description |
---|---|
float | The Y scale (%). |
Opacity
Gets or sets the opacity. It's included in [0, 1] where 0 means fully transparent and 1 fully opaque.
Declaration
public float Opacity { get; set; }
Property Value
Type | Description |
---|---|
float | The opacity. |
Origin
Gets or sets the origin (also known as pivot) from where the entity scales, rotates and translates. Its values are included in [0, 1] where (0, 0) indicates the top left corner. Such values are percentages where 1 means the 100% of the rectangle's width/height.
Declaration
[RenderProperty(Tooltip = "The origin (also known as pivot) from where the entity scales, rotates and translates. Its values are included in [0, 1] where (0, 0) indicates the top left corner. Such values are percentages where 1 means the 100% of the rectangle's width/height.")]
public Vector2 Origin { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Position
Gets or sets the entity position in world space.
Declaration
public Vector2 Position { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
Rectangle
Gets or sets the rectangle where the owner entity is placed.
Declaration
public RectangleF Rectangle { get; set; }
Property Value
Type | Description |
---|---|
RectangleF |
Rotation
Gets or sets the global rotation expressed in its Roll euler angle.
Declaration
public float Rotation { get; set; }
Property Value
Type | Description |
---|---|
float |
Scale
Gets or sets the entity scale in world space.
Declaration
public Vector2 Scale { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
ScreenPosition
Gets or sets the screen position.
Declaration
[RenderProperty(AttachToTag = 1, AttachToValue = Transform2D.TransformMode.Screen, CustomPropertyName = "Screen Position", Tooltip = "The screen position.")]
public Vector2 ScreenPosition { get; set; }
Property Value
Type | Description |
---|---|
Vector2 | The screen position. |
TranformMode
Gets or sets the transform mode.
Declaration
[RenderProperty(Tag = 1, CustomPropertyName = "Transform Mode", Tooltip = "Select between Standard or Screen mode")]
public Transform2D.TransformMode TranformMode { get; set; }
Property Value
Type | Description |
---|---|
Transform2D.TransformMode | The transform mode. |
Transform3D
Gets the current Transform instance casted to Transform3D, to access all 3D properties.
Declaration
public Transform3D Transform3D { get; }
Property Value
Type | Description |
---|---|
Transform3D |
X
Gets or sets the world X position (px). 0 is considered to be at the left side of the screen, growing to the right as it increases.
Declaration
public float X { get; set; }
Property Value
Type | Description |
---|---|
float | The X (px). |
XScale
Gets or sets the X scale in world space. It's included in [0, infinity] where 1 represents the original size.
Declaration
public float XScale { get; set; }
Property Value
Type | Description |
---|---|
float | The X scale (%). |
Y
Gets or sets the world Y position in world space. 0 is considered to be at the top side of the screen, growing to down as it increases.
Declaration
public float Y { get; set; }
Property Value
Type | Description |
---|---|
float | The Y (px). |
YScale
Gets or sets the Y scale in world space. It's included in [0, infinity] where 1 represents the original size.
Declaration
public float YScale { get; set; }
Property Value
Type | Description |
---|---|
float | The Y scale (%). |
Methods
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if all is OK. |
Overrides
ResetDirtyFlags()
Reset dirty flags.
Declaration
protected override void ResetDirtyFlags()
Overrides
Events
FlipmodeChanged
Event fired when this transform effect is changed
Declaration
public event EventHandler FlipmodeChanged
Event Type
Type | Description |
---|---|
EventHandler |
OriginChanged
Event fired when this transform origin is changed
Declaration
public event EventHandler OriginChanged
Event Type
Type | Description |
---|---|
EventHandler |
RectangleChanged
Event fired when this transform rectangle is changed
Declaration
public event EventHandler RectangleChanged
Event Type
Type | Description |
---|---|
EventHandler |