This page has been translated automatically.
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Unigine Material Library
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.

Unigine::Game Class

Unigine game. This interface provides access to Unigine game functions.

To use this class, include the UnigineGame.h file.

Unigine::Game Class


virtual ~Game ()

Virtual destructor.

static Game * get ()

Returns a pointer to the game.

Return value

Pointer to the game.

virtual void setEnabled (int enable) const =0

Pauses or resumes the current game.


  • int enable - 1 to resume the game, 0 to pause it.

virtual int isEnabled () const =0

Returns a value indicating if the game is paused or not.

Return value

Returns 1 if the game is not paused; otherwise, 0.

virtual void setFrame (int frame) const =0

Sets the game frame number.


  • int frame - Frame number.

virtual int getFrame () const =0

Returns the current game frame number.

Return value

Frame number.

virtual void setIFps (float ifps) const =0

Sets the inverse FPS value. This function sets a fixed FPS that does not depend on the real FPS the hardware is capable of. To remove the FPS limitation, use -1.


  • float ifps - Inverse FPS value (1/FPS) in seconds. To remove the FPS limitation, use -1.

virtual float getIFps () const =0

Returns the scaled (see the setScale() function) inverse FPS value.

Return value

Scaled inverse FPS value (1/FPS) in seconds. If the game is paused, 0 is returned.

virtual void setFTime (float ftime) const =0

Sets the maximum rendering frame duration value. If the real rendering FPS is higher than the fixed frame FPS, the engine will wait until the fixed frame time is over. To remove fixed frame duration, use -1.


  • float ftime - Frame time in seconds. To remove the FPS limitation, use -1.

virtual float getFTime () const =0

Returns time spent between a previous update and a current one. This function takes time scaling into account.

Return value

Frame time in seconds.

virtual void setScale (float scale) const =0

Sets a value that is used to scale frame duration. It scales up or down the speed of rendering, physics and game logic. This function can be used to create effects of slow/accelerated motion.For example, if the scale equals 2, the rate of simulation of all effects (such as particles) speeds up to two times faster. This function scales both setIFps() and setFTime() functions. The default is 1.


  • float scale - Scaling factor. The provided values is clamped within range [0;32].

virtual float getScale () const =0

Returns a value used to scale a frame duration.

Return value

Value to scale frame duration.

virtual void setTime (float time) const =0

Sets a specified time value for the game. The time is counted off starting from the world loading and does not take game pauses into account.


  • float time - Time value in seconds.

virtual float getTime () const =0

Returns the current time spent in the game. It is counted off starting from the world loading and does not take game pauses into account.

Return value

Time value in seconds.

virtual void setPlayer (const PlayerPtr & player) const =0

Sets the current game player.


  • const PlayerPtr & player - Game player.

virtual PlayerPtr getPlayer () const =0

Returns the current game player.

Return value

Current game player.
Last update: 2017-07-03
Build: ()