|
Sparkle 0.0.1
|
Position, rotation, and scale component for 2D entities. More...
#include <spk_transform_2d.hpp>


Public Types | |
| using | EditionContract = spk::ContractProvider::Contract |
| Subscription contract type for transform edits. | |
| using | EditionJob = spk::ContractProvider::Job |
| Job callback type for transform edits. | |
| Public Types inherited from spk::ActivableObject | |
| using | Contract = StatefulObject<ActivationStatus>::Contract |
| Subscription handle controlling callback lifetime. | |
| using | Job = StatefulObject<ActivationStatus>::Job |
| Callback signature executed on activation state changes. | |
| Public Types inherited from spk::StatefulObject< ActivationStatus > | |
| using | Contract |
| Handle allowing subscribers to manage callback lifetimes. | |
| using | Job |
| Callable invoked when the object transitions to a state. | |
Public Member Functions | |
| Transform2D (const std::wstring &p_name) | |
| Creates a transform component. | |
| const spk::Matrix4x4 & | localModelMatrix () const |
| Returns the local model matrix. | |
| const spk::Matrix4x4 & | modelMatrix () const |
| Returns the world model matrix. | |
| const spk::Matrix4x4 & | localInverseModelMatrix () const |
| Returns the inverse local model matrix. | |
| const spk::Matrix4x4 & | inverseModelMatrix () const |
| Returns the inverse world model matrix. | |
| void | setLayer (const float &p_layer) |
| Sets the rendering layer. | |
| const float & | layer () const |
| Returns the local layer value. | |
| float | globalLayer () const |
| Returns the world layer value. | |
| void | setPosition (const spk::Vector2 &p_position) |
| Sets the local position. | |
| const spk::Vector2 & | position () const |
| Returns the local position. | |
| spk::Vector2 | globalPosition () const |
| Returns the world position. | |
| void | setScale (const spk::Vector2 &p_scale) |
| Sets the local scale. | |
| const spk::Vector2 & | scale () const |
| Returns the local scale. | |
| spk::Vector2 | globalScale () const |
| Returns the world scale. | |
| void | setRotation (const float &p_rotation) |
| Sets the local rotation. | |
| const float & | rotation () const |
| Returns the local rotation. | |
| float | globalRotation () const |
| Returns the world rotation. | |
| void | applyForce (const spk::Force2D &p_force) |
| Applies a force to the transform velocity. | |
| const spk::Force2D & | velocity () const |
| Returns the current velocity. | |
| void | notifyParentTransformEdited () |
| Notifies the parent that this transform changed. | |
| EditionContract | subscribeToEdition (const EditionJob &p_job) |
| Subscribes to transform edit events. | |
| Public Member Functions inherited from spk::Component2D | |
| Component2D (const std::wstring &p_name) | |
| Builds a 2D component with a name. | |
| Entity2D * | owner () |
| Returns the 2D owner entity. | |
| const Entity2D * | owner () const |
| Returns the 2D owner entity. | |
| Public Member Functions inherited from spk::Component | |
| Component (const std::wstring &p_name) | |
| Builds a component with a name. | |
| ~Component () override | |
| Virtual destructor. | |
| void | setName (const std::wstring &p_name) |
| Sets the component name. | |
| void | setPriority (const int &p_priority) |
| Sets the component priority. | |
| const std::wstring & | name () const |
| Returns the component name. | |
| int | priority () const |
| Returns the component priority. | |
| Entity * | owner () |
| Returns the owning entity. | |
| const Entity * | owner () const |
| Returns the owning entity. | |
| virtual void | start () |
| Called when the component starts. | |
| virtual void | awake () |
| Called when the component becomes active. | |
| virtual void | sleep () |
| Called when the component is put to sleep. | |
| virtual void | stop () |
| Called when the component stops. | |
| virtual void | handleGeometryChange (const spk::Extend2D &p_geometry) |
| Handles geometry change events. | |
| virtual void | handlePaintEvent (spk::PaintEvent &p_event) |
| Handles paint events. | |
| virtual void | handleKeyPressEvent (spk::KeyPressEvent &p_event) |
| Handles key press events. | |
| virtual void | handleKeyReleaseEvent (spk::KeyReleaseEvent &p_event) |
| Handles key release events. | |
| virtual void | handleGlyphEvent (spk::GlyphEvent &p_event) |
| Handles glyph input events. | |
| virtual void | handleMousePressEvent (spk::MousePressEvent &p_event) |
| Handles mouse press events. | |
| virtual void | handleMouseReleaseEvent (spk::MouseReleaseEvent &p_event) |
| Handles mouse release events. | |
| virtual void | handleMouseDoubleClickEvent (spk::MouseDoubleClickEvent &p_event) |
| Handles mouse double-click events. | |
| virtual void | handleMouseMotionEvent (spk::MouseMotionEvent &p_event) |
| Handles mouse motion events. | |
| virtual void | handleMouseWheelEvent (spk::MouseWheelEvent &p_event) |
| Handles mouse wheel events. | |
| virtual void | handleEnterResizeModeEvent (spk::EnterResizeModeEvent &p_event) |
| Handles enter resize mode events. | |
| virtual void | handleResizeEvent (spk::ResizeEvent &p_event) |
| Handles resize events. | |
| virtual void | handleExitResizeModeEvent (spk::ExitResizeModeEvent &p_event) |
| Handles exit resize mode events. | |
| virtual void | handleQuitEvent (spk::QuitEvent &p_event) |
| Handles quit events. | |
| virtual void | handleMoveEvent (spk::MoveEvent &p_event) |
| Handles move events. | |
| virtual void | handleFullScreenModeEvent (spk::FullScreenModeEvent &p_event) |
| Handles fullscreen mode events. | |
| virtual void | handleMaximizedModeEvent (spk::MaximizedModeEvent &p_event) |
| Handles maximized mode events. | |
| virtual void | handleFocusEvent (spk::FocusEvent &p_event) |
| Handles focus events. | |
| virtual void | handleUpdateEvent (spk::UpdateEvent &p_event) |
| Handles update events. | |
| Public Member Functions inherited from spk::ActivableObject | |
| ActivableObject () | |
| Builds a deactivated object. | |
| ActivableObject (ActivationStatus p_initial) | |
| Builds with a custom initial activation state. | |
| void | activate () |
| Sets the state to Activated. | |
| void | deactivate () |
| Sets the state to Deactivated. | |
| void | toggle () |
| Toggles between activated and deactivated states. | |
| bool | isActive () const |
| Checks whether the object is currently activated. | |
| Contract | addActivationCallback (const Job &p_callback) |
| Registers a callback executed when the object activates. | |
| Contract | addDeactivationCallback (const Job &p_callback) |
| Registers a callback executed when the object deactivates. | |
| Public Member Functions inherited from spk::StatefulObject< ActivationStatus > | |
| StatefulObject (const ActivationStatus &p_initialState) | |
| Builds with an initial state. | |
| StatefulObject & | operator= (const StatefulObject &p_other)=delete |
| void | setState (const ActivationStatus &p_newState) |
| Sets a new state and triggers callbacks registered for it. | |
| ActivationStatus | state () const |
| Returns the current state. | |
| Contract | addCallback (const ActivationStatus &p_state, const Job &p_callback) |
| Subscribes a callback for a specific state. | |
Protected Member Functions | |
| void | _onUpdateEvent (spk::UpdateEvent &p_event) override |
| Updates transform state during update events. | |
| const Transform2D * | _parentTransform () const |
| Returns the parent transform if any. | |
| void | _releaseGlobalCache () |
| Clears cached global transform data. | |
| void | _notifyEdition () |
| Notifies subscribers that the transform changed. | |
| Protected Member Functions inherited from spk::Component | |
| virtual void | _onGeometryChange (const spk::Extend2D &p_geometry) |
| Handles geometry changes before public callbacks. | |
| virtual void | _onPaintEvent (spk::PaintEvent &p_event) |
| Handles paint events before public callbacks. | |
| virtual void | _onKeyPressEvent (spk::KeyPressEvent &p_event) |
| Handles key press events before public callbacks. | |
| virtual void | _onKeyReleaseEvent (spk::KeyReleaseEvent &p_event) |
| Handles key release events before public callbacks. | |
| virtual void | _onGlyphEvent (spk::GlyphEvent &p_event) |
| Handles glyph input events before public callbacks. | |
| virtual void | _onMousePressEvent (spk::MousePressEvent &p_event) |
| Handles mouse press events before public callbacks. | |
| virtual void | _onMouseReleaseEvent (spk::MouseReleaseEvent &p_event) |
| Handles mouse release events before public callbacks. | |
| virtual void | _onMouseDoubleClickEvent (spk::MouseDoubleClickEvent &p_event) |
| Handles mouse double-click events before public callbacks. | |
| virtual void | _onMouseMotionEvent (spk::MouseMotionEvent &p_event) |
| Handles mouse motion events before public callbacks. | |
| virtual void | _onMouseWheelEvent (spk::MouseWheelEvent &p_event) |
| Handles mouse wheel events before public callbacks. | |
| virtual void | _onEnterResizeModeEvent (spk::EnterResizeModeEvent &p_event) |
| Handles enter resize mode events before public callbacks. | |
| virtual void | _onResizeEvent (spk::ResizeEvent &p_event) |
| Handles resize events before public callbacks. | |
| virtual void | _onExitResizeModeEvent (spk::ExitResizeModeEvent &p_event) |
| Handles exit resize mode events before public callbacks. | |
| virtual void | _onQuitEvent (spk::QuitEvent &p_event) |
| Handles quit events before public callbacks. | |
| virtual void | _onMoveEvent (spk::MoveEvent &p_event) |
| Handles move events before public callbacks. | |
| virtual void | _onFullScreenModeEvent (spk::FullScreenModeEvent &p_event) |
| Handles fullscreen mode events before public callbacks. | |
| virtual void | _onMaximizedModeEvent (spk::MaximizedModeEvent &p_event) |
| Handles maximized mode events before public callbacks. | |
| virtual void | _onFocusEvent (spk::FocusEvent &p_event) |
| Handles focus events before public callbacks. | |
Position, rotation, and scale component for 2D entities.
|
explicit |
Creates a transform component.
| p_name | Component name. |


