Difference between revisions of "Legacy:GetScreenWidth"

From Spherical
Jump to: navigation, search
(created from http://web.archive.org/web/20120505210624/http://www.spheredev.org/wiki/GetScreenWidth)
 
(filled)
 
Line 1: Line 1:
 
 
 
GetScreenWidth() returns the value in pixels of the current screen/game window width.
 
GetScreenWidth() returns the value in pixels of the current screen/game window width.
  
Line 6: Line 4:
  
 
==Usage==
 
==Usage==
{{Usage|returns=integer|object={{{object}}}|func=GetScreenWidth|params={{{params}}}}}
+
{{Usage|returns=integer|func=GetScreenWidth}}
  
* '''param1''' type. param1 description
+
==Examples==
* '''param2''' type. param2 description
+
<syntaxhighlight>
* '''paramN''' type. paramN description
+
Abort("This game takes up " + GetScreenWidth() + " pixels of your screen.\n")
 +
</syntaxhighlight>
 +
Aborts Sphere with the message of how wide the horizontal resolution of the game is.
  
==Examples==
+
<syntaxhighlight>
(examples with syntaxhighlighted code)
+
var white = CreateColor(255,255,255);
 +
Rectangle(0, 0, GetScreenWidth(), 25, white);
 +
</syntaxhighlight>
 +
This draws a white rectangle over the top part of the screen, in full width and 25 pixels height.
  
 
==Notes==
 
==Notes==
(notes)
+
If you don't configure your game, the screen width is 320 by default.
  
 
==See also==
 
==See also==
* see also
+
* [[API:GetScreenHeight|GetScreenHeight]]()
* see also
+
* [[API:Abort|Abort]]()
* see also
+
* [[API:CreateColor|CreateColor]]()
* etc
+
* [[API:Rectangle|Rectangle]]()
  
 
{{API:Video/navbox}}
 
{{API:Video/navbox}}

Latest revision as of 21:19, 4 June 2013

GetScreenWidth() returns the value in pixels of the current screen/game window width.

Usage

integer GetScreenWidth();


Examples

Abort("This game takes up " + GetScreenWidth() + " pixels of your screen.\n")

Aborts Sphere with the message of how wide the horizontal resolution of the game is.

var white = CreateColor(255,255,255);
Rectangle(0, 0, GetScreenWidth(), 25, white);

This draws a white rectangle over the top part of the screen, in full width and 25 pixels height.

Notes

If you don't configure your game, the screen width is 320 by default.

See also

API:Video/navbox