Difference between revisions of "Legacy:GetScreenWidth"
From Spherical
(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 | + | {{Usage|returns=integer|func=GetScreenWidth}} |
− | + | ==Examples== | |
− | + | <syntaxhighlight> | |
− | + | 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. | ||
− | = | + | <syntaxhighlight> |
− | ( | + | 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== | ||
− | + | If you don't configure your game, the screen width is 320 by default. | |
==See also== | ==See also== | ||
− | * | + | * [[API:GetScreenHeight|GetScreenHeight]]() |
− | * | + | * [[API:Abort|Abort]]() |
− | * | + | * [[API:CreateColor|CreateColor]]() |
− | * | + | * [[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.
Contents
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
- GetScreenHeight()
- Abort()
- CreateColor()
- Rectangle()