Stores an entity's position, velocity, scale, and rotation. More...
#include <Transform.h>


Public Types | |
| enum | Rotations { NINETY , ONE_EIGHTY } |
| Enumeration for common rotation angles. | |
Public Member Functions | |
| Transform (float x, float y) | |
| Transform (float scale) | |
| Transform (float x, float y, int w, int h, float scale) | |
| Transform (Vector2D vec) | |
| void | init () override |
| Initializes the transform by setting its position. | |
| void | update () override |
| Updates the position based on velocity, delta time, and time scale. | |
| void | reload () override |
| Resets the position to its initial state. | |
| void | rotate (Rotations rotation, bool anticlockwise) |
| Rotates the transform by a predefined amount. | |
| void | setAngle (double angle) |
| Sets the transform's angle to a specific value. | |
Public Member Functions inherited from Component | |
| virtual void | draw () |
| Called once per frame after update. Used for rendering. | |
Public Attributes | |
| Vector2D | initPos |
| Vector2D | pos |
| Vector2D | vel |
| Initial position, current position, and velocity vectors. | |
| int | height = 50 |
| The height of the entity's bounding box. | |
| int | width = 50 |
| The width of the entity's bounding box. | |
| float | scale = 0.6f |
| The rendering scale. | |
| float | speed = 240.0f |
| The movement speed multiplier. | |
| int | angle |
| The rotation angle in degrees. | |
Public Attributes inherited from Component | |
| Entity * | entity |
| Pointer to the entity that owns this component. | |
Stores an entity's position, velocity, scale, and rotation.
This is a fundamental component for any entity that exists in the game world. Its position is updated based on its velocity each frame.
|
overridevirtual |
Initializes the transform by setting its position.
Reimplemented from Component.

|
overridevirtual |
Resets the position to its initial state.
Reimplemented from Component.

Rotates the transform by a predefined amount.
| rotation | The rotation to apply (NINETY or ONE_EIGHTY). |
| anticlockwise | If true, rotates counter-clockwise. |

Sets the transform's angle to a specific value.
| angle | The new angle in degrees. |


|
overridevirtual |
Updates the position based on velocity, delta time, and time scale.
Reimplemented from Component.