\r
package com.badlogic.gdx.twl.renderer;\r
\r
+import com.badlogic.gdx.Input;\r
import com.badlogic.gdx.InputProcessor;\r
-import com.badlogic.gdx.backends.desktop.LwjglInput;\r
\r
+import de.matthiasmann.twl.Event;\r
import de.matthiasmann.twl.GUI;\r
\r
/**\r
}\r
\r
public boolean keyDown (int keycode) {\r
- keycode = LwjglInput.getKeyCodeReverse(keycode);\r
+ keycode = getTwlKeyCode(keycode);\r
return gui.handleKey(keycode, (char)0, true);\r
}\r
\r
public boolean keyUp (int keycode) {\r
- keycode = LwjglInput.getKeyCodeReverse(keycode);\r
+ keycode = getTwlKeyCode(keycode);\r
return gui.handleKey(keycode, (char)0, false);\r
}\r
\r
public boolean touchDragged (int x, int y, int pointer) {\r
return gui.handleMouse(x, y, -1, true);\r
}\r
+\r
+ static public int getTwlKeyCode (int gdxKeyCode) {\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_0) return Event.KEY_0;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_1) return Event.KEY_1;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_2) return Event.KEY_2;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_3) return Event.KEY_3;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_4) return Event.KEY_4;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_5) return Event.KEY_5;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_6) return Event.KEY_6;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_7) return Event.KEY_7;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_8) return Event.KEY_8;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_9) return Event.KEY_9;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_A) return Event.KEY_A;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_B) return Event.KEY_B;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_C) return Event.KEY_C;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_D) return Event.KEY_D;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_E) return Event.KEY_E;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_F) return Event.KEY_F;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_G) return Event.KEY_G;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_H) return Event.KEY_H;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_I) return Event.KEY_I;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_J) return Event.KEY_J;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_K) return Event.KEY_K;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_L) return Event.KEY_L;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_M) return Event.KEY_M;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_N) return Event.KEY_N;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_O) return Event.KEY_O;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_P) return Event.KEY_P;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_Q) return Event.KEY_Q;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_R) return Event.KEY_R;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_S) return Event.KEY_S;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_T) return Event.KEY_T;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_U) return Event.KEY_U;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_V) return Event.KEY_V;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_W) return Event.KEY_W;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_X) return Event.KEY_X;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_Y) return Event.KEY_Y;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_Z) return Event.KEY_Z;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_ALT_LEFT) return Event.KEY_LMETA;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_ALT_RIGHT) return Event.KEY_RMETA;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_BACKSLASH) return Event.KEY_BACKSLASH;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_COMMA) return Event.KEY_COMMA;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_DEL) return Event.KEY_DELETE;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_DPAD_LEFT) return Event.KEY_LEFT;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_DPAD_RIGHT) return Event.KEY_RIGHT;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_DPAD_UP) return Event.KEY_UP;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_DPAD_DOWN) return Event.KEY_DOWN;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_ENTER) return Event.KEY_RETURN;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_HOME) return Event.KEY_HOME;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_MINUS) return Event.KEY_MINUS;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_PERIOD) return Event.KEY_PERIOD;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_PLUS) return Event.KEY_ADD;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_SEMICOLON) return Event.KEY_SEMICOLON;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_SHIFT_LEFT) return Event.KEY_LSHIFT;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_SHIFT_RIGHT) return Event.KEY_RSHIFT;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_SLASH) return Event.KEY_SLASH;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_SPACE) return Event.KEY_SPACE;\r
+ if (gdxKeyCode == Input.Keys.KEYCODE_TAB) return Event.KEY_TAB;\r
+ return Event.KEY_NONE;\r
+ }\r
}\r