espresso3d.engine.input
Class E3DInputHandler

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.input.E3DInputHandler

public class E3DInputHandler
extends E3DEngineItem

Author:
espresso3d The basic input handler class. An instance of this is created within the engine for you

Field Summary
static java.lang.Integer KEY_0
           
static java.lang.Integer KEY_1
           
static java.lang.Integer KEY_2
           
static java.lang.Integer KEY_3
           
static java.lang.Integer KEY_4
           
static java.lang.Integer KEY_5
           
static java.lang.Integer KEY_6
           
static java.lang.Integer KEY_7
           
static java.lang.Integer KEY_8
           
static java.lang.Integer KEY_9
           
static java.lang.Integer KEY_A
           
static java.lang.Integer KEY_ADD
           
static java.lang.Integer KEY_APOSTROPHE
           
static java.lang.Integer KEY_APPS
           
static java.lang.Integer KEY_AT
           
static java.lang.Integer KEY_AX
           
static java.lang.Integer KEY_B
           
static java.lang.Integer KEY_BACK
           
static java.lang.Integer KEY_BACKSLASH
           
static java.lang.Integer KEY_C
           
static java.lang.Integer KEY_CAPITAL
           
static java.lang.Integer KEY_CIRCUMFLEX
           
static java.lang.Integer KEY_COLON
           
static java.lang.Integer KEY_COMMA
           
static java.lang.Integer KEY_CONVERT
           
static java.lang.Integer KEY_D
           
static java.lang.Integer KEY_DECIMAL
           
static java.lang.Integer KEY_DELETE
           
static java.lang.Integer KEY_DIVIDE
           
static java.lang.Integer KEY_DOWN
           
static java.lang.Integer KEY_E
           
static java.lang.Integer KEY_END
           
static java.lang.Integer KEY_EQUALS
           
static java.lang.Integer KEY_ESCAPE
           
static java.lang.Integer KEY_F
           
static java.lang.Integer KEY_F1
           
static java.lang.Integer KEY_F10
           
static java.lang.Integer KEY_F11
           
static java.lang.Integer KEY_F12
           
static java.lang.Integer KEY_F13
           
static java.lang.Integer KEY_F14
           
static java.lang.Integer KEY_F15
           
static java.lang.Integer KEY_F2
           
static java.lang.Integer KEY_F3
           
static java.lang.Integer KEY_F4
           
static java.lang.Integer KEY_F5
           
static java.lang.Integer KEY_F6
           
static java.lang.Integer KEY_F7
           
static java.lang.Integer KEY_F8
           
static java.lang.Integer KEY_F9
           
static java.lang.Integer KEY_G
           
static java.lang.Integer KEY_GRAVE
           
static java.lang.Integer KEY_H
           
static java.lang.Integer KEY_HOME
           
static java.lang.Integer KEY_I
           
static java.lang.Integer KEY_INSERT
           
static java.lang.Integer KEY_J
           
static java.lang.Integer KEY_K
           
static java.lang.Integer KEY_KANA
           
static java.lang.Integer KEY_KANJI
           
static java.lang.Integer KEY_L
           
static java.lang.Integer KEY_LBRACKET
           
static java.lang.Integer KEY_LCONTROL
           
static java.lang.Integer KEY_LEFT
           
static java.lang.Integer KEY_LMENU
           
static java.lang.Integer KEY_LSHIFT
           
static java.lang.Integer KEY_LWIN
           
static java.lang.Integer KEY_M
           
static java.lang.Integer KEY_MINUS
           
static java.lang.Integer KEY_MULTIPLY
           
static java.lang.Integer KEY_N
           
static java.lang.Integer KEY_NEXT
           
static java.lang.Integer KEY_NOCONVERT
           
static java.lang.Integer KEY_NONE
           
static java.lang.Integer KEY_NUMLOCK
           
static java.lang.Integer KEY_NUMPAD0
           
static java.lang.Integer KEY_NUMPAD1
           
static java.lang.Integer KEY_NUMPAD2
           
static java.lang.Integer KEY_NUMPAD3
           
static java.lang.Integer KEY_NUMPAD4
           
static java.lang.Integer KEY_NUMPAD5
           
static java.lang.Integer KEY_NUMPAD6
           
static java.lang.Integer KEY_NUMPAD7
           
static java.lang.Integer KEY_NUMPAD8
           
static java.lang.Integer KEY_NUMPAD9
           
static java.lang.Integer KEY_NUMPADCOMMA
           
static java.lang.Integer KEY_NUMPADENTER
           
static java.lang.Integer KEY_NUMPADEQUALS
           
static java.lang.Integer KEY_O
           
static java.lang.Integer KEY_P
           
static java.lang.Integer KEY_PAUSE
           
static java.lang.Integer KEY_PERIOD
           
