CRM64Pro GDK v0.20.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
Scene Layer Object

Description

Object layer containing game objects with spatial partitioning.

Each SceneLayerObject manages SceneObject instances through an internal spatial grid, deferred lifecycle requests, trigger queries and object render ordering. Built-in C64Light, C64Occluder and C64Portal objects participate in Scene lighting; each C64Particle object owns an independent runtime emitter. Objects with c64scn_blocks_particles contribute their geometry to the shared Physics collision set selected by particle emitters.

Classes

struct  CRM64Pro::SceneShapeData
 Shape geometry data for a SceneObject. More...
struct  CRM64Pro::SceneObjectTrigger
 Object trigger zone definition. More...
struct  CRM64Pro::SceneTriggerEvent
 Trigger event payload. More...
struct  CRM64Pro::SceneParticleCollisionEvent
 Batched Scene particle collision event payload. More...
class  CRM64Pro::ISceneObjectFactory
 Factory interface for creating game objects from Tiled type strings. More...
class  CRM64Pro::SceneObject
 Base class for all Scene game objects. More...
class  CRM64Pro::SceneLayerObject
 Object layer containing game objects with spatial partitioning. More...

Functions

CRM64PRO_API void CRM64Pro::SceneShapeData::calculateAABB (float fObjX, float fObjY, float fObjWidth, float fObjHeight)
 Recalculate AABB from object position and dimensions.
CRM64PRO_API void CRM64Pro::SceneObjectTrigger::addIncludeType (const string &sType)
 Add one type identifier to the include filter.
CRM64PRO_API void CRM64Pro::SceneObjectTrigger::addExcludeType (const string &sType)
 Add one type identifier to the exclude filter.
 CRM64Pro::SceneObject::SceneObject ()
 Default constructor.
virtual CRM64Pro::SceneObject::~SceneObject ()
 Virtual destructor for proper cleanup of derived classes.
virtual void CRM64Pro::SceneObject::initialize ()
 Called after Scene configuration populates all fields.
virtual void CRM64Pro::SceneObject::update (Scene *pScene, SceneLayerContext &rContext)
 Called each frame when layer has UPDATE enabled.
virtual void CRM64Pro::SceneObject::render (Scene *pScene, SceneLayerContext &rContext)
 Called each frame when layer has RENDER enabled and object is visible.
void CRM64Pro::SceneObject::setPosition (float fNewX, float fNewY, bool bTeleport=false)
 Set object position and update spatial grid.
bool CRM64Pro::SceneObject::setSize (float fNewWidth, float fNewHeight)
 Set object size and update cached bounds.
bool CRM64Pro::SceneObject::setRotationDeg (float fNewRotationDeg)
 Set object rotation and update cached bounds.
bool CRM64Pro::SceneObject::setShape (const SceneShapeData &rNewShape)
 Set object shape and update the spatial grid and particle-collision geometry.
bool CRM64Pro::SceneObject::setType (const string &sNewType)
 Set the object type identifier.
bool CRM64Pro::SceneObject::setName (const string &sNewName)
 Set the object name.
bool CRM64Pro::SceneObject::setProperty (const string &sKey, const string &sValue)
 Set a custom property.
bool CRM64Pro::SceneObject::removeProperty (const string &sKey)
 Remove a custom property.
void CRM64Pro::SceneObject::setVisible (bool bNewVisible)
 Set object visibility.
bool CRM64Pro::SceneObject::setPortalClosed (bool bClosed)
 Set whether a portal is closed.
float CRM64Pro::SceneObject::getX () const
 Get the object X position.
float CRM64Pro::SceneObject::getY () const
 Get the object Y position.
float CRM64Pro::SceneObject::getWidth () const
 Get the object width.
float CRM64Pro::SceneObject::getHeight () const
 Get the object height.
float CRM64Pro::SceneObject::getRotationDeg () const
 Get the object rotation.
bool CRM64Pro::SceneObject::isVisible () const
 Check if the object is visible.
