|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.input.Input
com.jme.input.MouseInput
public abstract class MouseInput
MouseInput
defines an interface to communicate with the mouse
input device.
The status of spcific buttons can be queried via the isButtonDown(int)
method. Position data can be queried by various get methods.
For each button that is pressed or released as well as for movement of
mouse or wheel an event is generated which
can be received by a MouseInputListener
, these are subsribed via
addListener(MouseInputListener)
. Handling of events is done inside the
update()
method.
Field Summary | |
---|---|
static java.lang.String |
INPUT_AWT
|
static java.lang.String |
INPUT_LWJGL
|
protected java.util.ArrayList<MouseInputListener> |
listeners
list of event listeners. |
Constructor Summary | |
---|---|
MouseInput()
|
Method Summary | |
---|---|
void |
addListener(MouseInputListener listener)
Subscribe a listener to receive mouse events. |
abstract void |
clear()
|
abstract void |
clearButton(int buttonCode)
|
boolean |
containsListener(MouseInputListener listener)
Check if a listener is allready added to this MouseInput |
protected abstract void |
destroy()
destroy cleans up the native mouse interface. |
static void |
destroyIfInitalized()
Destroy the input if it was initialized. |
static MouseInput |
get()
|
abstract int |
getButtonCount()
|
abstract int |
getButtonIndex(java.lang.String buttonName)
getButtonIndex gets the button code for a given button
name. |
abstract java.lang.String |
getButtonName(int buttonIndex)
getButtonName gets the button name for a given button
code. |
java.util.ArrayList<MouseInputListener> |
getListeners()
Get all added mouse listeners |
static java.lang.Class<?> |
getProvider()
Query current provider for input. |
abstract int |
getWheelDelta()
getWheelDelta gets the change in the mouse wheel. |
abstract int |
getWheelRotation()
|
abstract int |
getXAbsolute()
getXAbsolute gets the absolute x axis value. |
abstract int |
getXDelta()
getXDelta gets the change along the x axis. |
abstract int |
getYAbsolute()
getYAbsolute gets the absolute y axis value. |
abstract int |
getYDelta()
getYDelta gets the change along the y axis. |
abstract boolean |
isButtonDown(int buttonCode)
isButtonDown returns true if a given button is pressed,
false if it is not pressed. |
abstract boolean |
isCursorVisible()
isCursorVisible |
static boolean |
isInited()
isInited returns true if the key class is not setup
already (ie. |
void |
removeListener(MouseInputListener listener)
Unsubscribe a listener. |
void |
removeListeners()
Remove all listeners and disable event generation. |
abstract void |
setCursorPosition(int x,
int y)
|
abstract void |
setCursorVisible(boolean v)
setCursorVisible sets the visiblity of the hardware cursor. |
abstract void |
setHardwareCursor(java.net.URL file)
setHardwareCursor sets the image to use for the hardware cursor. |
abstract void |
setHardwareCursor(java.net.URL file,
Image[] images,
int[] delays,
int xHotspot,
int yHotspot)
This method will set an animated harware cursor. |
abstract void |
setHardwareCursor(java.net.URL file,
int xHotspot,
int yHotspot)
setHardwareCursor sets the image and hotspot position to use for the hardware cursor. |
static void |
setProvider(java.lang.Class value)
Change the provider used for mouse input. |
static void |
setProvider(java.lang.String value)
Change the provider used for mouse input. |
abstract void |
update()
Updates the state of the mouse (position and button states). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.ArrayList<MouseInputListener> listeners
public static final java.lang.String INPUT_LWJGL
public static final java.lang.String INPUT_AWT
Constructor Detail |
---|
public MouseInput()
Method Detail |
---|
public static MouseInput get()
getProvider()
public static java.lang.Class<?> getProvider()
public static void setProvider(java.lang.String value)
INPUT_LWJGL
.
value
- new provider class name
java.lang.IllegalStateException
- if called after first call of get()
. Note that get is called when
creating the DisplaySystem.
java.lang.IllegalArgumentException
- if the specified class cannot be found using Class.forName(String)
public static void setProvider(java.lang.Class value)
InputSystem.INPUT_SYSTEM_LWJGL
.
value
- new provider
java.lang.IllegalStateException
- if called after first call of get()
. Note that get is called when
creating the DisplaySystem.protected abstract void destroy()
destroy
cleans up the native mouse interface.
Destroy is protected now - please is destroyIfInitalized()
.
public abstract int getButtonIndex(java.lang.String buttonName)
getButtonIndex
gets the button code for a given button
name.
buttonName
- the name to get the code for.
public abstract boolean isButtonDown(int buttonCode)
isButtonDown
returns true if a given button is pressed,
false if it is not pressed.
buttonCode
- the button code to check.
public abstract java.lang.String getButtonName(int buttonIndex)
getButtonName
gets the button name for a given button
code.
buttonIndex
- the code to get the name for.
public static boolean isInited()
isInited
returns true if the key class is not setup
already (ie. .get() was not yet called).
public abstract int getWheelDelta()
getWheelDelta
gets the change in the mouse wheel.
public abstract int getXDelta()
getXDelta
gets the change along the x axis.
public abstract int getYDelta()
getYDelta
gets the change along the y axis.
public abstract int getXAbsolute()
getXAbsolute
gets the absolute x axis value.
public abstract int getYAbsolute()
getYAbsolute
gets the absolute y axis value.
public abstract void update()
update
in class Input
public abstract void setCursorVisible(boolean v)
setCursorVisible
sets the visiblity of the hardware cursor.
v
- true turns the cursor on false turns it offpublic abstract boolean isCursorVisible()
isCursorVisible
public abstract void setHardwareCursor(java.net.URL file)
setHardwareCursor
sets the image to use for the hardware cursor.
file
- URL to cursor imagepublic abstract void setHardwareCursor(java.net.URL file, int xHotspot, int yHotspot)
setHardwareCursor
sets the image and hotspot position to use for the hardware cursor.
file
- URL to cursor imagexHotspot
- Cursor X hotspot positionyHotspot
- Cursor Y hotspot positionpublic abstract void setHardwareCursor(java.net.URL file, Image[] images, int[] delays, int xHotspot, int yHotspot)
file
- in this method file is only used as a key for cursor cashingimages
- the animation framesdelays
- delays between changing each framexHotspot
- from image leftyHotspot
- from image bottompublic void addListener(MouseInputListener listener)
listener
- to be subscribedpublic void removeListener(MouseInputListener listener)
listener
- to be unsuscribedaddListener(com.jme.input.MouseInputListener)
public void removeListeners()
public boolean containsListener(MouseInputListener listener)
listener
- listener to check for
public java.util.ArrayList<MouseInputListener> getListeners()
public static void destroyIfInitalized()
public abstract int getWheelRotation()
public abstract int getButtonCount()
public abstract void setCursorPosition(int x, int y)
public abstract void clear()
public abstract void clearButton(int buttonCode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |