jme.controller
Interface MouseController

All Known Implementing Classes:
AbstractGameController

public interface MouseController

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.

Version:
1
Author:
Mark Powell

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

getMousePositionX

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.

Returns:
the regular x coordinate of the mouse.

getMousePositionY

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.

Returns:
the regular y coordinate of the mouse.

getAbsoluteMousePositionX

public int getAbsoluteMousePositionX()
getAbsoluteMousePositionX retrieves the actual x position of the mouse cursor.

Returns:
the actual x position of the mouse cursor.

getAbsoluteMousePositionY

public int getAbsoluteMousePositionY()
getAbsoluteMousePositionY retrieves the actual y position of the mouse cursor.

Returns:
the actual y position of the mouse cursor.

getMouseDeltaX

public int getMouseDeltaX()
getMouseDeltaX returns the change in the X coordinate of the mouse since the previous frame.

Returns:
the change in X since the previous frame.

getMouseDeltaY

public int getMouseDeltaY()
getMouseDeltaY returns the change in the Y coordinate of the mouse since the previous frame.

Returns:
the change in Y since the previous frame.

setMousePosition

public void setMousePosition(int x,
                             int y)
setMousePosition sets the x and y coordinate of the mouse within the cooridnates of the application window.

Parameters:
x - the new x coordinate.
y - the new y coordinate.

pollMouse

public void pollMouse()
pollMouse obtains the latest deltas for the mouse from the Mouse context.


isButtonDown

public boolean isButtonDown(int mouseButton)
isButtonDown returns true if a specified button is currently pressed on the mouse, false if it is not.

Parameters:
mouseButton - the button id to check.
Returns:
true if the button is pressed, false if it is not.

getNumberOfButtons

public int getNumberOfButtons()
getNumberOfButtons returns the number of buttons assigned to the mouse.

Returns:
the number of buttons the mouse has.