com.jme.input.lwjgl
Class LWJGLMouseInput

java.lang.Object
  extended bycom.jme.input.lwjgl.LWJGLMouseInput
All Implemented Interfaces:
MouseInput

public class LWJGLMouseInput
extends java.lang.Object
implements MouseInput

LWJGLMouseInput handles mouse input via the LWJGL Input API.

Version:
$Id: LWJGLMouseInput.java,v 1.8 2005/01/03 19:41:58 renanse Exp $
Author:
Mark Powell

Field Summary
 
Fields inherited from interface com.jme.input.MouseInput
BUTTON_1, BUTTON_1_2, BUTTON_1_2_3, BUTTON_1_3, BUTTON_2, BUTTON_2_3, BUTTON_3
 
Constructor Summary
LWJGLMouseInput()
          Constructor creates a new LWJGLMouseInput object.
 
Method Summary
 void destroy()
          destroy cleans up the native mouse reference.
 int getButtonIndex(java.lang.String buttonName)
          getButtonIndex returns the index of a given button name.
 java.lang.String getButtonName(int buttonIndex)
          getButtonName returns the name of a given button index.
 MouseButtonStateType getButtonState()
           
 MouseButtonStateType getButtonType()
           
 MouseButtonStateType getPreviousButtonState()
           
 int getWheelDelta()
          getWheelDelta retrieves the change of the mouse wheel, if any.
 int getXAbsolute()
          getXAbsolute gets the absolute x axis value.
 int getXDelta()
          getXDelta retrieves the change of the x position, if any.
 int getYAbsolute()
          getYAbsolute gets the absolute y axis value.
 int getYDelta()
          getYDelta retrieves the change of the y position, if any.
 boolean isButtonDown(int buttonCode)
          isButtonDown tests if a given button is pressed or not.
 boolean isCreated()
          isCreated returns false if the mouse is created, false otherwise.
 boolean isCursorVisible()
          isCursorVisible Returns true if a cursor is currently bound.
 void poll()
          poll gets the current state of the mouse.
 void setCursorVisible(boolean v)
          setCursorVisible sets the visiblity of the hardware cursor.
 void updateState()
          updateState updates the mouse state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWJGLMouseInput

public LWJGLMouseInput()
Constructor creates a new LWJGLMouseInput object. A call to the LWJGL creation method is made, if any problems occur during this creation, it is logged.

Method Detail

destroy

public void destroy()
destroy cleans up the native mouse reference.

Specified by:
destroy in interface MouseInput
See Also:
MouseInput.destroy()

getButtonIndex

public int getButtonIndex(java.lang.String buttonName)
getButtonIndex returns the index of a given button name.

Specified by:
getButtonIndex in interface MouseInput
Parameters:
buttonName - the name to get the code for.
Returns:
the code for the given button name.
See Also:
MouseInput.getButtonIndex(java.lang.String)

getButtonName

public java.lang.String getButtonName(int buttonIndex)
getButtonName returns the name of a given button index.

Specified by:
getButtonName in interface MouseInput
Parameters:
buttonIndex - the code to get the name for.
Returns:
the name for the given button code.
See Also:
MouseInput.getButtonName(int)

isButtonDown

public boolean isButtonDown(int buttonCode)
isButtonDown tests if a given button is pressed or not.

Specified by:
isButtonDown in interface MouseInput
Parameters:
buttonCode - the button code to check.
Returns:
true if the button is pressed, false otherwise.
See Also:
MouseInput.isButtonDown(int)

isCreated

public boolean isCreated()
isCreated returns false if the mouse is created, false otherwise.

Specified by:
isCreated in interface MouseInput
Returns:
true if the mouse input is created, false otherwise.
See Also:
MouseInput.isCreated()

poll

public void poll()
poll gets the current state of the mouse.

Specified by:
poll in interface MouseInput
See Also:
MouseInput.poll()

getWheelDelta

public int getWheelDelta()
getWheelDelta retrieves the change of the mouse wheel, if any.

Specified by:
getWheelDelta in interface MouseInput
Returns:
the change in the mouse wheel.
See Also:
MouseInput.getWheelDelta()

getXDelta

public int getXDelta()
getXDelta retrieves the change of the x position, if any.

Specified by:
getXDelta in interface MouseInput
Returns:
the change along the x axis.
See Also:
MouseInput.getXDelta()

getYDelta

public int getYDelta()
getYDelta retrieves the change of the y position, if any.

Specified by:
getYDelta in interface MouseInput
Returns:
the change along the y axis.
See Also:
MouseInput.getYDelta()

getXAbsolute

public int getXAbsolute()
getXAbsolute gets the absolute x axis value.

Specified by:
getXAbsolute in interface MouseInput
Returns:
the absolute x axis value.
See Also:
MouseInput.getXAbsolute()

getYAbsolute

public int getYAbsolute()
getYAbsolute gets the absolute y axis value.

Specified by:
getYAbsolute in interface MouseInput
Returns:
the absolute y axis value.
See Also:
MouseInput.getYAbsolute()

updateState

public void updateState()
updateState updates the mouse state.

Specified by:
updateState in interface MouseInput
See Also:
MouseInput.updateState()

setCursorVisible

public void setCursorVisible(boolean v)
setCursorVisible sets the visiblity of the hardware cursor.

Specified by:
setCursorVisible in interface MouseInput
Parameters:
v - true turns the cursor on false turns it off
See Also:
MouseInput.setCursorVisible(boolean)

isCursorVisible

public boolean isCursorVisible()
isCursorVisible Returns true if a cursor is currently bound.

Specified by:
isCursorVisible in interface MouseInput
Returns:
the visibility of the hardware cursor
See Also:
MouseInput.isCursorVisible()

getButtonType

public MouseButtonStateType getButtonType()
Returns:
The current state of the mouse's buttons.

getButtonState

public MouseButtonStateType getButtonState()
Specified by:
getButtonState in interface MouseInput
Returns:
the state of the mouse buttons.
See Also:
MouseInput.getButtonState()

getPreviousButtonState

public MouseButtonStateType getPreviousButtonState()
Specified by:
getPreviousButtonState in interface MouseInput
Returns:
the previous state of the mouse buttons.
See Also:
MouseInput.getPreviousButtonState()