This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

MasterGame Class

Warning
Game Framework is deprecated and no longer supported. We can't guarantee the stable work of the framework.

The MasterGame class controls the frameworks and the game itself. Levels are loaded and reloaded by using this class.

The implementation of the MasterGame class can be found in the data/framework/game/master_game.h file.

MasterGame Class

Members


int getActiveLevelIndex()

Returns a level index of the loaded game .

Return value

Level index.

string getActiveLevelName()

Returns a level name of the loaded game.

Return value

Level name.

void setGameParameter(string name, variable value)

Sets a game custom parameter.

Arguments

  • string name - Unique parameter name.
  • variable value - Parameter value. The value can be the following types: int, float, double, vec3, vec4, string.

variable getGameParameter(string name)

Returns a custom parameter value.

Arguments

  • string name - Parameter name.

Return value

Custom parameter value if it is found; otherwise 0.

variable getGameParameter(string name, int default_value)

Returns a parameter value.

Arguments

  • string name - Parameter name.
  • int default_value - Default value.

Return value

Custom parameter value if it is found; otherwise a default value.

int isGameParameter(string name)

Returns a value indicating if the game parameter exists.

Arguments

  • string name - Parameter name.

Return value

1 if the parameter exists; otherwise 0.

int getNumLevels()

Returns a number of game levels.

Return value

Number of game levels.

void loadLevel(variable index)

Loads a level.

Arguments

  • variable index - Level number if index is an integer; level name if index is a string.

MasterGame(string game_path)

Constructor. Creates a new MasterGame class instance.

Arguments

  • string game_path - Path to the *.game file.

void shutdown()

Stops the work of the MasterGame class.

void update()

Toggles between game levels. You can switch the level by pressing CTRL + number, wherenumber takes on the values from 0 to 9.
Notice
This function is useful during the game development only.
Last update: 2017-07-03
Build: ()