com.jme.input
Interface KeyInput

All Known Implementing Classes:
LWJGLKeyInput

public interface KeyInput

KeyInput provides an interface for dealing with keyboard input. There are public contstants for each key of the keyboard, which correspond to the LWJGL key bindings. This may require conversion by other subclasses for specific APIs.

Version:
$Id: KeyInput.java,v 1.8 2004/08/24 19:04:44 renanse Exp $
Author:
Mark Powell

Field Summary
static int KEY_0
          0 key.
static int KEY_1
          1 key.
static int KEY_2
          2 key.
static int KEY_3
          3 key.
static int KEY_4
          4 key.
static int KEY_5
          5 key.
static int KEY_6
          6 key.
static int KEY_7
          7 key.
static int KEY_8
          8 key.
static int KEY_9
          9 key.
static int KEY_A
          a key.
static int KEY_ADD
          + key (num pad).
static int KEY_APOSTROPHE
          ' key.
static int KEY_APPS
          menu key.
static int KEY_AT
           
static int KEY_AX
          ax key (Japanese).
static int KEY_B
          b key.
static int KEY_BACK
          back key.
static int KEY_BACKSLASH
          \ key.
static int KEY_C
          c key.
static int KEY_CAPITAL
          caps lock key.
static int KEY_CIRCUMFLEX
          circum flex key (Japanese).
static int KEY_COLON
          : key (NEC PC98)
static int KEY_COMMA
          , key.
static int KEY_CONVERT
          convert key (Japanese).
static int KEY_D
          d key.
static int KEY_DECIMAL
          .
static int KEY_DELETE
          delete key.
static int KEY_DIVIDE
          / key (num pad).
static int KEY_DOWN
          down arrow key.
static int KEY_E
          e key.
static int KEY_END
          end key.
static int KEY_EQUALS
          = key.
static int KEY_ESCAPE
          escape key.
static int KEY_F
          f key.
static int KEY_F1
          F1 key.
static int KEY_F10
          F10 key.
static int KEY_F11
          F11 key.
static int KEY_F12
          F12 key.
static int KEY_F13
          F13 key.
static int KEY_F14
          F14 key.
static int KEY_F15
          F15 key.
static int KEY_F2
          F2 key.
static int KEY_F3
          F3 key.
static int KEY_F4
          F4 key.
static int KEY_F5
          F5 key.
static int KEY_F6
          F6 key.
static int KEY_F7
          F7 key.
static int KEY_F8
          F8 key.
static int KEY_F9
          F9 key.
static int KEY_G
          g key.