bool CRM64Pro::SceneObject::isPortalClosed () const
 Check whether this portal is closed.
Sint32 CRM64Pro::SceneObject::getID () const
 Get the object ID.
const string & CRM64Pro::SceneObject::getType () const
 Get the type identifier.
const string & CRM64Pro::SceneObject::getName () const
 Get the object name.
ParticleEmitterCRM64Pro::SceneObject::getParticleEmitter ()
 Get this scene object's particle emitter.
const SceneShapeDataCRM64Pro::SceneObject::getShape () const
 Get the object shape data.
bool CRM64Pro::SceneObject::isPendingDestruction () const
 Check if the object is pending destruction.
bool CRM64Pro::SceneObject::addTrigger (const SceneObjectTrigger &rTrigger)
 Add a trigger zone to this object.
bool CRM64Pro::SceneObject::updateTrigger (const SceneObjectTrigger &rTrigger)
 Update an existing trigger by name.
bool CRM64Pro::SceneObject::removeTrigger (const string &sName)
 Remove a trigger by name.
void CRM64Pro::SceneObject::clearTriggers ()
 Remove all triggers.
bool CRM64Pro::SceneObject::setTriggerEnabled (const string &sName, bool bEnabled)
 Enable or disable a trigger.
bool CRM64Pro::SceneObject::getTrigger (const string &sName, SceneObjectTrigger *pOut) const
 Get a trigger definition by name.
Sint32 CRM64Pro::SceneObject::getTriggerCount () const
 Get number of triggers assigned to this object.
void CRM64Pro::SceneObject::setOnTriggerEvent (TriggerEventCallback fnCallback)
 Set trigger event callback.
bool CRM64Pro::SceneObject::hasProperty (const string &sKey) const
 Check if a custom property exists.
string CRM64Pro::SceneObject::getPropertyString (const string &sKey, const string &sDefault="") const
 Get a string custom property.
Sint32 CRM64Pro::SceneObject::getPropertyInt (const string &sKey, Sint32 iDefault=0) const
 Get an integer custom property.
bool CRM64Pro::SceneObject::getPropertyBool (const string &sKey, bool bDefault=false) const
 Get a boolean custom property.
float CRM64Pro::SceneObject::getPropertyFloat (const string &sKey, float fDefault=0.0f) const
 Get a floating-point custom property.
void CRM64Pro::SceneObject::recalculateBounds ()
 Recalculate the cached AABB from the current object geometry.
bool CRM64Pro::SceneObject::containsPoint (float fX, float fY) const
 Test if a point is inside this object's shape.
bool CRM64Pro::SceneObject::overlapsObject (const SceneObject *pOther, SDL_FRect *pOverlap=nullptr) const
 Test if this object's AABB overlaps another object's AABB.
eSceneLayerType CRM64Pro::SceneLayerObject::getType () const override
 Get the layer type.
Sint32 CRM64Pro::SceneLayerObject::update (Scene *pEngine, SceneLayerContext &rContext) override
 Update object layer logic.
Sint32 CRM64Pro::SceneLayerObject::render (Scene *pEngine, SceneLayerContext &rContext) override
 Render object layer content.
Sint32 CRM64Pro::SceneLayerObject::addObject (SceneObject *pObj)
 Add an object to this layer.
bool CRM64Pro::SceneLayerObject::closeObject (Sint32 id)
 Destroy an object by its ID.
bool CRM64Pro::SceneLayerObject::setSpatialGridCellSize (Sint32 iSize)
 Set the spatial grid cell size.
bool CRM64Pro::SceneLayerObject::setSize (float fWidth, float fHeight)
 Set the logical size of the layer (in pixels).
void CRM64Pro::SceneLayerObject::setRenderOrderMode (eSceneObjectRenderOrder eMode)
 Set object rendering order policy.
eSceneObjectRenderOrder CRM64Pro::SceneLayerObject::getRenderOrderMode () const
 Get object rendering order policy.