static java.lang.Integer KEY_POWER
           
static java.lang.Integer KEY_PRIOR
           
static java.lang.Integer KEY_Q
           
static java.lang.Integer KEY_R
           
static java.lang.Integer KEY_RBRACKET
           
static java.lang.Integer KEY_RCONTROL
           
static java.lang.Integer KEY_RETURN
           
static java.lang.Integer KEY_RIGHT
           
static java.lang.Integer KEY_RMENU
           
static java.lang.Integer KEY_RSHIFT
           
static java.lang.Integer KEY_RWIN
           
static java.lang.Integer KEY_S
           
static java.lang.Integer KEY_SCROLL
           
static java.lang.Integer KEY_SEMICOLON
           
static java.lang.Integer KEY_SLASH
           
static java.lang.Integer KEY_SLEEP
           
static java.lang.Integer KEY_SPACE
           
static java.lang.Integer KEY_STOP
           
static java.lang.Integer KEY_SUBTRACT
           
static java.lang.Integer KEY_SYSRQ
           
static java.lang.Integer KEY_T
           
static java.lang.Integer KEY_TAB
           
static java.lang.Integer KEY_U
           
static java.lang.Integer KEY_UNDERLINE
           
static java.lang.Integer KEY_UNLABELED
           
static java.lang.Integer KEY_UP
           
static java.lang.Integer KEY_V
           
static java.lang.Integer KEY_W
           
static java.lang.Integer KEY_X
           
static java.lang.Integer KEY_Y
           
static java.lang.Integer KEY_YEN
           
static java.lang.Integer KEY_Z
           
static java.lang.Integer MOUSE_BUTTON_LEFT
           
static java.lang.Integer MOUSE_BUTTON_MIDDLE
           
static java.lang.Integer MOUSE_BUTTON_RIGHT
           
 
Constructor Summary
E3DInputHandler(E3DEngine engine)
           
 
Method Summary
 void bindKeyToHandler(java.lang.Integer key, E3DInputCallback callback)
          Bind a key to a E3DInputCallback implementing class.
 void bindMouseButtonToHandler(java.lang.Integer mouseButton, E3DInputCallback callback)
          Bind a mouse button to a E3DInputCallback implementing class.
 void bindMouseMovementToHandler(E3DInputCallback callback)
          Bind mouse movement to a E3DInputCallback implementing class.
 void checkInput()
          Call this once per frame to have all input callbacks fired off if their registered bindings have taken place (eg: a key has been pressed)
 int getMousePositionX()
          Returns the mouse X value between 0 and screenWidth - 1
 int getMousePositionY()
          Returns the mouse Y value between 0 and screenHeight - 1
 boolean isKeyDown(java.lang.Integer keyCode)
          Can be used to check if a specified key is down (KEY_...).
 boolean isMouseButtonDown(java.lang.Integer buttonCode)
          Can be used to check if a specified key is down (KEY_...).
 boolean isMouseCursorHidden()
          If the mouse has been set to hidden, this will return true, otherwise true
 void setMouseCursorHidden(boolean hidden)
          Set whether or not to hide the mouse cursor
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_0

public static final java.lang.Integer KEY_0

KEY_1

public static final java.lang.Integer KEY_1

KEY_2

public static final java.lang.Integer KEY_2

KEY_3

public static final java.lang.Integer KEY_3

KEY_4

public static final java.lang.Integer KEY_4

KEY_5

public static final java.lang.Integer KEY_5

KEY_6

public static final java.lang.Integer KEY_6

KEY_7

public static final java.lang.Integer KEY_7

KEY_8

public static final java.lang.Integer KEY_8

KEY_9

public static final java.lang.Integer KEY_9

KEY_A

public static final java.lang.Integer KEY_A

KEY_ADD

public static final java.lang.Integer KEY_ADD

KEY_APOSTROPHE

public static final java.lang.Integer KEY_APOSTROPHE

KEY_APPS

public static final java.lang.Integer KEY_APPS

KEY_AT

public static final java.lang.Integer KEY_AT

KEY_AX

public static final java.lang.Integer KEY_AX

KEY_B

public static final java.lang.Integer KEY_B

KEY_BACK

public static final java.lang.Integer KEY_BACK

KEY_BACKSLASH

public static final java.lang.Integer KEY_BACKSLASH

KEY_C

public static final java.lang.Integer KEY_C

KEY_CAPITAL

public static final java.lang.Integer KEY_CAPITAL

KEY_CIRCUMFLEX

public static final java.lang.Integer KEY_CIRCUMFLEX

KEY_COLON

public static final java.lang.Integer KEY_COLON

KEY_COMMA

public static final java.lang.Integer KEY_COMMA

KEY_CONVERT

public static final java.lang.Integer KEY_CONVERT

KEY_D

public static final java.lang.Integer KEY_D

