|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
MouseController
defines an interface for accessing current
mouse interaction.
A MouseController
implementation should keep track of the
absolute mouse coordinate, i.e. the coordinate of the cursor anywhere on
the screen, the regular mouse coordinate, i.e. the coordinate within the
application window (if the cursor moves out of the window, the regular
coordinate maintains the point where it exited). Third is the
relative mouse coordinate with keeps track of the mouse change from one
frame to the next.
Using setMousePosition
sets the position of the regular
mouse coordinate.
Method Summary | |
int |
getAbsoluteMousePositionX()
getAbsoluteMousePositionX retrieves the actual x position
of the mouse cursor. |
int |
getAbsoluteMousePositionY()
getAbsoluteMousePositionY retrieves the actual y position
of the mouse cursor. |
int |
getMouseDeltaX()
getMouseDeltaX returns the change in the X coordinate of
the mouse since the previous frame. |
int |
getMouseDeltaY()
getMouseDeltaY returns the change in the Y coordinate of
the mouse since the previous frame. |
int |
getMousePositionX()
getMousePositionX returns the x coordinate of the mouse
within the application window. |
int |
getMousePositionY()
getMousePositionY returns the y coordinate of the mouse
within the application window. |
int |
getNumberOfButtons()
getNumberOfButtons returns the number of buttons
assigned to the mouse. |
boolean |
isButtonDown(int mouseButton)
isButtonDown returns true if a specified button is currently
pressed on the mouse, false if it is not. |
void |
pollMouse()
pollMouse obtains the latest deltas for the mouse from
the Mouse context. |
void |
setMousePosition(int x,
int y)
setMousePosition sets the x and y coordinate of the mouse
within the cooridnates of the application window. |
Method Detail |
public int getMousePositionX()
getMousePositionX
returns the x coordinate of the mouse
within the application window. If the mouse moves out of the window,
the position will set the correct coordinate to the window's extreme.
public int getMousePositionY()
getMousePositionY
returns the y coordinate of the mouse
within the application window. If the mouse moves out of the window,
the position will set the correct coordinate to the window's extreme.
public int getAbsoluteMousePositionX()
getAbsoluteMousePositionX
retrieves the actual x position
of the mouse cursor.
public int getAbsoluteMousePositionY()
getAbsoluteMousePositionY
retrieves the actual y position
of the mouse cursor.
public int getMouseDeltaX()
getMouseDeltaX
returns the change in the X coordinate of
the mouse since the previous frame.
public int getMouseDeltaY()
getMouseDeltaY
returns the change in the Y coordinate of
the mouse since the previous frame.
public void setMousePosition(int x, int y)
setMousePosition
sets the x and y coordinate of the mouse
within the cooridnates of the application window.
x
- the new x coordinate.y
- the new y coordinate.public void pollMouse()
pollMouse
obtains the latest deltas for the mouse from
the Mouse
context.
public boolean isButtonDown(int mouseButton)
isButtonDown
returns true if a specified button is currently
pressed on the mouse, false if it is not.
mouseButton
- the button id to check.
public int getNumberOfButtons()
getNumberOfButtons
returns the number of buttons
assigned to the mouse.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |