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

Loading...
Searching...
No Matches
Scene Manager
Scene modules

## 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.
Sint32 | 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)
| Get a pointer to the Scene using its handle.

## Function Documentation

## ◆ info()

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

Request Scene Manager information.

Writes information to the default log.

Parameters

  iMode | -1 to display only manager information. 0 (default) to display manager and all scenes. A specific Scene ID displays manager information and only that 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. 'demoLevel'), also used for Scene object name. Must be unique and shorter than 64 characters.
  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()

Sint32 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
  0 on success, or a negative error code on failure.

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. 'demoTE'). Must be unique and shorter than 64 characters.

Returns
  0 on success, or a negative error code on failure.

## ◆ get()

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

Get a pointer to the Scene using its handle.

Parameters

  idScene | Scene id. Passing 0 returns the first loaded Scene.

Returns
  Borrowed pointer to the Scene object, or nullptr if not found.

Note
  The returned pointer must not be deleted. It remains valid until the Scene is closed or SceneMgr is reset or terminated.