KEY_DECIMAL

public static final java.lang.Integer KEY_DECIMAL

KEY_DELETE

public static final java.lang.Integer KEY_DELETE

KEY_DIVIDE

public static final java.lang.Integer KEY_DIVIDE

KEY_DOWN

public static final java.lang.Integer KEY_DOWN

KEY_E

public static final java.lang.Integer KEY_E

KEY_END

public static final java.lang.Integer KEY_END

KEY_EQUALS

public static final java.lang.Integer KEY_EQUALS

KEY_ESCAPE

public static final java.lang.Integer KEY_ESCAPE

KEY_F

public static final java.lang.Integer KEY_F

KEY_F1

public static final java.lang.Integer KEY_F1

KEY_F2

public static final java.lang.Integer KEY_F2

KEY_F3

public static final java.lang.Integer KEY_F3

KEY_F4

public static final java.lang.Integer KEY_F4

KEY_F5

public static final java.lang.Integer KEY_F5

KEY_F6

public static final java.lang.Integer KEY_F6

KEY_F7

public static final java.lang.Integer KEY_F7

KEY_F8

public static final java.lang.Integer KEY_F8

KEY_F9

public static final java.lang.Integer KEY_F9

KEY_F10

public static final java.lang.Integer KEY_F10

KEY_F11

public static final java.lang.Integer KEY_F11

KEY_F12

public static final java.lang.Integer KEY_F12

KEY_F13

public static final java.lang.Integer KEY_F13

KEY_F14

public static final java.lang.Integer KEY_F14

KEY_F15

public static final java.lang.Integer KEY_F15

KEY_G

public static final java.lang.Integer KEY_G

KEY_GRAVE

public static final java.lang.Integer KEY_GRAVE

KEY_H

public static final java.lang.Integer KEY_H

KEY_HOME

public static final java.lang.Integer KEY_HOME

KEY_I

public static final java.lang.Integer KEY_I

KEY_INSERT

public static final java.lang.Integer KEY_INSERT

KEY_J

public static final java.lang.Integer KEY_J

KEY_K

public static final java.lang.Integer KEY_K

KEY_KANA

public static final java.lang.Integer KEY_KANA

KEY_KANJI

public static final java.lang.Integer KEY_KANJI

KEY_L

public static final java.lang.Integer KEY_L

KEY_LBRACKET

public static final java.lang.Integer KEY_LBRACKET

KEY_LCONTROL

public static final java.lang.Integer KEY_LCONTROL

KEY_LEFT

public static final java.lang.Integer KEY_LEFT

KEY_LMENU

public static final java.lang.Integer KEY_LMENU

KEY_LSHIFT

public static final java.lang.Integer KEY_LSHIFT

KEY_LWIN

public static final java.lang.Integer KEY_LWIN

KEY_M

public static final java.lang.Integer KEY_M

KEY_MINUS

public static final java.lang.Integer KEY_MINUS

KEY_MULTIPLY

public static final java.lang.Integer KEY_MULTIPLY

KEY_N

public static final java.lang.Integer KEY_N

KEY_NEXT

public static final java.lang.Integer KEY_NEXT

KEY_NOCONVERT

public static final java.lang.Integer KEY_NOCONVERT

KEY_NONE

public static final java.lang.Integer KEY_NONE

KEY_NUMLOCK

public static final java.lang.Integer KEY_NUMLOCK

KEY_NUMPAD0

public static final java.lang.Integer KEY_NUMPAD0

KEY_NUMPAD1

public static final java.lang.Integer KEY_NUMPAD1

KEY_NUMPAD2

public static final java.lang.Integer KEY_NUMPAD2

KEY_NUMPAD3

public static final java.lang.Integer KEY_NUMPAD3

KEY_NUMPAD4

public static final java.lang.Integer KEY_NUMPAD4

KEY_NUMPAD5

public static final java.lang.Integer KEY_NUMPAD5

KEY_NUMPAD6

public static final java.lang.Integer KEY_NUMPAD6

KEY_NUMPAD7

public static final java.lang.Integer KEY_NUMPAD7

KEY_NUMPAD8

public static final java.lang.Integer KEY_NUMPAD8

KEY_NUMPAD9

public static final java.lang.Integer KEY_NUMPAD9

KEY_NUMPADCOMMA

public static final java.lang.Integer KEY_NUMPADCOMMA

KEY_NUMPADENTER

public static final java.lang.Integer KEY_NUMPADENTER

KEY_NUMPADEQUALS

public static final java.lang.Integer KEY_NUMPADEQUALS

KEY_O

public static final java.lang.Integer KEY_O

KEY_P

public static final java.lang.Integer KEY_P

KEY_PAUSE

public static final java.lang.Integer KEY_PAUSE

KEY_PERIOD

public static final java.lang.Integer KEY_PERIOD

