![]() |
CRM64Pro GDK v0.18.0
A free cross-platform game development kit built on top of SDL 3.0
|
Base class for all Scene game objects. More...
Base class for all Scene game objects.
Public Types | |
| using | TriggerEventCallback = function<void(const SceneTriggerEvent& rEvent)> |
| Scene object trigger event callback type. | |
Public Member Functions | |
| SceneObject () | |
| Default constructor. | |
| virtual | ~SceneObject () |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual void | initialize () |
| Called after TMX import populates all fields. | |
| virtual void | update (Scene *pScene, SceneLayerContext &rContext) |
| Called each frame when layer has UPDATE enabled. | |
| virtual void | render (Scene *pScene, SceneLayerContext &rContext) |
| Called each frame when layer has RENDER enabled and object is visible. | |
| void | setPosition (float fNewX, float fNewY) |
| Set object position and update spatial grid. | |
| bool | setSize (float fNewWidth, float fNewHeight) |
| Set object size and update cached bounds. | |
| void | setVisible (bool bNewVisible) |
| Set object visibility. | |
| void | recalculateBounds () |
| Recalculate cached AABB after shape or dimension changes. | |
| bool | containsPoint (float fX, float fY) const |
| Test if a point is inside this object's shape. | |
| bool | overlapsObject (const SceneObject *pOther, SDL_FRect *pOverlap=nullptr) const |
| Test if this object's AABB overlaps another object's AABB. | |
| float | getX () const |
| Get the object X position. | |
| float | getY () const |
| Get the object Y position. | |
| float | getWidth () const |
| Get the object width. | |
| float | getHeight () const |
| Get the object height. | |
| float | getRotationDeg () const |
| Get the object rotation. | |
| bool | isVisible () const |
| Check if the object is visible. | |
| Sint32 | getID () const |
| Get the object ID. | |
| const string & | getType () const |
| Get the type identifier. | |
| const string & | getName () const |
| Get the object name. | |
| bool | hasProperty (const string &sKey) const |
| Check if a custom property exists. | |
| string | getPropertyString (const string &sKey, const string &sDefault="") const |
| Get a string custom property. | |
| Sint32 | getPropertyInt (const string &sKey, Sint32 iDefault=0) const |
| Get an integer custom property. | |
| bool | getPropertyBool (const string &sKey, bool bDefault=false) const |
| Get a boolean custom property. | |
| float | getPropertyFloat (const string &sKey, float fDefault=0.0f) const |
| Get a floating-point custom property. | |
| const SceneShapeData & | getShape () const |
| Get the object shape data. | |
| bool | isPendingDestruction () const |
| Check if the object is pending destruction. | |
| bool | addTrigger (const SceneObjectTrigger &rTrigger) |
| Add a trigger zone to this object. | |
| bool | updateTrigger (const SceneObjectTrigger &rTrigger) |
| Update an existing trigger by name. | |
| bool | removeTrigger (const string &sName) |
| Remove a trigger by name. | |
| void | clearTriggers () |
| Remove all triggers. | |
| bool | setTriggerEnabled (const string &sName, bool bEnabled) |
| Enable or disable a trigger. | |
| bool | getTrigger (const string &sName, SceneObjectTrigger *pOut) const |
| Get a trigger definition by name. | |
| Sint32 | getTriggerCount () const |
| Get number of triggers assigned to this object. | |
| void | setOnTriggerEvent (TriggerEventCallback fnCallback) |
| Set trigger event callback. | |