static int KEY_GRAVE
          ` key.
static int KEY_H
          h key.
static int KEY_HOME
          home key.
static int KEY_I
          i key.
static int KEY_INSERT
          insert key.
static int KEY_J
          j key.
static int KEY_K
          k key.
static int KEY_KANA
          kana key (Japanese).
static int KEY_KANJI
          kanji key (Japanese).
static int KEY_L
          l key.
static int KEY_LBRACKET
          [ key.
static int KEY_LCONTROL
          left control key.
static int KEY_LEFT
          left arrow key.
static int KEY_LMENU
          left alt key.
static int KEY_LSHIFT
          left shift key.
static int KEY_LWIN
          left windows key.
static int KEY_M
          m key.
static int KEY_MINUS
          - key.
static int KEY_MULTIPLY
          * key (on keypad).
static int KEY_N
          n key.
static int KEY_NEXT
          PgDn key.
static int KEY_NOCONVERT
          noconvert key (Japanese).
static int KEY_NUMLOCK
          NumLK key.
static int KEY_NUMPAD0
          0 key (num pad).
static int KEY_NUMPAD1
          1 key (num pad).
static int KEY_NUMPAD2
          2 key (num pad).
static int KEY_NUMPAD3
          3 key (num pad).
static int KEY_NUMPAD4
          4 key (num pad).
static int KEY_NUMPAD5
          5 key (num pad).
static int KEY_NUMPAD6
          6 key (num pad).
static int KEY_NUMPAD7
          7 key (num pad).
static int KEY_NUMPAD8
          8 key (num pad).
static int KEY_NUMPAD9
          9 key (num pad).
static int KEY_NUMPADCOMMA
          , key on num pad (NEC PC98).
static int KEY_NUMPADENTER
          Enter key (num pad).
static int KEY_NUMPADEQUALS
          = on num pad (NEC PC98).
static int KEY_O
          o key.
static int KEY_P
          p key.
static int KEY_PAUSE
          pause key.
static int KEY_PERIOD
          .
static int KEY_PGDN
          PgDn key.
static int KEY_PGUP
          PgUp key.
static int KEY_POWER
          power key.
static int KEY_PRIOR
          PgUp key.
static int KEY_Q
          q key.
static int KEY_R
          r key.
static int KEY_RBRACKET
          ] key.
static int KEY_RCONTROL
          right control key.
static int KEY_RETURN
          enter (main keyboard) key.
static int KEY_RIGHT
          right arrow key.
static int KEY_RMENU
          right alt key.
static int KEY_RSHIFT
          right shift key.
static int KEY_RWIN
          right windows key.
static int KEY_S
          s key.
static int KEY_SCROLL
          Scroll lock key.
static int KEY_SEMICOLON
          ; key.
static int KEY_SLASH
          / key (main keyboard).
static int KEY_SLEEP
          sleep key.
static int KEY_SPACE
          space key.
static int KEY_STOP
          stop key (NEC PC98).
static int KEY_SUBTRACT
          - key (num pad).
static int KEY_SYSRQ
          SysRq key.
static int KEY_T
          t key.
static int KEY_TAB
          tab key.
static int KEY_U
          u key.
static int KEY_UNDERLINE
          _ key (NEC PC98).
static int KEY_UNLABELED
          (J3100).
static int KEY_UP
          up arrow key.
static int KEY_V
          v key.
static int KEY_W
          w key.
static int KEY_X
          x key.
static int KEY_Y
          y key.
static int KEY_YEN
          yen key (Japanese).
static int KEY_Z
          z key.
 
Method Summary
 void destroy()
          destroy frees the keyboard for use by other applications.
 int getKeyIndex(java.lang.String name)
          The reverse of getKeyName, returns the value of the key given the name
 java.lang.String getKeyName(int key)
          getKeyName returns the string prepresentation of a key code.
 boolean isCreated()
          isCreated returns true if the key class is initialized.
 boolean isKeyDown(int key)
          isKeyDown returns true if the given key is pressed.
 int key()
          the key value of the current event
 char keyChar()
          the char value of the current event
 boolean next()
          iterates to the next event when using event based keyboard
 boolean state()
          The key pressed state of the current key event
 void update()
          update updates the current state of the keyboard, holding information about what keys are pressed.
 

Field Detail

KEY_ESCAPE

public static final int KEY_ESCAPE
escape key.

See Also:
Constant Field Values

KEY_1

public static final int KEY_1
1 key.

See Also:
Constant Field Values

KEY_2

public static final int KEY_2
2 key.

See Also:
Constant Field Values

KEY_3

public static final int KEY_3
3 key.

See Also:
Constant Field Values

KEY_4

public static final int KEY_4
4 key.

See Also:
Constant Field Values

KEY_5

public static final int KEY_5
5 key.

See Also:
Constant Field Values

KEY_6

public static final int KEY_6
6 key.

See Also:
Constant Field Values

KEY_7

public static final int KEY_7
7 key.

See Also:
Constant Field Values

KEY_8

public static final int KEY_8
8 key.

See Also:
Constant Field Values

KEY_9

public static final int KEY_9
9 key.

See Also:
Constant Field Values

KEY_0

public static final int KEY_0
0 key.

See Also:
Constant Field Values

KEY_MINUS

public static final int KEY_MINUS
- key.

See Also:
Constant Field Values

KEY_EQUALS

public static final int KEY_EQUALS
= key.

See Also:
Constant Field Values

KEY_BACK

public static final int KEY_BACK
back key.

See Also:
Constant Field Values

KEY_TAB

public static final int KEY_TAB
tab key.

See Also:
Constant Field Values

KEY_Q

public static final int KEY_Q
q key.

See Also:
Constant Field Values

KEY_W

public static final int KEY_W
w key.

See Also:
Constant Field Values

KEY_E

public static final int KEY_E
e key.

See Also:
Constant Field Values

KEY_R

public static final int KEY_R
r key.

See Also:
Constant Field Values

KEY_T

public static final int KEY_T
t key.

See Also:
Constant Field Values

KEY_Y

public static final int KEY_Y
y key.

See Also:
Constant Field Values

KEY_U

public static final int KEY_U
u key.

See Also:
Constant Field Values

KEY_I

public static final int KEY_I
i key.

See Also:
Constant Field Values

KEY_O

public static final int KEY_O
o key.

See Also:
Constant Field Values

KEY_P

public static final int KEY_P
p key.

See Also:
Constant Field Values

KEY_LBRACKET

public static final int KEY_LBRACKET
[ key.

See Also:
Constant Field Values

KEY_RBRACKET

public static final int KEY_RBRACKET
] key.

See Also:
Constant Field Values

KEY_RETURN

public static final int KEY_RETURN
enter (main keyboard) key.

See Also:
Constant Field Values

KEY_LCONTROL

public static final int KEY_LCONTROL
left control key.

See Also:
Constant Field Values

KEY_A

public static final int KEY_A
a key.

See Also:
Constant Field Values

KEY_S

public static final int KEY_S
s key.

See Also:
Constant Field Values

KEY_D

public static final int KEY_D
d key.

See Also:
Constant Field Values

KEY_F

public static final int KEY_F
f key.

See Also:
Constant Field Values

KEY_G

public static final int KEY_G
g key.

See Also:
Constant Field Values

KEY_H

public static final int KEY_H
h key.

See Also:
Constant Field Values

KEY_J

public static final int KEY_J
j key.

See Also:
Constant Field Values

KEY_K

public static final int KEY_K
k key.

See Also:
Constant Field Values

KEY_L

public static final int KEY_L
l key.

See Also:
Constant Field Values

KEY_SEMICOLON

public static final int KEY_SEMICOLON
; key.

See Also:
Constant Field Values

KEY_APOSTROPHE

public static final int KEY_APOSTROPHE
' key.

See Also:
Constant Field Values

KEY_GRAVE

public static final int KEY_GRAVE
` key.

