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

TileEngine Manager class. More...

Detailed Description

TileEngine Manager class.

Public Member Functions

bool info (Sint32 iMode=0) override
 Request TileEngine Manager information.
Sint32 create (const string &sName, Uint32 iNumLayers=3) override
 Create a new TileEngine.
bool close (Sint32 idTE) override
 Close and destroy a TileEngine.
Sint32 getCount () const override
 Get number of loaded objects.
Sint32 setName (Sint32 idTE, const string &sName) override
 Change the object name.
TileEngineget (Sint32 idTE=0)
 Get a pointer to the TileEngine using its handler.
Sint32 loadFromFile (const string &sTMXFile)
 Import a Tiled map (TMX) from a file.
Sint32 load (const string &sCDCFile, const string &sTMXFile)
 Import a Tiled map (TMX) from a CDC file.
Sint32 load (const Sint32 idCDC, const string &sTMXFile)
 Import a Tiled map (TMX) from a CDC file.

Member Function Documentation

◆ info()

bool CRM64Pro::TileEngineMgr::info ( Sint32 iMode = 0)
override

Request TileEngine Manager information.

Writes information to the default log.

Parameters
iMode-1 for Manager info only. 0 (default) for Manager and all Objects. A positive TE id for Manager and that specific TileEngine.
Returns
true on success, or false on failure.

◆ create()

Sint32 CRM64Pro::TileEngineMgr::create ( const string & sName,
Uint32 iNumLayers = 3 )
override

Create a new TileEngine.

Default viewport is 320x200 starting at (0,0).

Parameters
sNameThe level name (e.g. 'myLevel'), also used for TileEngine object name. Must be unique and max 64 characters (truncated if longer).
iNumLayerslayers to allocate. Default 3. Use setLayerCount() to dynamically change this.
Returns
greater than 0 on success (the TileEngine id) or a negative error code on failure.

◆ close()

bool CRM64Pro::TileEngineMgr::close ( Sint32 idTE)
override

Close and destroy a TileEngine.

Parameters
idTE0 for closing all TileEngine objects or a specific TileEngine id.
Returns
true on success or false on failure.
Note
Unclosed TileEngines are automatically closed when GDK terminates. Tilesets/mapdata with TERC_USER resource control must be freed manually after calling this method.

◆ getCount()

Sint32 CRM64Pro::TileEngineMgr::getCount ( ) const
override

Get number of loaded objects.

Returns
the number of TileEngine objects.

◆ setName()

Sint32 CRM64Pro::TileEngineMgr::setName ( Sint32 idTE,
const string & sName )
override

Change the object name.

Parameters
idTETileEngine id.
sNameThe name (e.g. 'myTE'). Must be unique and max 64 characters (truncated if longer).
Returns
0 on success, or a negative error code on failure.

◆ get()

TileEngine * CRM64Pro::TileEngineMgr::get ( Sint32 idTE = 0)

Get a pointer to the TileEngine using its handler.

Parameters
idTETileEngine id. By default it returns the first TileEngine.
Returns
nullptr the TileEngine was not found.
A pointer to the TileEngine object.

◆ loadFromFile()

Sint32 CRM64Pro::TileEngineMgr::loadFromFile ( const string & sTMXFile)

Import a Tiled map (TMX) from a file.

Supports TMX v1.10 files, orthogonal view. Detects and loads embedded C64TE map format.

Parameters
sTMXFilestring containing [directory]+filename+[extension] of TMX file. Directory separators '\' and '/' are supported.
Returns
greater than 0 on success (the TileEngine id) or a negative error code on failure.
Note
Loads tilesets with spacing!=0 and/or margin!=0 by internally converting them to spacing=0 and margin=0.

◆ load() [1/2]

Sint32 CRM64Pro::TileEngineMgr::load ( const string & sCDCFile,
const string & sTMXFile )

Import a Tiled map (TMX) from a CDC file.

Supports TMX v1.10 files, orthogonal view. Detects and loads embedded C64TE map format.

Parameters
sCDCFilestring containing [directory]+filename+[extension] of CDC file for tileset images. Directory separators '\' and '/' are supported.
sTMXFilestring containing name of TMX file inside the CDC.
Returns
greater than 0 on success (the TileEngine id) or a negative error code on failure.
Note
Loads tilesets with spacing!=0 and/or margin!=0 by internally converting them to spacing=0 and margin=0.

◆ load() [2/2]

Sint32 CRM64Pro::TileEngineMgr::load ( const Sint32 idCDC,
const string & sTMXFile )

Import a Tiled map (TMX) from a CDC file.

Supports TMX v1.10 files, orthogonal view. Detects and loads embedded C64TE map format.

Parameters
idCDCCDC id of an open CDC file.
sTMXFilestring containing name of TMX file inside the CDC.
Returns
greater than 0 on success (the TileEngine id) or a negative error code on failure.
Note
Loads tilesets with spacing!=0 and/or margin!=0 by internally converting them to spacing=0 and margin=0.