Difference between revisions of "Legacy:GetVersion"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20110802220723/http://www.spheredev.org/wiki/GetVersion)
 
(added navbox)
 
Line 33: Line 33:
  
 
* [[API:GetVersionString|GetVersionString]]()
 
* [[API:GetVersionString|GetVersionString]]()
 +
 +
{{API:Engine/navbox}}

Latest revision as of 22:26, 1 June 2013

This function returns the current version of sphere that the player is using.

Usage

double GetVersion();



Examples

var font = GetSystemFont();
font.drawText(0,0, "You are using Sphere v"+GetVersion());
FlipScreen();


if (GetVersion() < 1.1)
{
  font.drawText(0,0,"Requires Sphere v1.1 or later to play");
  FlipScreen();
  GetKey();
}


Notes

GetVersion returns the version number of Sphere that the player is using. This is especially useful if there are features only available after a certain release, and don't want the player to play through a lot of the game before getting an error saying some function does not exist.

Adding something like in example 2 in the above is a good idea if this applies, since it adds robustness to the game, and if someone doesn't have the required version, they know what they have to do in order to play it instead of getting a confusing "function does not exist" error.

See also

API:Engine/navbox