CRM64Pro GDK v0.80.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
CRM64Pro::ISceneObjectFactoryabstract

Factory interface for creating game objects from Tiled type strings. More...

Public Member Functions

virtual SceneObject * create (const string &sType)=0
 Create an object instance based on Tiled type string.

Detailed Description

Factory interface for creating game objects from Tiled type strings.

Users implement this interface to create game-specific SceneObject subclasses based on the "type" attribute from Tiled objects.

Member Function Documentation

◆ create()

virtual SceneObject * CRM64Pro::ISceneObjectFactory::create ( const string & sType)
pure virtual

Create an object instance based on Tiled type string.

Parameters
sTypeThe "type" attribute from the Tiled object element, preserved exactly as provided by Scene.
Returns
Owned pointer to a newly created SceneObject-derived instance, or nullptr to use generic SceneObject.
Note
Ownership is transferred to CRM64Pro when the pointer is returned. Do not delete it after returning it.
SceneObject-derived instances must be allocated with new(std::nothrow). Plain new is disabled for CMemAllocator-derived classes.