KEY_POWER

public static final java.lang.Integer KEY_POWER

KEY_PRIOR

public static final java.lang.Integer KEY_PRIOR

KEY_Q

public static final java.lang.Integer KEY_Q

KEY_R

public static final java.lang.Integer KEY_R

KEY_RBRACKET

public static final java.lang.Integer KEY_RBRACKET

KEY_RCONTROL

public static final java.lang.Integer KEY_RCONTROL

KEY_RETURN

public static final java.lang.Integer KEY_RETURN

KEY_RIGHT

public static final java.lang.Integer KEY_RIGHT

KEY_RMENU

public static final java.lang.Integer KEY_RMENU

KEY_RSHIFT

public static final java.lang.Integer KEY_RSHIFT

KEY_RWIN

public static final java.lang.Integer KEY_RWIN

KEY_S

public static final java.lang.Integer KEY_S

KEY_SCROLL

public static final java.lang.Integer KEY_SCROLL

KEY_SEMICOLON

public static final java.lang.Integer KEY_SEMICOLON

KEY_SLASH

public static final java.lang.Integer KEY_SLASH

KEY_SLEEP

public static final java.lang.Integer KEY_SLEEP

KEY_SPACE

public static final java.lang.Integer KEY_SPACE

KEY_STOP

public static final java.lang.Integer KEY_STOP

KEY_SUBTRACT

public static final java.lang.Integer KEY_SUBTRACT

KEY_SYSRQ

public static final java.lang.Integer KEY_SYSRQ

KEY_T

public static final java.lang.Integer KEY_T

KEY_TAB

public static final java.lang.Integer KEY_TAB

KEY_U

public static final java.lang.Integer KEY_U

KEY_UNDERLINE

public static final java.lang.Integer KEY_UNDERLINE

KEY_UNLABELED

public static final java.lang.Integer KEY_UNLABELED

KEY_UP

public static final java.lang.Integer KEY_UP

KEY_V

public static final java.lang.Integer KEY_V

KEY_W

public static final java.lang.Integer KEY_W

KEY_X

public static final java.lang.Integer KEY_X

KEY_Y

public static final java.lang.Integer KEY_Y

KEY_YEN

public static final java.lang.Integer KEY_YEN

KEY_Z

public static final java.lang.Integer KEY_Z

MOUSE_BUTTON_LEFT

public static final java.lang.Integer MOUSE_BUTTON_LEFT

MOUSE_BUTTON_RIGHT

public static final java.lang.Integer MOUSE_BUTTON_RIGHT

MOUSE_BUTTON_MIDDLE

public static final java.lang.Integer MOUSE_BUTTON_MIDDLE
Constructor Detail

E3DInputHandler

public E3DInputHandler(E3DEngine engine)
Method Detail

bindKeyToHandler

public void bindKeyToHandler(java.lang.Integer key,
                             E3DInputCallback callback)
Bind a key to a E3DInputCallback implementing class. Once bound, when this key is pressed, callback's onInput method will be called

Parameters:
key -
callback -

bindMouseButtonToHandler

public void bindMouseButtonToHandler(java.lang.Integer mouseButton,
                                     E3DInputCallback callback)
Bind a mouse button to a E3DInputCallback implementing class. Once bound, when this mouseButton is pressed, callback's onInput method will be called

Parameters:
mouseButton -
callback -

bindMouseMovementToHandler

public void bindMouseMovementToHandler(E3DInputCallback callback)
Bind mouse movement to a E3DInputCallback implementing class.

Parameters:
callback -

checkInput

public void checkInput()
Call this once per frame to have all input callbacks fired off if their registered bindings have taken place (eg: a key has been pressed)


isKeyDown

public boolean isKeyDown(java.lang.Integer keyCode)
Can be used to check if a specified key is down (KEY_...). This is normally only used to see if another key is down when a key down callback is fired. For example, it might be used to to check if SHIFT is held down in some other key's bound callback.

Parameters:
keyCode - One of the static KEY_ variables

isMouseButtonDown

public boolean isMouseButtonDown(java.lang.Integer buttonCode)
Can be used to check if a specified key is down (KEY_...). This is normally only used to see if another key is down when a key down callback is fired. For example,

Parameters:
buttonCode - One of the static MOUSE_BUTTON_ variables.

isMouseCursorHidden

public boolean isMouseCursorHidden()
If the mouse has been set to hidden, this will return true, otherwise true


setMouseCursorHidden

public void setMouseCursorHidden(boolean hidden)
Set whether or not to hide the mouse cursor

Parameters:
hidden -

getMousePositionX

public int getMousePositionX()
Returns the mouse X value between 0 and screenWidth - 1

Returns:

getMousePositionY

public int getMousePositionY()
Returns the mouse Y value between 0 and screenHeight - 1

Returns: