com.jme.input.lwjgl
Class LWJGLMouseInput

java.lang.Object
  extended by com.jme.input.Input
      extended by com.jme.input.MouseInput
          extended by com.jme.input.lwjgl.LWJGLMouseInput

public class LWJGLMouseInput
extends MouseInput

Mouse input handler that uses the LWJGL input API.

Version:
$Revision: 4131 $, $Date: 2009-03-19 20:15:28 +0000 (Thu, 19 Mar 2009) $
Author:
Mark Powell
See Also:
Cursor, Mouse

Field Summary
 
Fields inherited from class com.jme.input.MouseInput
INPUT_AWT, INPUT_LWJGL, listeners
 
Constructor Summary
protected LWJGLMouseInput()
          Constructor creates a new LWJGLMouseInput object.
 
Method Summary
 void clear()
           
 void clearButton(int buttonCode)
           
 void destroy()
          destroy cleans up the native mouse reference.
 int getButtonCount()
           
 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.
 int getWheelDelta()
          getWheelDelta retrieves the change of the mouse wheel, if any.
 int getWheelRotation()
           
 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 isCursorVisible()
          isCursorVisible Returns true if a cursor is currently bound.
 void setCursorPosition(int x, int y)
           
 void setCursorVisible(boolean v)
          setCursorVisible sets the visiblity of the hardware cursor.
 void setHardwareCursor(java.net.URL file)
          setHardwareCursor sets the image to use for the hardware cursor.
 void setHardwareCursor(java.net.URL file, Image[] images, int[] delays, int xHotspot, int yHotspot)
          This method will set an animated harware cursor.
 void setHardwareCursor(java.net.URL file, int xHotspot, int yHotspot)
          Loads and sets a hardware cursor
 void update()
          updateState updates the mouse state.
 
Methods inherited from class com.jme.input.MouseInput
addListener, containsListener, destroyIfInitalized, get, getListeners, getProvider, isInited, removeListener, removeListeners, setProvider, setProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWJGLMouseInput

protected 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 class 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 class 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 class 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 class MouseInput
Parameters:
buttonCode - the button code to check.
Returns:
true if the button is pressed, false otherwise.
See Also:
MouseInput.isButtonDown(int)

getWheelDelta

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

Specified by:
getWheelDelta in class 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 class 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 class 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 class 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 class MouseInput
Returns:
the absolute y axis value.
See Also:
MouseInput.getYAbsolute()

update

public void update()
updateState updates the mouse state.

Specified by:
update in class MouseInput
See Also:
MouseInput.update()

setCursorVisible

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

Specified by:
setCursorVisible in class 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 class MouseInput
Returns:
the visibility of the hardware cursor
See Also:
MouseInput.isCursorVisible()

setHardwareCursor

public void setHardwareCursor(java.net.URL file)
Description copied from class: MouseInput
setHardwareCursor sets the image to use for the hardware cursor.

Specified by:
setHardwareCursor in class MouseInput
Parameters:
file - URL to cursor image

setHardwareCursor

public void setHardwareCursor(java.net.URL file,
                              int xHotspot,
                              int yHotspot)
Loads and sets a hardware cursor

Specified by:
setHardwareCursor in class MouseInput
Parameters:
url - to imagefile
xHotspot - from image left
yHotspot - from image bottom

setHardwareCursor

public void setHardwareCursor(java.net.URL file,
                              Image[] images,
                              int[] delays,
                              int xHotspot,
                              int yHotspot)
This method will set an animated harware cursor.

Specified by:
setHardwareCursor in class MouseInput
Parameters:
file - in this method file is only used as a key for cursor cashing
images - the animation frames
delays - delays between changing each frame
xHotspot - from image left
yHotspot - from image bottom

getWheelRotation

public int getWheelRotation()
Specified by:
getWheelRotation in class MouseInput
Returns:
absolte wheel rotation

getButtonCount

public int getButtonCount()
Specified by:
getButtonCount in class MouseInput
Returns:
number of mouse buttons

setCursorPosition

public void setCursorPosition(int x,
                              int y)
Specified by:
setCursorPosition in class MouseInput

clear

public void clear()
Specified by:
clear in class MouseInput

clearButton

public void clearButton(int buttonCode)
Specified by:
clearButton in class MouseInput