This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
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

Members


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.

Arguments

  • 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 setData (const char * data) const =0

Sets user data associated with the world. In the *.world file, the data is set in the data tag.

Arguments

  • const char * data - New user data.

virtual const char * getData () const =0

Returns user string data associated with the world. This string is written directly into the data tag of the *.world file.

Return value

User string data.

virtual void setFrame (int frame) const =0

Sets the game frame number.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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.

Arguments

  • 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: ()