|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimogl.input.InputManager
public class InputManager
This class is used as an input manager. It is fairly collaborating
with the InputAction class, because the input events registered
by this class are mapped to actions of the InputAction class.
Note: This class was strongly inspired by the
book "Developing Games In Java" by David Brackeen
| Field Summary | |
|---|---|
static java.awt.Cursor |
INVISIBLE_CURSOR
An invisible cursor. |
static int |
MOUSE_BUTTON_1
|
static int |
MOUSE_BUTTON_2
|
static int |
MOUSE_BUTTON_3
|
static int |
MOUSE_MOVE_DOWN
|
static int |
MOUSE_MOVE_LEFT
|
static int |
MOUSE_MOVE_RIGHT
|
static int |
MOUSE_MOVE_UP
|
static int |
MOUSE_WHEEL_DOWN
|
static int |
MOUSE_WHEEL_UP
|
| Constructor Summary | |
|---|---|
InputManager(java.awt.Component comp)
Creates a new InputManager for the specified component. |
|
| Method Summary | |
|---|---|
void |
assignKey(InputAction inputAction,
int keyCode)
Assigns a specific key to an InputAction. |
void |
assignMouse(InputAction inputAction,
int mouseCode)
Assigns a mouse action to an object of InputAction. |
void |
clearAssignments(InputAction inputAction)
Clears all assigned mouse and key actions from an input action |
static java.lang.String |
getKeyName(int keyCode)
Gets the name of a key code. |
java.util.List |
getMaps(InputAction gameCode)
Gets a List of names of the keys and mouse actions mapped to this GameAction. |
static int |
getMouseButtonCode(java.awt.event.MouseEvent e)
Gets the mouse code for the button specified in this MouseEvent. |
static java.lang.String |
getMouseName(int mouseCode)
Gets the name of a mouse code. |
int |
getMouseX()
Gets the x position of the mouse. |
int |
getMouseY()
Gets the y position of the mouse. |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
|
void |
resetAllGameActions()
Resets all GameActions so they appear like they haven't been pressed. |
void |
setCursor(java.awt.Cursor cursor)
Sets the cursor on this InputManager's input component. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.awt.Cursor INVISIBLE_CURSOR
public static final int MOUSE_MOVE_LEFT
public static final int MOUSE_MOVE_RIGHT
public static final int MOUSE_MOVE_UP
public static final int MOUSE_MOVE_DOWN
public static final int MOUSE_WHEEL_UP
public static final int MOUSE_WHEEL_DOWN
public static final int MOUSE_BUTTON_1
public static final int MOUSE_BUTTON_2
public static final int MOUSE_BUTTON_3
| Constructor Detail |
|---|
public InputManager(java.awt.Component comp)
| Method Detail |
|---|
public void setCursor(java.awt.Cursor cursor)
public void assignKey(InputAction inputAction,
int keyCode)
inputAction - An InputAction objectkeyCode - key code like KeyEvent.VK_A
public void assignMouse(InputAction inputAction,
int mouseCode)
inputAction - An InputAction objectmouseCode - mouse code like InputManager.MOUSE_MOVE_LEFTpublic void clearAssignments(InputAction inputAction)
inputAction - An InputAction objectpublic java.util.List getMaps(InputAction gameCode)
public void resetAllGameActions()
public static java.lang.String getKeyName(int keyCode)
public static java.lang.String getMouseName(int mouseCode)
public int getMouseX()
public int getMouseY()
public static int getMouseButtonCode(java.awt.event.MouseEvent e)
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved in interface java.awt.event.MouseWheelListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||