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

Loading...
Searching...
No Matches
Scene Manager
Scene module

## Description

Scene Manager for lifecycle and asset management.

The Scene Manager is a singleton automatically created once Main is instantiated. It handles the creation, destruction, and TMX loading of Scene instances.

## Classes
class | CRM64Pro::SceneMgr
| Scene Manager class. More...

## Functions
bool | CRM64Pro::SceneMgr::info (Sint32 iMode=0) override
| Request Scene Manager information.
Sint32 | CRM64Pro::SceneMgr::create (const string &sName, Uint32 iNumLayers=3) override
| Create a new Scene.
bool | CRM64Pro::SceneMgr::close (Sint32 idScene) override
| Close and destroy a Scene.
Sint32 | CRM64Pro::SceneMgr::getCount () const override
| Get number of loaded objects.
Sint32 | CRM64Pro::SceneMgr::setName (Sint32 idScene, const string &sName) override
| Change the object name.
Scene * | CRM64Pro::SceneMgr::get (Sint32 idScene=0)
| Get a pointer to the Scene using its handler.

## Function Documentation

## ◆ info()

bool CRM64Pro::SceneMgr::info | ( | Sint32 | iMode = 0 | ) |
| override

Request Scene Manager information.

Writes information to the default log.

Parameters

  iMode | -1 for Manager info only. 0 (default) for Manager and all Objects. A positive Scene id for Manager and that specific Scene.

Returns
  true on success, or false on failure.

## ◆ create()

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

Create a new Scene.

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

Parameters

  sName | The level name (e.g. 'myLevel'), also used for Scene object name. Must be unique and max 64 characters (truncated if longer).
  iNumLayers | layers to allocate. Default 3. Use createLayer() to dynamically change this.

Returns
  greater than 0 on success (the Scene id) or a negative error code on failure.

## ◆ close()

bool CRM64Pro::SceneMgr::close | ( | Sint32 | idScene | ) |
| override

Close and destroy a Scene.

Parameters

  idScene | 0 for closing all Scene objects or a specific Scene id.

Returns
  true if at least one Scene was closed, or false if none were closed.

Note
  Unclosed Scenes are automatically closed when GDK terminates. Tilesets/tile layer with TERC_USER resource control must be freed manually after calling this method.

## ◆ getCount()

Sint32 CRM64Pro::SceneMgr::getCount | ( |  | ) | const
| override

Get number of loaded objects.

Returns
  the number of Scene objects.

## ◆ setName()

Sint32 CRM64Pro::SceneMgr::setName | ( | Sint32 | idScene,
|  | const string & | sName )
| override

Change the object name.

Parameters

  idScene | Scene id.
  sName | The 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()

Scene * CRM64Pro::SceneMgr::get | ( | Sint32 | idScene = 0 | ) |

Get a pointer to the Scene using its handler.

Parameters

  idScene | Scene id. By default it returns the first Scene.

Returns
  nullptr the Scene was not found.
  A pointer to the Scene object.