void CRM64Pro::SceneLayerObject::queryRegion (float fX, float fY, float fW, float fH, vector< SceneObject * > &vResults)
 Query objects whose AABB overlaps a region.
SceneObject * CRM64Pro::SceneLayerObject::getObjectByID (Sint32 idObject)
 Get object by Tiled ID.
Sint32 CRM64Pro::SceneLayerObject::getObjectCount ()
 Get number of objects in this layer.
void CRM64Pro::SceneLayerObject::getObjects (vector< SceneObject * > &vResults)
 Get all objects in this layer.
SceneObject * CRM64Pro::SceneLayerObject::findFirstByType (const string &sType)
 Find first object matching an exact type string.
SceneObject * CRM64Pro::SceneLayerObject::findFirstByName (const string &sName)
 Find first object matching an exact name string.
void CRM64Pro::SceneLayerObject::findAllByType (const string &sType, vector< SceneObject * > &vResults)
 Find all objects matching an exact type string.
void CRM64Pro::SceneLayerObject::findAllByName (const string &sName, vector< SceneObject * > &vResults)
 Find all objects matching an exact name string.
void CRM64Pro::SceneLayerObject::setOnTriggerEvent (SceneObject::TriggerEventCallback fnCallback)
 Set a layer-wide trigger event callback.
float CRM64Pro::SceneLayerObject::getTotalWidth () const override
 Get layer total width in pixels.
float CRM64Pro::SceneLayerObject::getTotalHeight () const override
 Get layer total height in pixels.
void CRM64Pro::Scene::setObjectFactory (ISceneObjectFactory *pFactory)
 Set the object factory for creating game objects from Tiled types.
ISceneObjectFactoryCRM64Pro::Scene::getObjectFactory () const
 Get the current object factory.
bool CRM64Pro::Scene::isObjectLayer (Sint32 iLayer) const
 Check if a layer is an object layer.

Function Documentation

◆ calculateAABB()

void CRM64Pro::SceneShapeData::calculateAABB ( float fObjX,
float fObjY,
float fObjWidth,
float fObjHeight )

Recalculate AABB from object position and dimensions.

For polygons/polylines, calculates bounds from vertices. For other shapes, uses position and width/height.

Parameters
fObjXObject X position in world space.
fObjYObject Y position in world space.
fObjWidthObject width (ignored for polygon/polyline).
fObjHeightObject height (ignored for polygon/polyline).

◆ addIncludeType()

void CRM64Pro::SceneObjectTrigger::addIncludeType ( const string & sType)

Add one type identifier to the include filter.

Type is hashed internally exactly as provided. Empty strings are ignored.

Parameters
sTypeThe type string to include.

◆ addExcludeType()

void CRM64Pro::SceneObjectTrigger::addExcludeType ( const string & sType)

Add one type identifier to the exclude filter.

Type is hashed internally exactly as provided. Empty strings are ignored.

Parameters
sTypeThe type string to exclude.

◆ initialize()

void CRM64Pro::SceneObject::initialize ( )
virtual

Called after Scene configuration populates all fields.

Override to parse properties, create sprites, or initialize game state. The base implementation initializes engine-managed behavior for built-in object types, including the runtime emitter owned by a C64Particle object. The Scene calls this exactly once for TMX-loaded and runtime-added objects. Overrides must call SceneObject::initialize() so an optional eager call before SceneLayerObject::addObject() is recognized by the one-time lifecycle.

◆ update() [1/2]

void CRM64Pro::SceneObject::update ( Scene * pScene,
SceneLayerContext & rContext )
virtual

Called each frame when layer has UPDATE enabled.

Override to implement game logic, movement, AI, etc. The base implementation updates engine-managed behavior for built-in object types, including C64Particle emitters. Overrides must call SceneObject::update() to preserve that behavior.

Parameters
pScenePointer to the Scene instance.
rContextLayer context structure containing update state.

◆ render() [1/2]

