| CRM64Pro GDK v0.15.0 A free cross-platform game development kit built on top of SDL 3.0

Loading...
Searching...
No Matches
CRM64Pro::SceneObject
Scene module » Scene Layer base » Scene LayerObject

Base class for all Scene game objects. More...

## Detailed Description

Base class for all Scene game objects.

## Public Types
typedef void(* | SCENE_OnTriggerEvent) (const SceneTriggerEvent &ev, void *pUserData)
| Trigger 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 &context)
| Called each frame when layer has UPDATE enabled.
virtual void | render (Scene *pScene, SceneLayerContext &context)
| 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.
void | 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 px, float py) 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.
const string & | getType () const
| Get the type identifier.
const string & | getName () const
| Get the object name.
bool | addTrigger (const SceneObjectTrigger &trigger)
| Add a trigger zone to this object.
bool | updateTrigger (const SceneObjectTrigger &trigger)
| 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 (SCENE_OnTriggerEvent fn, void *pUserData=nullptr)
| Set trigger event callback.