Usage

The game instance class is created on the installation of the project. It functions as a persistent class to manage global application states. For example, you might use the game instance to store player names, playtime, load and unload player save files and more.

The game instance is the first class to be created after the engine is started up. Unlike other gameplay classes, it has no tick event, since other classes should read and write to the data contained in the game instance.

Events

As said previously, the game instance contains 2 out of the 3 universal events

  1. beginPlay - the "begin game" event
  2. endPlay - the "end game" event
  3. init - the "init" event is called as the first part of the events pipeline
  4. destroy - the "destroy" event is the last event to be called as part of the events pipeline

But it also contains a third event used for editor modules called onEventInitEditorModules. Here, you can call any function to activate an editor module. More documentation on editor modules can be found here.

Functions and variables

Exit

The exit function closes the application

currentLevel

The static currentLevel function returns a pointer to the currently open level

initInfo

The initInfo member variable contains a bunch of data that serves as a type of config that the engine uses on startup. You can learn more in this wiki entry.

Casting

You can use the standard casting function to cast a generic pointer to a pointer of its base type