Xors3d Engine
Mouse

Functions

BBDECL void BBCALL xFlushMouse ()
 Flushes out all the queued up mouse button presses.
BBDECL int BBCALL 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.
BBDECL int BBCALL xMouseDown (int key)
 Detects if a mouse button is being held down.
BBDECL int BBCALL xMouseHit (int key)
 Returns the number of times a specified mouse button has been hit since the last time you called the xMouseHit() command.
BBDECL int BBCALL xMouseSpeed ()
 Returns the current mouse speed which is set by an end-user using the mouse control panel application.
BBDECL int BBCALL xMouseUp (int key)
 Checks if specified mouse button was released.
BBDECL int BBCALL xMouseX ()
 Returns the X location of the mouse on the screen.
BBDECL int BBCALL xMouseXSpeed ()
 Returns mouse movement on x-axis since last call.
BBDECL int BBCALL xMouseY ()
 Returns the Y location of the mouse on the screen.
BBDECL int BBCALL xMouseYSpeed ()
 Returns mouse movement on y-axis since last call.
BBDECL int BBCALL 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.
BBDECL int BBCALL xMouseZSpeed ()
 Returns mouse movement on z-axis since last call.
BBDECL void BBCALL xMoveMouse (int x, int y)
 Moves the mouse to a designated location.

Function Documentation

BBDECL void BBCALL 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

BBDECL int BBCALL 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
BBDECL int BBCALL 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
BBDECL int BBCALL 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
BBDECL int BBCALL 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.

BBDECL int BBCALL 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.

BBDECL int BBCALL 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.

BBDECL int BBCALL 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.

BBDECL int BBCALL 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().

BBDECL int BBCALL 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().

BBDECL int BBCALL xMouseZSpeed ( )

Returns mouse movement on z-axis since last call.

BBDECL int BBCALL 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 .

BBDECL void BBCALL 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