See Also:
Constant Field Values

KEY_LSHIFT

public static final int KEY_LSHIFT
left shift key.

See Also:
Constant Field Values

KEY_BACKSLASH

public static final int KEY_BACKSLASH
\ key.

See Also:
Constant Field Values

KEY_Z

public static final int KEY_Z
z key.

See Also:
Constant Field Values

KEY_X

public static final int KEY_X
x key.

See Also:
Constant Field Values

KEY_C

public static final int KEY_C
c key.

See Also:
Constant Field Values

KEY_V

public static final int KEY_V
v key.

See Also:
Constant Field Values

KEY_B

public static final int KEY_B
b key.

See Also:
Constant Field Values

KEY_N

public static final int KEY_N
n key.

See Also:
Constant Field Values

KEY_M

public static final int KEY_M
m key.

See Also:
Constant Field Values

KEY_COMMA

public static final int KEY_COMMA
, key.

See Also:
Constant Field Values

KEY_PERIOD

public static final int KEY_PERIOD
. key (main keyboard).

See Also:
Constant Field Values

KEY_SLASH

public static final int KEY_SLASH
/ key (main keyboard).

See Also:
Constant Field Values

KEY_RSHIFT

public static final int KEY_RSHIFT
right shift key.

See Also:
Constant Field Values

KEY_MULTIPLY

public static final int KEY_MULTIPLY
* key (on keypad).

See Also:
Constant Field Values

KEY_LMENU

public static final int KEY_LMENU
left alt key.

See Also:
Constant Field Values

KEY_SPACE

public static final int KEY_SPACE
space key.

See Also:
Constant Field Values

KEY_CAPITAL

