Xors3d Engine
Mouse

Functions

void xFlushMouse ()
 Flushes out all the queued up mouse button presses.
int xGetMouse ()
 This command will check to see if any mouse button has been pressed and will return its number. Since you are polling all the mouse buttons instead of just a specific one, this may be a tad less efficient than using xMouseDown or xMouseHit.
int xMouseDown (int key)
 Detects if a mouse button is being held down.
int xMouseHit (int key)
 Returns the number of times a specified mouse button has been hit since the last time you called the xMouseHit() command.
int xMouseSpeed ()
 Returns the current mouse speed which is set by an end-user using the mouse control panel application.
int xMouseUp (int key)
 Checks if specified mouse button was released.
int xMouseX ()
 Returns the X location of the mouse on the screen.
int xMouseXSpeed ()
 Returns mouse movement on x-axis since last call.
int xMouseY ()
 Returns the Y location of the mouse on the screen.
int xMouseYSpeed ()
 Returns mouse movement on y-axis since last call.
int xMouseZ ()
 Returns the current position of the mouse wheel on a suitable mouse. It starts off at zero when your program begins. The value of xMouseZ() increases as you move the wheel away from you and decreases as you move it towards you.
int xMouseZSpeed ()
 Returns mouse movement on z-axis since last call.
void xMoveMouse (int x, int y)
 Moves the mouse to a designated location.

Function Documentation

void xFlushMouse ( )

Flushes out all the queued up mouse button presses.

There are many times when you aren't interested in the dozens of possible mouse button pressed the player might have made before you are checking for one in particular. Or perhaps you want to pause the game and wait for any mouse button to be hit, but you don't want a 'queued' button press bypassing this. Use this command before you specifically want to poll a mouse button hit from the user

int xMouseHit ( int  key)

Returns the number of times a specified mouse button has been hit since the last time you called the xMouseHit() command.

Parameters:
keyMouse button to be checked
int xMouseDown ( int  key)

Detects if a mouse button is being held down.

You must check for each mouse button independantly with its corresponding number. Also see xMouseHit().

Parameters:
keyMouse button to be checked
int xMouseUp ( int  key)

Checks if specified mouse button was released.

This command returns 1 after each release of the mouse button which was pressed before.

Parameters:
keyMouse button to be checked
int xGetMouse ( )

This command will check to see if any mouse button has been pressed and will return its number. Since you are polling all the mouse buttons instead of just a specific one, this may be a tad less efficient than using xMouseDown or xMouseHit.

int xMouseX ( )

Returns the X location of the mouse on the screen.

This position is always from the range [0; xGraphicsWidth() - 1]. You can use this command in combination with xDrawImage() to make a custom mouse pointer, or to control something on the screen directly with the mouse.

int xMouseY ( )

Returns the Y location of the mouse on the screen.

This position is always from the range [0; xGraphicsHeight() - 1]. You can use this command in combination with xDrawImage() to make a custom mouse pointer, or to control something on the screen directly with the mouse.

int xMouseZ ( )

Returns the current position of the mouse wheel on a suitable mouse. It starts off at zero when your program begins. The value of xMouseZ() increases as you move the wheel away from you and decreases as you move it towards you.

int xMouseXSpeed ( )

Returns mouse movement on x-axis since last call.

The data is returned directly from the mouse device and doesn't concern pixels.
To know the current mouse speed coefficient use xMouseSpeed().

int xMouseYSpeed ( )

Returns mouse movement on y-axis since last call.

The data is returned directly from the mouse device and doesn't concern pixels.
To know the current mouse speed coefficient use xMouseSpeed().

int xMouseZSpeed ( )

Returns mouse movement on z-axis since last call.

int xMouseSpeed ( )

Returns the current mouse speed which is set by an end-user using the mouse control panel application.

The returned value ranges between 1 (slowest) and 20 (fastest).
You can correct the values returned by xMouseXSpeed() and xMouseYSpeed() multiplying them by xMouseSpeed()/20.0 .

void xMoveMouse ( int  x,
int  y 
)

Moves the mouse to a designated location.

Although the mouse isn't visible on the screen, the mouse location is still being tracked and you can attach a graphic to it. However, there are times when you want to put the pointer to a specific location on the screen.

Parameters:
xThe x coordinate on the screen to move the mouse
yThe y coordinate on the screen to move the mouse