com.jme.input.lwjgl
Class LWJGLKeyInput

java.lang.Object
  extended bycom.jme.input.lwjgl.LWJGLKeyInput
All Implemented Interfaces:
KeyInput

public class LWJGLKeyInput
extends java.lang.Object
implements KeyInput

LWJGLKeyInput uses the LWJGL API to access the keyboard. The LWJGL make use of the native interface for the keyboard.

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

Field Summary
 
Fields inherited from interface com.jme.input.KeyInput
KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, KEY_ADD, KEY_APOSTROPHE, KEY_APPS, KEY_AT, KEY_AX, KEY_B, KEY_BACK, KEY_BACKSLASH, KEY_C, KEY_CAPITAL, KEY_CIRCUMFLEX, KEY_COLON, KEY_COMMA, KEY_CONVERT, KEY_D, KEY_DECIMAL, KEY_DELETE, KEY_DIVIDE, KEY_DOWN, KEY_E, KEY_END, KEY_EQUALS, KEY_ESCAPE, KEY_F, KEY_F1, KEY_F10, KEY_F11, KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_G, KEY_GRAVE, KEY_H, KEY_HOME, KEY_I, KEY_INSERT, KEY_J, KEY_K, KEY_KANA, KEY_KANJI, KEY_L, KEY_LBRACKET, KEY_LCONTROL, KEY_LEFT, KEY_LMENU, KEY_LSHIFT, KEY_LWIN, KEY_M, KEY_MINUS, KEY_MULTIPLY, KEY_N, KEY_NEXT, KEY_NOCONVERT, KEY_NUMLOCK, KEY_NUMPAD0, KEY_NUMPAD1, KEY_NUMPAD2, KEY_NUMPAD3, KEY_NUMPAD4, KEY_NUMPAD5, KEY_NUMPAD6, KEY_NUMPAD7, KEY_NUMPAD8, KEY_NUMPAD9, KEY_NUMPADCOMMA, KEY_NUMPADENTER, KEY_NUMPADEQUALS, KEY_O, KEY_P, KEY_PAUSE, KEY_PERIOD, KEY_PGDN, KEY_PGUP, KEY_POWER, KEY_PRIOR, KEY_Q, KEY_R, KEY_RBRACKET, KEY_RCONTROL, KEY_RETURN, KEY_RIGHT, KEY_RMENU, KEY_RSHIFT, KEY_RWIN, KEY_S, KEY_SCROLL, KEY_SEMICOLON, KEY_SLASH, KEY_SLEEP, KEY_SPACE, KEY_STOP, KEY_SUBTRACT, KEY_SYSRQ, KEY_T, KEY_TAB, KEY_U, KEY_UNDERLINE, KEY_UNLABELED, KEY_UP, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_YEN, KEY_Z
 
Constructor Summary
LWJGLKeyInput()
          Constructor instantiates a new LWJGLKeyInput object.
 
Method Summary
 void destroy()
          destroy cleans up the keyboard for use by other programs.
 int getKeyIndex(java.lang.String name)
          getKeyIndex returns the value of the key name
 java.lang.String getKeyName(int key)
          getKeyName returns the string representation of the key code.
 boolean isCreated()
          isCreated returns true if the keyboard has been initialized false otherwise.
 boolean isKeyDown(int key)
          isKeyDown returns true if the provided key code is pressed, false otherwise.
 int key()
          the key value of the current event
 char keyChar()
          the char value of the current event
 boolean next()
          iterates to next key event after poll is called
 boolean state()
          returns true if the current event is a keydown event
 void update()
          update updates the keyboard buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWJGLKeyInput

public LWJGLKeyInput()
Constructor instantiates a new LWJGLKeyInput object. During instantiation, the keyboard is created.

Method Detail

isKeyDown

public boolean isKeyDown(int key)
isKeyDown returns true if the provided key code is pressed, false otherwise.

Specified by:
isKeyDown in interface KeyInput
Parameters:
key - the keycode to check for.
Returns:
true if the key is pressed, false otherwise.
See Also:
KeyInput.isKeyDown(int)

isCreated

public boolean isCreated()
isCreated returns true if the keyboard has been initialized false otherwise.

Specified by:
isCreated in interface KeyInput
Returns:
true if it is initialized and ready for use, false otherwise.
See Also:
KeyInput.isCreated()

getKeyName

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

Specified by:
getKeyName in interface KeyInput
Parameters:
key - the key code to check.
Returns:
the string representation of a key code.
See Also:
KeyInput.getKeyName(int)

getKeyIndex

public int getKeyIndex(java.lang.String name)
getKeyIndex returns the value of the key name

Specified by:
getKeyIndex in interface KeyInput
Parameters:
name - the name of the key
Returns:
the value of the key

update

public void update()
update updates the keyboard buffer.

Specified by:
update in interface KeyInput
See Also:
KeyInput.update()

destroy

public void destroy()
destroy cleans up the keyboard for use by other programs.

Specified by:
destroy in interface KeyInput
See Also:
KeyInput.destroy()

next

public boolean next()
iterates to next key event after poll is called

Specified by:
next in interface KeyInput
Returns:
true if there are more events in the list

state

public boolean state()
returns true if the current event is a keydown event

Specified by:
state in interface KeyInput
Returns:
returns true if the key is down

key

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

Specified by:
key in interface KeyInput
Returns:
gives the value of the key for the event

keyChar

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

Specified by:
keyChar in interface KeyInput
Returns:
gives the char value of the key for the event