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.
No language code for this page. You can select other language.
No language code for this page,
shown in other instead.
shown in other instead.
Unigine game. This interface provides access to Unigine game functions.
To use this class, include the UnigineGame.h file.
virtual ~Game ()Virtual destructor.
static Game * get ()Returns a pointer to the game.
Return valuePointer to the game.
virtual void setEnabled (int enable) const =0Pauses or resumes the current game.
- int enable - 1 to resume the game, 0 to pause it.
virtual int isEnabled () const =0Returns a value indicating if the game is paused or not.
Return valueReturns 1 if the game is not paused; otherwise, 0.
virtual void setFrame (int frame) const =0Sets the game frame number.
- int frame - Frame number.
virtual int getFrame () const =0Returns the current game frame number.
Return valueFrame number.
virtual void setIFps (float ifps) const =0Sets 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 =0Returns the scaled (see the setScale() function) inverse FPS value.
Return valueScaled inverse FPS value (1/FPS) in seconds. If the game is paused, 0 is returned.
virtual void setFTime (float ftime) const =0Sets 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 =0Returns time spent between a previous update and a current one. This function takes time scaling into account.
Return valueFrame time in seconds.
virtual void setScale (float scale) const =0Sets 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 =0Returns a value used to scale a frame duration.
Return valueValue to scale frame duration.
virtual void setTime (float time) const =0Sets 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 =0Returns 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 valueTime value in seconds.
virtual void setPlayer (const PlayerPtr & player) const =0Sets the current game player.
- const PlayerPtr & player - Game player.
virtual PlayerPtr getPlayer () const =0Returns the current game player.
Return valueCurrent game player.
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)