GetMouseX

From Spheriki

Jump to: navigation, search

Gets the x coordinate of the mouse relative to the top-left corner of the Sphere video display.

Contents

Usage

number GetMouseX();

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.

Notes

  • There is a corresponding function GetMouseY(), which gets the y coordinate.

See also

Personal tools