public static final int KEY_CAPITAL
caps lock key.

See Also:
Constant Field Values

KEY_F1

public static final int KEY_F1
F1 key.

See Also:
Constant Field Values

KEY_F2

public static final int KEY_F2
F2 key.

See Also:
Constant Field Values

KEY_F3

public static final int KEY_F3
F3 key.

See Also:
Constant Field Values

KEY_F4

public static final int KEY_F4
F4 key.

See Also:
Constant Field Values

KEY_F5

public static final int KEY_F5
F5 key.

See Also:
Constant Field Values

KEY_F6

public static final int KEY_F6
F6 key.

See Also:
Constant Field Values

KEY_F7

public static final int KEY_F7
F7 key.

See Also:
Constant Field Values

KEY_F8

public static final int KEY_F8
F8 key.

See Also:
Constant Field Values

KEY_F9

public static final int KEY_F9
F9 key.

See Also:
Constant Field Values

KEY_F10

public static final int KEY_F10
F10 key.

See Also:
Constant Field Values

KEY_NUMLOCK

public static final int KEY_NUMLOCK
NumLK key.

See Also:
Constant Field Values

KEY_SCROLL

public static final int KEY_SCROLL
Scroll lock key.

See Also:
Constant Field Values

KEY_NUMPAD7

public static final int KEY_NUMPAD7
7 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD8

public static final int KEY_NUMPAD8
8 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD9

public static final int KEY_NUMPAD9
9 key (num pad).

See Also:
Constant Field Values

KEY_SUBTRACT

public static final int KEY_SUBTRACT
- key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD4

public static final int KEY_NUMPAD4
4 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD5

public static final int KEY_NUMPAD5
5 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD6

public static final int KEY_NUMPAD6
6 key (num pad).

See Also:
Constant Field Values

KEY_ADD

public static final int KEY_ADD
+ key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD1

public static final int KEY_NUMPAD1
1 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD2

public static final int KEY_NUMPAD2
2 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD3

public static final int KEY_NUMPAD3
3 key (num pad).

See Also:
Constant Field Values

KEY_NUMPAD0

public static final int KEY_NUMPAD0
0 key (num pad).

See Also:
Constant Field Values

KEY_DECIMAL

public static final int KEY_DECIMAL
. key (num pad).

See Also:
Constant Field Values

KEY_F11

public static final int KEY_F11
F11 key.

See Also:
Constant Field Values

KEY_F12

public static final int KEY_F12
F12 key.

See Also:
Constant Field Values

KEY_F13

public static final int KEY_F13
F13 key.

See Also:
Constant Field Values

KEY_F14

public static final int KEY_F14
F14 key.

See Also:
Constant Field Values

KEY_F15

public static final int KEY_F15
F15 key.

See Also:
Constant Field Values

KEY_KANA

public static final int KEY_KANA
kana key (Japanese).

See Also:
Constant Field Values

KEY_CONVERT

public static final int KEY_CONVERT
convert key (Japanese).

See Also:
Constant Field Values

KEY_NOCONVERT

public static final int KEY_NOCONVERT
noconvert key (Japanese).

See Also:
Constant Field Values

KEY_YEN

public static final int KEY_YEN
yen key (Japanese).

See Also:
Constant Field Values

KEY_NUMPADEQUALS

public static final int KEY_NUMPADEQUALS
= on num pad (NEC PC98).

See Also:
Constant Field Values

KEY_CIRCUMFLEX

public static final int KEY_CIRCUMFLEX
circum flex key (Japanese).

See Also:
Constant Field Values

KEY_AT

public static final int KEY_AT
See Also:
Constant Field Values

KEY_COLON

public static final int KEY_COLON
: key (NEC PC98)

See Also:
Constant Field Values

KEY_UNDERLINE

public static final int KEY_UNDERLINE
_ key (NEC PC98).

See Also:
Constant Field Values

KEY_KANJI

public static final int KEY_KANJI
kanji key (Japanese).

See Also:
Constant Field Values

KEY_STOP

public static final int KEY_STOP
stop key (NEC PC98).

