MasterGame Class
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
MasterGame (string game_path)
Constructor. Creates a new MasterGame class instance.Arguments
- string game_path - Path to the *.game file.
void update ()
Toggles between game levels. You can switch the level by pressing CTRL + number, where number takes on the values from 0 to 9.This function is useful during the game development only.
void shutdown ()
Stops the work of the MasterGame class.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.
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.Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter