![]() |
Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
|
Base class representing a 2D entity within a Scene. More...
#include <actor_2d.hpp>
Inherited by rendering_engine::StatsOverlay.
Public Member Functions | |
| Actor2D (Scene &scene) | |
| Constructs a 2D actor associated with a Scene. More... | |
| virtual | ~Actor2D () |
| virtual void | Initialize () |
| Initializes the actor after creation. More... | |
| void | SetPosition (const glm::vec2 &position) |
| Sets the actor's position in world space. More... | |
| void | SetRotation (float angleDegrees) |
| Sets the actor's rotation in degrees. More... | |
| void | SetScale (const glm::vec2 &scale) |
| Sets the actor's scale along each axis. More... | |
| const glm::vec2 & | GetPosition () const |
| Gets the actor 2d position. More... | |
| float | GetRotation () const |
| Gets the actor 2d rotation angle (degrees). More... | |
| const glm::vec2 & | GetScale () const |
| Gets the actor 2d scale. More... | |
| SceneComponent2D & | GetTransform () |
| Access to the underlying SceneComponent2D (transform). More... | |
| const SceneComponent2D & | GetTransform () const |
| virtual void | Update (float deltaTime) |
| Updates actor logic and root transform state. More... | |
| RenderResourceContext | GetRenderContext () const |
| Returns the render resource context associated with this actor. More... | |
| void | Destroy () |
| Requests deferred destruction of this 2D actor. More... | |
| bool | IsPendingDestroy () const |
| Indicates whether this actor is scheduled for destruction. More... | |
| Actor2D (const Actor2D &)=delete | |
| Actor2D & | operator= (const Actor2D &)=delete |
Protected Member Functions | |
| virtual void | Shutdown () |
| Performs internal cleanup before destruction. More... | |
| template<typename T , typename V > | |
| T * | CreateSubobject (V arg) |
| Creates and attaches a 2D drawable subobject to this actor. More... | |
| Scene & | GetScene () |
| Returns the owning Scene. More... | |
| template<> | |
| Rectangle2D * | CreateSubobject (Rectangle2D::Properties prop) |
| template<> | |
| TextBlock2D * | CreateSubobject (TextBlock2D::Properties prop) |
Protected Attributes | |
| SceneComponent2D | mRootComponent |
| bool | bUpdateOnTick |
| bool | bPendingDestroy = false |
Friends | |
| class | Scene |
Base class representing a 2D entity within a Scene.
Actor2D encapsulates:
Actor2D operates strictly in the 2D domain:
Transformations applied to the Actor2D propagate to all attached drawable subobjects via hierarchical SceneComponent2D attachment.
Actors are owned and lifetime-managed by the Scene that spawns them. They must not be manually deleted.
Definition at line 45 of file actor_2d.hpp.
| rendering_engine::Actor2D::Actor2D | ( | Scene & | scene | ) |
Constructs a 2D actor associated with a Scene.
The Scene becomes the owner of this actor. The root SceneComponent2D is initialized with identity transform.
| scene | Reference to the owning Scene. |
Definition at line 8 of file actor_2d.cpp.
|
virtual |
Definition at line 16 of file actor_2d.cpp.
|
delete |
|
protected |
Definition at line 17 of file create_actor_2d_subobject.hpp.
|
protected |
Definition at line 27 of file create_actor_2d_subobject.hpp.
|
protected |
Creates and attaches a 2D drawable subobject to this actor.
This helper function delegates creation to the owning Scene, registers the drawable for lifetime management, and stores it as a ward (child drawable) of the actor.
| T | Drawable type (must derive from Drawable2D). |
| V | Construction parameter type. |
| arg | Argument forwarded to Scene::Spawn(). |
| void rendering_engine::Actor2D::Destroy | ( | ) |
Requests deferred destruction of this 2D actor.
Marks the actor as pending destroy and schedules safe removal via the owning Scene.
The actor is not deleted immediately. Instead:
Definition at line 77 of file actor_2d.cpp.
| const glm::vec2 & rendering_engine::Actor2D::GetPosition | ( | ) | const |
Gets the actor 2d position.
Definition at line 39 of file actor_2d.cpp.
| RenderResourceContext rendering_engine::Actor2D::GetRenderContext | ( | ) | const |
Returns the render resource context associated with this actor.
Provides access to renderer-level resources required by attached 2D drawable components.
Definition at line 72 of file actor_2d.cpp.
| float rendering_engine::Actor2D::GetRotation | ( | ) | const |
Gets the actor 2d rotation angle (degrees).
Definition at line 44 of file actor_2d.cpp.
| const glm::vec2 & rendering_engine::Actor2D::GetScale | ( | ) | const |
Gets the actor 2d scale.
Definition at line 49 of file actor_2d.cpp.
|
protected |
Returns the owning Scene.
Provides access to the scene that contains this actor.
Definition at line 108 of file actor_2d.cpp.
| SceneComponent2D & rendering_engine::Actor2D::GetTransform | ( | ) |
Access to the underlying SceneComponent2D (transform).
Allows direct manipulation of local or hierarchical transforms.
Definition at line 54 of file actor_2d.cpp.
| const SceneComponent2D & rendering_engine::Actor2D::GetTransform | ( | ) | const |
Definition at line 59 of file actor_2d.cpp.
|
virtual |
Initializes the actor after creation.
Called automatically by Scene::SpawnActor2D(). Derived classes should override this method to:
Reimplemented in rendering_engine::StatsOverlay.
Definition at line 20 of file actor_2d.cpp.
|
inline |
Indicates whether this actor is scheduled for destruction.
Definition at line 160 of file actor_2d.hpp.
| void rendering_engine::Actor2D::SetPosition | ( | const glm::vec2 & | position | ) |
Sets the actor's position in world space.
| position | New position vector (x, y). |
Definition at line 24 of file actor_2d.cpp.
| void rendering_engine::Actor2D::SetRotation | ( | float | angleDegrees | ) |
Sets the actor's rotation in degrees.
| angleDegrees | Rotation angle in degrees (counterclockwise). |
Rotation is applied around the Z-axis.
Definition at line 29 of file actor_2d.cpp.
| void rendering_engine::Actor2D::SetScale | ( | const glm::vec2 & | scale | ) |
Sets the actor's scale along each axis.
| scale | New scale vector (x, y). |
Definition at line 34 of file actor_2d.cpp.
|
protectedvirtual |
Performs internal cleanup before destruction.
Called by Scene during the destruction flush phase. Derived classes may override this to release resources, but must not delete the actor manually.
Definition at line 101 of file actor_2d.cpp.
|
virtual |
Updates actor logic and root transform state.
Called once per frame by Scene::Update().
The base implementation updates the root SceneComponent2D's world matrix if ticking is enabled.
Derived classes should call Actor2D::Update(deltaTime) before or after custom logic as appropriate.
| deltaTime | Time elapsed since last frame (seconds). |
Reimplemented in rendering_engine::StatsOverlay.
Definition at line 64 of file actor_2d.cpp.
|
friend |
Definition at line 47 of file actor_2d.hpp.
|
protected |
Definition at line 210 of file actor_2d.hpp.
|
protected |
Definition at line 208 of file actor_2d.hpp.
|
protected |
Definition at line 207 of file actor_2d.hpp.