See Also:
Constant Field Values

KEY_AX

public static final int KEY_AX
ax key (Japanese).

See Also:
Constant Field Values

KEY_UNLABELED

public static final int KEY_UNLABELED
(J3100).

See Also:
Constant Field Values

KEY_NUMPADENTER

public static final int KEY_NUMPADENTER
Enter key (num pad).

See Also:
Constant Field Values

KEY_RCONTROL

public static final int KEY_RCONTROL
right control key.

See Also:
Constant Field Values

KEY_NUMPADCOMMA

public static final int KEY_NUMPADCOMMA
, key on num pad (NEC PC98).

See Also:
Constant Field Values

KEY_DIVIDE

public static final int KEY_DIVIDE
/ key (num pad).

See Also:
Constant Field Values

KEY_SYSRQ

public static final int KEY_SYSRQ
SysRq key.

See Also:
Constant Field Values

KEY_RMENU

public static final int KEY_RMENU
right alt key.

See Also:
Constant Field Values

KEY_PAUSE

public static final int KEY_PAUSE
pause key.

See Also:
Constant Field Values

KEY_HOME

public static final int KEY_HOME
home key.

See Also:
Constant Field Values

KEY_UP

public static final int KEY_UP
up arrow key.

See Also:
Constant Field Values

KEY_PRIOR

public static final int KEY_PRIOR
PgUp key.

See Also:
Constant Field Values

KEY_PGUP

public static final int KEY_PGUP
PgUp key.

See Also:
Constant Field Values

KEY_LEFT

public static final int KEY_LEFT
left arrow key.

See Also:
Constant Field Values

KEY_RIGHT

public static final int KEY_RIGHT
right arrow key.

See Also:
Constant Field Values

KEY_END

public static final int KEY_END
end key.

See Also:
Constant Field Values

KEY_DOWN

public static final int KEY_DOWN
down arrow key.

See Also:
Constant Field Values

KEY_NEXT

public static final int KEY_NEXT
PgDn key.

See Also:
Constant Field Values

KEY_PGDN

public static final int KEY_PGDN
PgDn key.

See Also:
Constant Field Values

KEY_INSERT

public static final int KEY_INSERT
insert key.

See Also:
Constant Field Values

KEY_DELETE

public static final int KEY_DELETE
delete key.

See Also:
Constant Field Values

KEY_LWIN

public static final int KEY_LWIN
left windows key.

See Also:
Constant Field Values

KEY_RWIN

public static final int KEY_RWIN
right windows key.

See Also:
Constant Field Values

KEY_APPS

public static final int KEY_APPS
menu key.

See Also:
Constant Field Values

KEY_POWER

public static final int KEY_POWER
power key.

See Also:
Constant Field Values

KEY_SLEEP

public static final int KEY_SLEEP
sleep key.

See Also:
Constant Field Values
Method Detail

isKeyDown

public boolean isKeyDown(int key)
isKeyDown returns true if the given key is pressed. False otherwise.

Parameters:
key - the keycode to check for.
Returns:
true if the key is pressed, false otherwise.

isCreated

public boolean isCreated()
isCreated returns true if the key class is initialized.

Returns:
true if it is initialized and ready for use, false otherwise.

getKeyName

public java.lang.String getKeyName(int key)
getKeyName returns the string prepresentation of a key code.

Parameters:
key - the key code to check.
Returns:
the string representation of a key code.

getKeyIndex

public int getKeyIndex(java.lang.String name)
The reverse of getKeyName, returns the value of the key given the name

Parameters:
name -
Returns:

update

public void update()
update updates the current state of the keyboard, holding information about what keys are pressed.


destroy

public void destroy()
destroy frees the keyboard for use by other applications.


next

public boolean next()
iterates to the next event when using event based keyboard

Returns:
true if there are more events in the list

state

public boolean state()
The key pressed state of the current key event

Returns:
returns true if the key is down

key

public int key()
the key value of the current event

Returns:
gives the value of the key for the event

keyChar

public char keyChar()
the char value of the current event

Returns:
gives the char value of the key for the event