GetMouseX
From Spheriki
Gets the x coordinate of the mouse relative to the top-left corner of the Sphere video display.
Contents |
[edit]
Usage
number GetMouseX();
[edit]
Examples
var mx = GetMouseX();
Gets the mouse's x coordinate, and places it in the variable mx.
var scr_h = GetScreenHeight();
var white = CreateColor(255, 255, 255);
var f = GetSystemFont();
while (AreKeysLeft()) GetKey();
while (!AreKeysLeft())
{
f.drawText(0, 0, "Press any key to end.");
var mx = GetMouseX();
Line(mx, 0, mx, scr_h, white);
FlipScreen();
}
Draws a solid vertical white line displaying the current x position of the mouse cursor.
[edit]
Notes
- There is a corresponding function GetMouseY(), which gets the y coordinate.
- To set or change the position of the mouse, use SetMousePosition().
[edit]
See also
- AreKeysLeft()
- CreateColor()
- FlipScreen()
- Font.drawText()
- GetKey()
- GetScreenHeight()
- GetSystemFont()
- Line()