void CRM64Pro::SceneObject::render ( Scene * pScene,
SceneLayerContext & rContext )
virtual

Called each frame when layer has RENDER enabled and object is visible.

Override to implement custom rendering. Base implementation renders the tile if gid is non-zero; otherwise does nothing.

Parameters
pScenePointer to the Scene instance.
rContextLayer context structure containing render state.
Note
During object-layer rendering, context.data.Object contains per-object render state (interpolated world transform and screen anchor), filled by SceneLayerObject::render().

◆ setPosition()

void CRM64Pro::SceneObject::setPosition ( float fNewX,
float fNewY,
bool bTeleport = false )

Set object position and update spatial grid.

Always use this method to move objects - direct modification of coordinates will desynchronize the object from the spatial grid.

Parameters
fNewXNew X position in world pixels.
fNewYNew Y position in world pixels.
bTeleportIf true, snap presentation history to the new position instead of interpolating from the previous logic state.
Note
Non-finite coordinates are ignored.

◆ setSize() [1/2]

bool CRM64Pro::SceneObject::setSize ( float fNewWidth,
float fNewHeight )

Set object size and update cached bounds.

Parameters
fNewWidthNew width in pixels.
fNewHeightNew height in pixels.
Returns
true on success, or false if the size is non-finite or negative.

◆ setRotationDeg()

bool CRM64Pro::SceneObject::setRotationDeg ( float fNewRotationDeg)

Set object rotation and update cached bounds.

This method may be used before or after adding the object to a layer. Owned objects must only be changed from the Scene main thread.

Parameters
fNewRotationDegNew clockwise rotation angle in degrees.
Returns
true on success, or false if the angle is not finite.

◆ setShape()

bool CRM64Pro::SceneObject::setShape ( const SceneShapeData & rNewShape)

Set object shape and update the spatial grid and particle-collision geometry.

The input AABB is ignored because it is derived from the object transform and geometry. Polygon and polyline points are copied; points are ignored for other shape types. This method may be used before or after adding the object to a layer. Owned objects must only be changed from the Scene main thread.

Parameters
rNewShapeNew shape type and local points.
Returns
true on success, or false if the shape type or points are invalid.

◆ setType()

bool CRM64Pro::SceneObject::setType ( const string & sNewType)

Set the object type identifier.

The exact-case trigger-filter hash is updated with the type. Call before passing the object to SceneLayerObject::addObject().

Parameters
sNewTypeNew type identifier. An empty string clears the type.
Returns
true on success, or false if the object is initialized or already belongs to a layer.

◆ setName()

bool CRM64Pro::SceneObject::setName ( const string & sNewName)

Set the object name.

Call before passing the object to SceneLayerObject::addObject().

Parameters
sNewNameNew object name. An empty string clears the name.
Returns
true on success, or false if the object already belongs to a layer.

◆ setProperty()

bool CRM64Pro::SceneObject::setProperty ( const string & sKey,
const string & sValue )

Set a custom property.

Properties are stored as raw strings, matching TMX property storage. Before adding the object to a layer, any non-empty key is accepted. Owned objects accept the documented common C64 properties and the properties for their C64Particle, C64Light, C64Portal, or C64Occluder type from the Scene main thread. Changes affect the live object; particle autoplay is stored for the next particle initialization.

Parameters
sKeyProperty key; it must not be empty.
sValueRaw property value.
Returns
true on success, or false if the key or value is invalid or the property cannot be changed at runtime.

◆ removeProperty()

bool CRM64Pro::SceneObject::removeProperty ( const string & sKey)

Remove a custom property.

Call before passing the object to SceneLayerObject::addObject().

Parameters
sKeyProperty key to remove.
Returns
true if the property was removed, or false if it was not found, the object is initialized, or it already belongs to a layer.

◆ setVisible()

void CRM64Pro::SceneObject::setVisible ( bool bNewVisible)

Set object visibility.

Parameters
bNewVisibletrue to render, false to hide.

◆ setPortalClosed()

