public void handleInput() { // handle movement keys if (!editorMode) { if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { player.move(Player.LEFT); } else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { player.move(Player.RIGHT); } else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { player.move(Player.DOWN); } else if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { player.move(Player.UP); } } else { if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { editorTag.getPosition().add(new Coord(-1f, 0f)); } else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { editorTag.getPosition().add(new Coord(1f, 0f)); } else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { editorTag.getPosition().add(new Coord(0f, -1f)); } else if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { editorTag.getPosition().add(new Coord(0f, 1f)); } } // handle other keys while (Keyboard.next()) { char k = Keyboard.getEventCharacter(); // the ` key toggles the console if (k == '`') { if (console.isEnabled()) { console.disable(); } else { console.enable(); } } else if (console.isEnabled()) { if (Keyboard.getEventKeyState()) { console.nextChar(k); } } // editor specific commands if (editorMode && !console.isEnabled()) { if (k == ' ') { map.setTile(editorTag.getPosition(), currentEditorTile); } else if (k == 'n') { currentEditorTile = (currentEditorTile + 1) % map.getNumTypes(); } } } }