Legacy:GetVersion

From Spherical
Revision as of 22:16, 1 June 2013 by Apollolux (talk | contribs) (created from http://web.archive.org/web/20110802220723/http://www.spheredev.org/wiki/GetVersion)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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