IsMouseButtonPressed
From Spheriki
Checks the state of a given mouse button. Returns true if the mouse button is down, false if it is up.
Contents |
Usage
- button Mouse button constant. Can be one of
MOUSE_LEFT,MOUSE_MIDDLE, orMOUSE_RIGHT.
Examples
var f = GetSystemFont();
while (!AreKeysLeft())
{
if (IsMouseButtonPressed(MOUSE_LEFT)) f.drawText( 60, 110, "Left!");
if (IsMouseButtonPressed(MOUSE_MIDDLE)) f.drawText(120, 110, "Middle!");
if (IsMouseButtonPressed(MOUSE_RIGHT)) f.drawText(180, 110, "Right!");
FlipScreen();
}
Displays the state of the mouse buttons until a key is pressed.
Notes
- Currently, it is only possible to check whether a mouse button is down or not in Sphere. To detect mouse clicks and double clicks, the state of the mouse buttons needs to be tracked over time.