|
overrideprotectedvirtual |
Updates transform state during update events.
| p_event | Update event. |
Reimplemented from spk::Component.


|
protected |
Returns the parent transform if any.


| void spk::Transform2D::applyForce | ( | const spk::Force2D & | p_force | ) |
Applies a force to the transform velocity.
| p_force | Force to apply. |


| float spk::Transform2D::globalLayer | ( | ) | const |
Returns the world layer value.


| spk::Vector2 spk::Transform2D::globalPosition | ( | ) | const |
Returns the world position.


| float spk::Transform2D::globalRotation | ( | ) | const |
Returns the world rotation.


| spk::Vector2 spk::Transform2D::globalScale | ( | ) | const |
Returns the world scale.


| const spk::Matrix4x4 & spk::Transform2D::inverseModelMatrix | ( | ) | const |
Returns the inverse world model matrix.


| const float & spk::Transform2D::layer | ( | ) | const |
Returns the local layer value.


| const spk::Matrix4x4 & spk::Transform2D::localInverseModelMatrix | ( | ) | const |
Returns the inverse local model matrix.


| const spk::Matrix4x4 & spk::Transform2D::localModelMatrix | ( | ) | const |
Returns the local model matrix.


| const spk::Matrix4x4 & spk::Transform2D::modelMatrix | ( | ) | const |
Returns the world model matrix.


| const spk::Vector2 & spk::Transform2D::position | ( | ) | const |
Returns the local position.


| const float & spk::Transform2D::rotation | ( | ) | const |
Returns the local rotation.


| const spk::Vector2 & spk::Transform2D::scale | ( | ) | const |
Returns the local scale.


| void spk::Transform2D::setLayer | ( | const float & | p_layer | ) |
Sets the rendering layer.
| p_layer | Layer value. |


| void spk::Transform2D::setPosition | ( | const spk::Vector2 & | p_position | ) |
Sets the local position.
| p_position | New position. |


| void spk::Transform2D::setRotation | ( | const float & | p_rotation | ) |
Sets the local rotation.
| p_rotation | Rotation angle in radians. |


| void spk::Transform2D::setScale | ( | const spk::Vector2 & | p_scale | ) |
Sets the local scale.
| p_scale | Scale value. |


| Transform2D::EditionContract spk::Transform2D::subscribeToEdition | ( | const EditionJob & | p_job | ) |
Subscribes to transform edit events.
| p_job | Callback invoked on edits. |


| const spk::Force2D & spk::Transform2D::velocity | ( | ) | const |
Returns the current velocity.