bool CRM64Pro::SceneObject::setPortalClosed ( bool bClosed)

Set whether a portal is closed.

Closed portals activate their configured light-occlusion and particle-blocking roles; open portals do not. The configured movement cost is reserved for future pathfinding and is intended to apply only while the portal is closed. This method may be called before or after adding the object to a layer. Owned objects must only be changed from the Scene main thread.

Parameters
bClosedtrue to close the portal, or false to open it.
Returns
true on success, or false if this object is not a C64Portal.

◆ getX()

float CRM64Pro::SceneObject::getX ( ) const

Get the object X position.

Returns
X position in world pixels.

◆ getY()

float CRM64Pro::SceneObject::getY ( ) const

Get the object Y position.

Returns
Y position in world pixels.

◆ getWidth()

float CRM64Pro::SceneObject::getWidth ( ) const

Get the object width.

Returns
Width in pixels.

◆ getHeight()

float CRM64Pro::SceneObject::getHeight ( ) const

Get the object height.

Returns
Height in pixels.

◆ getRotationDeg()

float CRM64Pro::SceneObject::getRotationDeg ( ) const

Get the object rotation.

Returns
Rotation angle in degrees.

◆ isVisible()

bool CRM64Pro::SceneObject::isVisible ( ) const

Check if the object is visible.

Returns
true if the object is visible, or false otherwise.

◆ isPortalClosed()

bool CRM64Pro::SceneObject::isPortalClosed ( ) const

Check whether this portal is closed.

Returns
true if this object is a closed C64Portal, or false for an open portal or any other object type.

◆ getID()

Sint32 CRM64Pro::SceneObject::getID ( ) const

Get the object ID.

Returns
Object ID.

◆ getType() [1/2]

const string & CRM64Pro::SceneObject::getType ( ) const

Get the type identifier.

Returns
Type string.

◆ getName()

const string & CRM64Pro::SceneObject::getName ( ) const

Get the object name.

Returns
Object name string.

◆ getParticleEmitter()

ParticleEmitter * CRM64Pro::SceneObject::getParticleEmitter ( )

Get this scene object's particle emitter.

Returns
Borrowed pointer to the root ParticleEmitter owned by this object, or nullptr when this is not an initialized C64Particle object.
Note
The returned emitter is destroyed with the object and must not be deleted or closed by the caller.

◆ getShape()

const SceneShapeData & CRM64Pro::SceneObject::getShape ( ) const

Get the object shape data.

Returns
Reference to the object shape data.

◆ isPendingDestruction()

bool CRM64Pro::SceneObject::isPendingDestruction ( ) const

Check if the object is pending destruction.

Returns
true if the object is pending destruction, or false otherwise.

◆ addTrigger()

bool CRM64Pro::SceneObject::addTrigger ( const SceneObjectTrigger & rTrigger)

Add a trigger zone to this object.

Parameters
rTriggerTrigger definition.
Returns
true on success, false on invalid input or duplicated name.

◆ updateTrigger()

bool CRM64Pro::SceneObject::updateTrigger ( const SceneObjectTrigger & rTrigger)

Update an existing trigger by name.

Parameters
rTriggerTrigger definition. sName selects the trigger to update.
Returns
true on success, false if not found or invalid input.

◆ removeTrigger()

bool CRM64Pro::SceneObject::removeTrigger ( const string & sName)

Remove a trigger by name.

Parameters
sNameTrigger name.
Returns
true on success, false if not found.

◆ setTriggerEnabled()

bool CRM64Pro::SceneObject::setTriggerEnabled ( const string & sName,
bool bEnabled )

Enable or disable a trigger.

Parameters
sNameTrigger name.
bEnabledNew enabled state.
Returns
true on success, false if trigger is not found.

◆ getTrigger()

bool CRM64Pro::SceneObject::getTrigger ( const string & sName,
SceneObjectTrigger * pOut ) const

Get a trigger definition by name.

