|
R-Type
Distributed multiplayer game engine in C++
|
Component representing position, rotation and scale in 2D space. More...
#include <Transform.hpp>


Classes | |
| struct | Vector2 |
| 2D vector structure for positions and scales. More... | |
Public Member Functions | |
| Transform () | |
| Default constructor. Initializes position to (0, 0), rotation to 0, and scale to (1, 1). | |
| Transform (float posX, float posY) | |
| Constructor with position only. | |
| Transform (float posX, float posY, float rotation, float scaleX, float scaleY) | |
| Full constructor with all parameters. | |
| ~Transform () override=default | |
| Vector2 | getPosition () const |
| Get the position vector. | |
| float | getRotation () const |
| Get the rotation angle. | |
| Vector2 | getScale () const |
| Get the scale vector. | |
| void | setPosition (float posX, float posY) |
| Set the position. | |
| void | setRotation (float rotation) |
| Set the rotation angle. | |
| void | setScale (float scaleX, float scaleY) |
| Set the scale factors. | |
| ComponentType | getType () const override |
| Get the component type ID. | |
Public Member Functions inherited from ecs::IComponent | |
| virtual | ~IComponent ()=default |
| Virtual destructor. | |
Private Attributes | |
| Vector2 | _position |
| Entity position in world space. | |
| float | _rotation |
| Rotation angle in degrees. | |
| Vector2 | _scale |
| Scale factors (default: 1, 1) | |
Component representing position, rotation and scale in 2D space.
This component stores the spatial transformation data for an entity. It includes position (x, y), rotation angle, and scale factors.
Definition at line 20 of file Transform.hpp.
|
inline |
Default constructor. Initializes position to (0, 0), rotation to 0, and scale to (1, 1).
Definition at line 35 of file Transform.hpp.
|
inline |
Constructor with position only.
| posX | X position |
| posY | Y position |
Definition at line 42 of file Transform.hpp.
|
inline |
Full constructor with all parameters.
| posX | X position |
| posY | Y position |
| rotation | Rotation angle in degrees |
| scaleX | X scale factor |
| scaleY | Y scale factor |
Definition at line 52 of file Transform.hpp.
|
overridedefault |
|
inline |
Get the position vector.
Definition at line 61 of file Transform.hpp.
References _position.
Referenced by ecs::MapSystem::_applyScrolling(), Server::_serializeEntity(), scripting::bindings::bindComponents(), ecs::WeaponSystem::calculateProjectileTransform(), ecs::PrefabFactory::createOrbitalModule(), ecs::WeaponSystem::createProjectile(), ecs::WeaponSystem::fireMultipleShots(), server::GameStateSerializer::serializeEntity(), ecs::BoundarySystem::update(), ecs::MovementSystem::update(), and ecs::OrbitalSystem::updateOrbitalPosition().
|
inline |
Get the rotation angle.
Definition at line 67 of file Transform.hpp.
References _rotation.
Referenced by scripting::bindings::bindComponents().
|
inline |
Get the scale vector.
Definition at line 73 of file Transform.hpp.
References _scale.
|
inlineoverridevirtual |
Get the component type ID.
Implements ecs::IComponent.
Definition at line 105 of file Transform.hpp.
|
inline |
Set the position.
| posX | New X position |
| posY | New Y position |
Definition at line 80 of file Transform.hpp.
References _position, ecs::Transform::Vector2::x, and ecs::Transform::Vector2::y.
Referenced by scripting::bindings::bindComponents(), ecs::WeaponSystem::fireMultipleShots(), and ecs::OrbitalSystem::updateOrbitalPosition().
|
inline |
Set the rotation angle.
| rotation | New rotation in degrees |
Definition at line 89 of file Transform.hpp.
References _rotation.
Referenced by scripting::bindings::bindComponents().
|
inline |
Set the scale factors.
| scaleX | New X scale factor |
| scaleY | New Y scale factor |
Definition at line 96 of file Transform.hpp.
References _scale, ecs::Transform::Vector2::x, and ecs::Transform::Vector2::y.
|
private |
Entity position in world space.
Definition at line 108 of file Transform.hpp.
Referenced by getPosition(), and setPosition().
|
private |
Rotation angle in degrees.
Definition at line 109 of file Transform.hpp.
Referenced by getRotation(), and setRotation().
|
private |
Scale factors (default: 1, 1)
Definition at line 110 of file Transform.hpp.
Referenced by getScale(), and setScale().