This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
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.

Game Class

The Game class manages a game. This class loads the level logic and the logic of all of the user entities.

The Game class implementation can be found in the data/framework/game/game.h file.

Game Class

Members


int getActiveLevelIndex()

Returns an index of the active level.

Return value

Active level index.

void setFields(Entity entity)

Invokes all of the setter fields methods of the entity with the corresponding entity values.

Arguments

  • Entity entity - Entity.

GameData getGameData()

Returns game data.

Return value

Game data.

float getGameIFps()

Returns the engine ifps. It is the fastest way to get the ifps.

Return value

Engine ifps.

void setGameParameter(string name, variable value)

Sets the 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 the 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.

string getLogicNamespaceName()

Returns the name of the namespace, which contains the custom logic.

Return value

Namespace name.

float getPhysicsIFps()

Returns the physics ifps. It is the fastest way to get the physics ifps.

Return value

Physics ifps.

Entity createEntity(string type)

Creates an Entity class instance.

Arguments

  • string type - Entity type.

Return value

Entity class instance.

void flush()

Updates game physics.

Game()

Constructor. Creates a new Game class instance.

void init(GameData data, int level_index)

Creates a game and initializes the necessary resources on the game launch.

Arguments

  • GameData data - Game data.
  • int level_index - Loaded level index.

void loadLevel(variable index)

Loads a level.

Arguments

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

void render()

Updates a game after the update() function is invoked.

void shutdown()

Releases game resources.

void update()

Updates a game.
Last update: 2017-07-03
Build: ()