Parameters
sNameTrigger name.
pOutDestination structure.
Returns
true on success, false if trigger is not found or pOut is null.

◆ getTriggerCount()

Sint32 CRM64Pro::SceneObject::getTriggerCount ( ) const

Get number of triggers assigned to this object.

Returns
The count of triggers.

◆ setOnTriggerEvent() [1/2]

void CRM64Pro::SceneObject::setOnTriggerEvent ( TriggerEventCallback fnCallback)

Set trigger event callback.

Object-level callback for this specific SceneObject instance. Called before layer/global trigger callbacks (dispatch order: object -> layer -> global).

Parameters
fnCallbackCallback function, or an empty callback to clear.

◆ hasProperty()

bool CRM64Pro::SceneObject::hasProperty ( const string & sKey) const

Check if a custom property exists.

Parameters
sKeyProperty key.
Returns
true if the property exists, or false otherwise.

◆ getPropertyString()

string CRM64Pro::SceneObject::getPropertyString ( const string & sKey,
const string & sDefault = "" ) const

Get a string custom property.

Parameters
sKeyProperty key.
sDefaultValue returned when the property does not exist.
Returns
Property value, or sDefault if the property does not exist.

◆ getPropertyInt()

Sint32 CRM64Pro::SceneObject::getPropertyInt ( const string & sKey,
Sint32 iDefault = 0 ) const

Get an integer custom property.

Parameters
sKeyProperty key.
iDefaultValue returned when the property does not exist.
Returns
Property value converted to Sint32, or iDefault if the property does not exist.

◆ getPropertyBool()

bool CRM64Pro::SceneObject::getPropertyBool ( const string & sKey,
bool bDefault = false ) const

Get a boolean custom property.

Parameters
sKeyProperty key.
bDefaultValue returned when the property does not exist.
Returns
true for values "1", "true", or "yes"; false otherwise; or bDefault if the property does not exist.

◆ getPropertyFloat()

float CRM64Pro::SceneObject::getPropertyFloat ( const string & sKey,
float fDefault = 0.0f ) const

Get a floating-point custom property.

Parameters
sKeyProperty key.
fDefaultValue returned when the property does not exist or is not a valid float.
Returns
Property value converted to float, or fDefault if the property does not exist or is not a valid float.

◆ recalculateBounds()

void CRM64Pro::SceneObject::recalculateBounds ( )

Recalculate the cached AABB from the current object geometry.

setPosition(), setSize(), setRotationDeg(), and setShape() call this automatically.

◆ containsPoint()

bool CRM64Pro::SceneObject::containsPoint ( float fX,
float fY ) const

Test if a point is inside this object's shape.

Uses precise shape geometry (not just AABB).

Parameters
fXPoint X coordinate in world space.
fYPoint Y coordinate in world space.
Returns
true if point is inside the shape.

◆ overlapsObject()

bool CRM64Pro::SceneObject::overlapsObject ( const SceneObject * pOther,
SDL_FRect * pOverlap = nullptr ) const

Test if this object's AABB overlaps another object's AABB.

Fast broad-phase overlap test using cached AABBs.

Parameters
pOtherPointer to other object.
pOverlapOptional pointer to a SDL_FRect filled with the intersection area if overlap occurs.
Returns
true if AABBs overlap.

◆ getType() [2/2]

eSceneLayerType CRM64Pro::SceneLayerObject::getType ( ) const
overridevirtual

Get the layer type.

Returns
SLT_OBJECT.

Implements CRM64Pro::SceneLayer.

◆ update() [2/2]

Sint32 CRM64Pro::SceneLayerObject::update ( Scene * pEngine,
SceneLayerContext & rContext )
overrideprotectedvirtual

Update object layer logic.

Parameters
pEnginePointer to the Scene instance.
rContextLayer context structure containing update state.
Returns
0 on success, or a negative error code on failure.

Implements CRM64Pro::SceneLayer.

◆ render() [2/2]

Sint32 CRM64Pro::SceneLayerObject::render ( Scene * pEngine,
SceneLayerContext & rContext )
overrideprotectedvirtual

Render object layer content.

Parameters
pEnginePointer to the Scene instance.
rContextLayer context structure containing render state.
Returns
0 on success, or a negative error code on failure.

Implements CRM64Pro::SceneLayer.

◆ addObject()

Sint32 CRM64Pro::SceneLayerObject::addObject ( SceneObject * pObj)

Add an object to this layer.

The object is queued for addition at the next synchronization point (usually end of update loop) to ensure thread-safety and prevent iterator invalidation. The layer takes ownership of the object and will release its memory upon destruction or closeObject(). This method may be called from a worker thread. After a successful call, the caller must not access pObj again. Runtime objects receive their one-time initialize() callback on the Scene main thread during the next update or render synchronization point. Runtime-created objects are assigned a unique ID starting from 16384 to avoid collisions with Tiled IDs.

Parameters
pObjObject to add (must not be nullptr).
Returns
Greater than 0 on success (the Object id), or a negative error code on failure.

◆ closeObject()

bool CRM64Pro::SceneLayerObject::closeObject ( Sint32 id)

Destroy an object by its ID.

The object is marked for removal and its memory will be safely released at the end of the frame. This method is thread-safe and safe to call during logic updates or from worker threads.

Parameters
idObject ID to destroy.
Returns
true on success or false if the ID was not found.

◆ setSpatialGridCellSize()

bool CRM64Pro::SceneLayerObject::setSpatialGridCellSize ( Sint32 iSize)

Set the spatial grid cell size.

Warning: This will clear the grid structure! Only use during initialization/loading.

Parameters
iSizeNew cell size in pixels.
Returns
true on success, or false if the operation cannot be applied.

◆ setSize() [2/2]

bool CRM64Pro::SceneLayerObject::setSize ( float fWidth,
float fHeight )

Set the logical size of the layer (in pixels).

Parameters
fWidthTotal width in pixels.
fHeightTotal height in pixels.
Returns
true on success, or false if either value is non-finite or negative.
Note
Manual object-layer scrolling is unrestricted regardless of this size. Position helpers still resolve against a zero extent. Set a positive size when helpers or camera clamping need finite world bounds.

◆ setRenderOrderMode()

void CRM64Pro::SceneLayerObject::setRenderOrderMode ( eSceneObjectRenderOrder eMode)

Set object rendering order policy.

Parameters
eModeDraw order mode. See ::eSceneObjectRenderOrder.

◆ getRenderOrderMode()

eSceneObjectRenderOrder CRM64Pro::SceneLayerObject::getRenderOrderMode ( ) const

Get object rendering order policy.

Returns
Current draw order mode.

◆ queryRegion()

void CRM64Pro::SceneLayerObject::queryRegion ( float fX,
float fY,
float fW,
float fH,
vector< SceneObject * > & vResults )

Query objects whose AABB overlaps a region.

Efficient spatial query using internal grid.

Parameters
fXRegion X position in world pixels.
fYRegion Y position in world pixels.
fWRegion width in pixels.
fHRegion height in pixels.
vResultsOutput vector filled with unique objects overlapping region.

◆ getObjectByID()

SceneObject * CRM64Pro::SceneLayerObject::getObjectByID ( Sint32 idObject)

Get object by Tiled ID.

Parameters
idObjectObject ID to find.
Returns
Borrowed pointer to the object, or nullptr if not found.
Note
The returned pointer must not be deleted. It remains valid until the object is closed or the layer is destroyed.

◆ getObjectCount()

Sint32 CRM64Pro::SceneLayerObject::getObjectCount ( )

Get number of objects in this layer.

Returns
The number of objects.

◆ getObjects()

void CRM64Pro::SceneLayerObject::getObjects ( vector< SceneObject * > & vResults)

Get all objects in this layer.

Pending-destruction objects are ignored.

Parameters
vResultsOutput vector receiving borrowed object pointers (cleared by this method).
Note
The returned pointers must not be deleted. They remain valid until each object is closed or the layer is destroyed.

