|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
#include <DekiObject.h>
Public Member Functions | |
| DekiObject () | |
| DekiObject (const std::string &objectName) | |
| DekiObject (const DekiObject &)=delete | |
| Non-copyable: a DekiObject owns its children and components by raw pointer, so a copy would double-free them. | |
| DekiObject & | operator= (const DekiObject &)=delete |
| ~DekiObject () | |
| Out of line ON PURPOSE. | |
| uint32_t | GetId () const |
| void | SetId (uint32_t newId) |
| const std::string & | GetName () const |
| void | SetName (const std::string &newName) |
| bool | IsActive () const |
| void | SetActive (bool value) |
| bool | IsEditorOnly () const |
| void | SetEditorOnly (bool value) |
| bool | IsPersistent () const |
| void | SetPersistent (bool value) |
| void | SetOwnerScene (Scene *scene) |
| Scene * | GetOwnerScene () const |
| bool | IsSceneInstance () const |
| bool | IsPartOfInstance () const |
| void | SetPartOfInstance (bool value) |
| const std::string & | GetSourceSceneGuid () const |
| Empty when this object is not a scene instance. | |
| void | SetSourceSceneGuid (const std::string &guid) |
| const std::string & | GetInstanceOverridesJson () const |
| void | SetInstanceOverridesJson (const std::string &json) |
| void | AddChild (DekiObject *child) |
| void | RemoveChild (DekiObject *child) |
| void | SetParent (DekiObject *newParent) |
| DekiObject * | GetParent () const |
| const std::vector< DekiObject * > & | GetChildren () const |
| DekiObject * | FindChild (uint32_t childId) |
| DekiObject * | FindChildByName (const std::string &name) |
| void | RemoveFromParent () |
| bool | IsDescendantOf (DekiObject *ancestor) const |
| void | InsertChildAt (DekiObject *child, size_t index) |
| int | GetChildIndex (DekiObject *child) const |
| bool | IsActiveInHierarchy () const |
| void | SetLocalPosition (float newX, float newY) |
| void | SetWorldPosition (float worldX, float worldY) |
| void | SetWorldPositionPx (float pxX, float pxY) |
| void | SetScale (float scaleX, float scaleY) |
| void | SetRotation (float radians) |
| Rotation setter. | |
| DekiWorldTransform | GetWorldTransform () const |
| All five world-transform values with one dirty check. | |
| float | GetWorldX () const |
| float | GetWorldY () const |
| float | GetWorldRotation () const |
| float | GetWorldScaleX () const |
| float | GetWorldScaleY () const |
| void | MarkWorldTransformDirty () |
| Mark this object's world transform (and all descendants) as needing recalculation. | |
| float | GetX () const |
| float | GetY () const |
| float | GetLocalRotation () const |
| float | GetScaleX () const |
| float | GetScaleY () const |
| void | SetX (float newX) |
| void | SetY (float newY) |
| void | SetScaleX (float newScaleX) |
| void | SetScaleY (float newScaleY) |
| template<typename T, typename... Args> | |
| T * | AddComponent (Args &&... args) |
| void | AddComponent (DekiComponent *component) |
| Add a pre-created component (runtime scene loading). | |
| DekiComponent * | AddComponent (const std::string &typeName) |
| Add a component by type name (editor only). | |
| DekiComponent * | AddComponent (const std::string &typeName, const std::string &classHint) |
| template<typename T> | |
| T * | GetComponent () |
| Get component by type, including derived types Matches both exact type and components that inherit from T. | |
| template<typename T> | |
| const T * | GetComponent () const |
| DekiComponent * | GetComponentByTypeId (uint32_t typeId) |
| Get component by runtime type ID (exact match only). | |
| const DekiComponent * | GetComponentByTypeId (uint32_t typeId) const |
| template<typename T> | |
| std::vector< T * > | GetComponents () |
| Get all components of a specific type, including derived types Matches both exact type and components that inherit from T. | |
| template<typename T> | |
| bool | HasComponent () const |
| Check if object has component of type T, including derived types. | |
| template<typename T> | |
| void | RemoveComponent () |
| void | RemoveComponent (DekiComponent *comp) |
| Remove a specific component by pointer. | |
| const std::vector< DekiComponent * > & | GetComponents () const |
| Get all components on this object. | |
| template<typename T> | |
| T * | FindInterface () |
| Find a component implementing a given interface No RTTI needed — uses ComponentInterfaceAdapters registry. | |
Static Public Member Functions | |
| static uint32_t | GenerateId () |
| static uint32_t | GenerateDeterministicId (uint32_t seed1, uint32_t seed2) |
| DekiObject::DekiObject | ( | ) |
| DekiObject::DekiObject | ( | const std::string & | objectName | ) |
|
delete |
Non-copyable: a DekiObject owns its children and components by raw pointer, so a copy would double-free them.
Made explicit here because the editor-only instance payload lives in a side table keyed by this, which a copy would silently share.
| DekiObject::~DekiObject | ( | ) |
Out of line ON PURPOSE.
It erases this object's row from the editor-only side table in DekiObject.cpp, which the runtime build must not need to see. Defining it = default in this header would reintroduce exactly the layout dependency this design removes.
|
delete |
|
inline |
| void DekiObject::SetId | ( | uint32_t | newId | ) |
|
inlinestatic |
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| const std::string & DekiObject::GetSourceSceneGuid | ( | ) | const |
Empty when this object is not a scene instance.
The reference is valid until the next SetSourceSceneGuid on this object, or its destruction.
| void DekiObject::SetSourceSceneGuid | ( | const std::string & | guid | ) |
| const std::string & DekiObject::GetInstanceOverridesJson | ( | ) | const |
| void DekiObject::SetInstanceOverridesJson | ( | const std::string & | json | ) |
| void DekiObject::AddChild | ( | DekiObject * | child | ) |
| void DekiObject::RemoveChild | ( | DekiObject * | child | ) |
| void DekiObject::SetParent | ( | DekiObject * | newParent | ) |
|
inline |
|
inline |
| DekiObject * DekiObject::FindChild | ( | uint32_t | childId | ) |
| DekiObject * DekiObject::FindChildByName | ( | const std::string & | name | ) |
| void DekiObject::RemoveFromParent | ( | ) |
| bool DekiObject::IsDescendantOf | ( | DekiObject * | ancestor | ) | const |
| void DekiObject::InsertChildAt | ( | DekiObject * | child, |
| size_t | index ) |
| int DekiObject::GetChildIndex | ( | DekiObject * | child | ) | const |
| bool DekiObject::IsActiveInHierarchy | ( | ) | const |
| void DekiObject::SetLocalPosition | ( | float | newX, |
| float | newY ) |
| void DekiObject::SetWorldPosition | ( | float | worldX, |
| float | worldY ) |
| void DekiObject::SetWorldPositionPx | ( | float | pxX, |
| float | pxY ) |
| void DekiObject::SetScale | ( | float | scaleX, |
| float | scaleY ) |
| void DekiObject::SetRotation | ( | float | radians | ) |
Rotation setter.
Angle is in radians (the inspector displays degrees via DEKI_UNIT(Angle)).
|
inline |
All five world-transform values with one dirty check.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void DekiObject::MarkWorldTransformDirty | ( | ) |
Mark this object's world transform (and all descendants) as needing recalculation.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void DekiObject::SetX | ( | float | newX | ) |
| void DekiObject::SetY | ( | float | newY | ) |
| void DekiObject::SetScaleX | ( | float | newScaleX | ) |
| void DekiObject::SetScaleY | ( | float | newScaleY | ) |
|
inline |
|
inline |
Add a pre-created component (runtime scene loading).
| component | The component to add (takes ownership) |
| DekiComponent * DekiObject::AddComponent | ( | const std::string & | typeName | ) |
Add a component by type name (editor only).
| typeName | The registered component type name |
| DekiComponent * DekiObject::AddComponent | ( | const std::string & | typeName, |
| const std::string & | classHint ) |
|
inline |
Get component by type, including derived types Matches both exact type and components that inherit from T.
E.g., GetComponent<SetupComponent>() returns SDCardComponent if it inherits from SetupComponent.
|
inline |
|
inline |
Get component by runtime type ID (exact match only).
|
inline |
|
inline |
Get all components of a specific type, including derived types Matches both exact type and components that inherit from T.
|
inline |
Check if object has component of type T, including derived types.
|
inline |
|
inline |
Remove a specific component by pointer.
| comp | The component to remove |
|
inline |
Get all components on this object.
|
inline |
Find a component implementing a given interface No RTTI needed — uses ComponentInterfaceAdapters registry.
T must have a static constexpr uint32_t InterfaceID member.