![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Defines the 2D transformation of an entity. More...
#include <Transform.hpp>
Inheritance diagram for galaxy::graphics::Transform:
Collaboration diagram for galaxy::graphics::Transform:Public Member Functions | |
| Transform () | |
| Constructor. | |
| Transform (Transform &&) | |
| Move constructor. | |
| Transform & | operator= (Transform &&) |
| Move assignment operator. | |
| Transform (const Transform &) | |
| Copy constructor. | |
| Transform & | operator= (const Transform &) |
| Copy assignment operator. | |
| virtual | ~Transform () |
| Destructor. | |
| virtual void | translate (const float x, const float y) |
| Translate (move) position. | |
| virtual void | rotate (const float degrees) |
| Rotate entity. | |
| void | scale (const float scale) |
| Set entity scale. | |
| void | set_scale_horizontal (const float x) |
| Set entity scale. | |
| void | set_scale_vertical (const float y) |
| Set entity scale. | |
| void | set_pos (const float x, const float y) |
| Sets position without moving the entity. | |
| void | set_rotation (const float degrees) |
| Set the entity rotation. | |
| void | set_origin (const float x, const float y) |
| Set the origin point. | |
| void | reset () |
| Reset transform. | |
| const glm::vec2 & | get_pos () const |
| Get stored position. | |
| float | get_rotation () const |
| Get stored rotation. | |
| const glm::vec2 & | get_scale () const |
| Get stored scale. | |
| const glm::vec2 & | get_origin () const |
| Get origin point. | |
| glm::mat4 & | get_transform () |
| Retrieve internal transformation matrix. | |
Protected Attributes | |
| glm::vec2 | m_pos |
| Cached for easy retrieval. Pos. | |
| float | m_rotation |
| Cached for easy retrieval. Rotation. | |
| glm::vec2 | m_scale |
| Cached for easy retrieval. Scale. | |
| glm::vec2 | m_origin |
| Transform origin point. | |
| bool | m_dirty |
| Flag to see if transform needs to be recalculated. | |
| glm::mat4 | m_transform |
| Combined transform. | |
Defines the 2D transformation of an entity.
Definition at line 20 of file Transform.hpp.
| galaxy::graphics::Transform::Transform | ( | ) |
Constructor.
Definition at line 22 of file Transform.cpp.
| galaxy::graphics::Transform::Transform | ( | Transform && | t | ) |
Move constructor.
Definition at line 32 of file Transform.cpp.
| galaxy::graphics::Transform::Transform | ( | const Transform & | t | ) |
Copy constructor.
Definition at line 57 of file Transform.cpp.
|
virtual |
Destructor.
Definition at line 82 of file Transform.cpp.
Move assignment operator.
Definition at line 42 of file Transform.cpp.
Here is the caller graph for this function:Copy assignment operator.
Definition at line 67 of file Transform.cpp.
|
virtual |
Translate (move) position.
| x | How far to translate on x axis. |
| y | How far to translate on y axis. |
Reimplemented in galaxy::graphics::Camera.
Definition at line 86 of file Transform.cpp.
|
virtual |
Rotate entity.
| degrees | Additive. Min -360, max 360. |
Reimplemented in galaxy::graphics::Camera.
Definition at line 94 of file Transform.cpp.
| void galaxy::graphics::Transform::scale | ( | const float | scale | ) |
Set entity scale.
| scale | Value to scale by. |
Definition at line 102 of file Transform.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void galaxy::graphics::Transform::set_scale_horizontal | ( | const float | x | ) |
Set entity scale.
| x | Value to scale horizontal axis by. |
Definition at line 110 of file Transform.cpp.
Here is the caller graph for this function:| void galaxy::graphics::Transform::set_scale_vertical | ( | const float | y | ) |
Set entity scale.
| y | Value to scale vertical axis by. |
Definition at line 116 of file Transform.cpp.
Here is the caller graph for this function:| void galaxy::graphics::Transform::set_pos | ( | const float | x, |
| const float | y ) |
Sets position without moving the entity.
| x | X position to set. |
| y | Y position to set. |
Definition at line 122 of file Transform.cpp.
Here is the caller graph for this function:| void galaxy::graphics::Transform::set_rotation | ( | const float | degrees | ) |
Set the entity rotation.
| degrees | Min -360, max 360. |
Definition at line 130 of file Transform.cpp.
Here is the caller graph for this function:| void galaxy::graphics::Transform::set_origin | ( | const float | x, |
| const float | y ) |
Set the origin point.
Only affects rotation and scale.
| x | X position to set origin to. |
| y | Y position to set origin to. |
Definition at line 136 of file Transform.cpp.
Here is the caller graph for this function:| void galaxy::graphics::Transform::reset | ( | ) |
Reset transform.
Definition at line 144 of file Transform.cpp.
|
nodiscard |
Get stored position.
Definition at line 153 of file Transform.cpp.
Here is the caller graph for this function:
|
nodiscard |
Get stored rotation.
Definition at line 158 of file Transform.cpp.
Here is the caller graph for this function:
|
nodiscard |
Get stored scale.
Definition at line 163 of file Transform.cpp.
Here is the caller graph for this function:
|
nodiscard |
Get origin point.
Definition at line 168 of file Transform.cpp.
Here is the caller graph for this function:
|
nodiscard |
Retrieve internal transformation matrix.
Definition at line 173 of file Transform.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
protected |
Cached for easy retrieval. Pos.
Definition at line 164 of file Transform.hpp.
|
protected |
Cached for easy retrieval. Rotation.
Definition at line 170 of file Transform.hpp.
|
protected |
Cached for easy retrieval. Scale.
Definition at line 176 of file Transform.hpp.
|
protected |
Transform origin point.
Definition at line 181 of file Transform.hpp.
|
protected |
Flag to see if transform needs to be recalculated.
Definition at line 186 of file Transform.hpp.
|
protected |
Combined transform.
Definition at line 191 of file Transform.hpp.