◆ findFirstByType()

SceneObject * CRM64Pro::SceneLayerObject::findFirstByType ( const string & sType)

Find first object matching an exact type string.

Exact case-sensitive match against the stored type string. Pending-destruction objects are ignored.

Parameters
sTypeExact type string to match.
Returns
Borrowed pointer to the first matching object, or nullptr if not found.
Note
The returned pointer must not be deleted. It remains valid until the object is closed or the layer is destroyed.

◆ findFirstByName()

SceneObject * CRM64Pro::SceneLayerObject::findFirstByName ( const string & sName)

Find first object matching an exact name string.

Exact case-sensitive match against the stored object name. Pending-destruction objects are ignored.

Parameters
sNameExact object name to match.
Returns
Borrowed pointer to the first matching object, or nullptr if not found.
Note
The returned pointer must not be deleted. It remains valid until the object is closed or the layer is destroyed.

◆ findAllByType()

void CRM64Pro::SceneLayerObject::findAllByType ( const string & sType,
vector< SceneObject * > & vResults )

Find all objects matching an exact type string.

Exact case-sensitive match against the stored type string. Pending-destruction objects are ignored.

Parameters
sTypeExact type string to match.
vResultsOutput vector receiving matches (cleared by this method).

◆ findAllByName()

void CRM64Pro::SceneLayerObject::findAllByName ( const string & sName,
vector< SceneObject * > & vResults )

Find all objects matching an exact name string.

Exact case-sensitive match against the stored object name. Pending-destruction objects are ignored.

Parameters
sNameExact object name to match.
vResultsOutput vector receiving matches (cleared by this method).

◆ setOnTriggerEvent() [2/2]

void CRM64Pro::SceneLayerObject::setOnTriggerEvent ( SceneObject::TriggerEventCallback fnCallback)

Set a layer-wide trigger event callback.

Layer-level callback for all trigger events generated in this SceneLayerObject. Called after object callback and before Scene global callback (dispatch order: object -> layer -> global).

Parameters
fnCallbackCallback function, or an empty callback to clear.

◆ getTotalWidth()

float CRM64Pro::SceneLayerObject::getTotalWidth ( ) const
overridevirtual

Get layer total width in pixels.

Returns
Configured object-layer world width in pixels.

Reimplemented from CRM64Pro::SceneLayer.

◆ getTotalHeight()

float CRM64Pro::SceneLayerObject::getTotalHeight ( ) const
overridevirtual

Get layer total height in pixels.

Returns
Configured object-layer world height in pixels.

Reimplemented from CRM64Pro::SceneLayer.

◆ setObjectFactory()

void CRM64Pro::Scene::setObjectFactory ( ISceneObjectFactory * pFactory)

Set the object factory for creating game objects from Tiled types.

The factory is called during TMX import when objects with a "type" attribute are encountered. If no factory is set, or if the factory returns nullptr, a generic SceneObject is created.

Parameters
pFactoryBorrowed user-provided factory implementing ISceneObjectFactory, or nullptr to clear it. CRM64Pro does not take ownership. The pointer must remain valid until this Scene is closed or the factory is replaced or cleared.
Note
Factory can be set before or after loading TMX files. Setting nullptr disables custom object creation.
Replacing, clearing or closing the Scene releases the borrowed reference without deleting the factory.

◆ getObjectFactory()

ISceneObjectFactory * CRM64Pro::Scene::getObjectFactory ( ) const

Get the current object factory.

Returns
Borrowed pointer to the current factory, or nullptr if none is set.
Note
The returned pointer remains user-owned. It must not be deleted while assigned to this Scene; replace or clear it first.

◆ isObjectLayer()

bool CRM64Pro::Scene::isObjectLayer ( Sint32 iLayer) const

Check if a layer is an object layer.

Parameters
iLayerLayer index (1-based).
Returns
true if the layer exists and is an object layer.