com.badlogic.gdx.Input.Keys Java Examples
The following examples show how to use
com.badlogic.gdx.Input.Keys.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #2
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #3
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #4
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #5
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #6
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #7
Source File: BattleScreenInputProcessor.java From Norii with Apache License 2.0 | 6 votes |
@Override public boolean keyDown(int keycode) { switch (keycode) { case Keys.LEFT: setLeftMove(true); break; case Keys.RIGHT: setRightMove(true); break; case Keys.UP: setUpMove(true); break; case Keys.DOWN: setDownMove(true); break; default: break; } return true; }
Example #8
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #9
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #10
Source File: AddStateDialog.java From gdx-soundboard with MIT License | 6 votes |
public AddStateDialog(final Stage stage, final Skin skin, final MusicEventManager eventManager) { super("Add State", skin); this.stage = stage; this.skin = skin; this.eventManager = eventManager; Table content = this.getContentTable(); Label label = new Label("State name", skin); label.setAlignment(Align.left); content.add(label).left().fillX().expandX().row(); eventName = new TextField("", skin); content.add(eventName).right().fillX().expandX().row(); Table buttons = this.getButtonTable(); buttons.defaults().fillX().expandX(); this.button("Ok", true); this.button("Cancel", false); key(Keys.ENTER, true); key(Keys.ESCAPE, false); }
Example #11
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #12
Source File: EditorLogger.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public static void setConsole(Console console) { EditorLogger.console = console; EditorLogger.console.setDisplayKeyID(Keys.F1); console.setMaxEntries(1000); final Stage s = (Stage) console.getInputProcessor(); final Actor actor = s.getActors().items[0]; actor.addListener(new InputListener() { @Override public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) { if (toActor == null) { s.setScrollFocus(null); } } }); console.setCommandExecutor(new EditorCommandExecutor()); }
Example #13
Source File: AIShortcuts.java From seventh with GNU General Public License v2.0 | 6 votes |
/** * */ public AIShortcuts(KeyMap keyMap) { this.keyMap = keyMap; // TODO: Allow shortcuts to be configurable this.commands = new ArrayList<AIShortcut>(); commands.add(new FollowMeAIShortcut(Keys.NUM_1)); commands.add(new SurpressFireAIShortcut(Keys.NUM_2)); commands.add(new MoveToAIShortcut(Keys.NUM_3)); commands.add(new TakeCoverAIShortcut(Keys.NUM_4)); commands.add(new DefendLeaderAIShortcut(Keys.NUM_5)); commands.add(new PlantBombAIShortcut(Keys.NUM_6)); commands.add(new DefuseBombAIShortcut(Keys.NUM_7)); commands.add(new DefendPlantedBombAIShortcut(Keys.NUM_8)); this.shortcuts = new int[commands.size()]; this.isDown = new boolean[this.shortcuts.length]; for(int i = 0; i < this.shortcuts.length; i++) { this.shortcuts[i] = commands.get(i).getShortcutKey(); } this.groupCommands = new ArrayList<>(); this.groupCommands.add(new RegroupAIGroupCommand(Keys.F1)); this.groupCommands.add(new DefendAIGroupCommand(Keys.F2)); this.isGroupDown = new boolean[this.groupCommands.size()]; }
Example #14
Source File: InstallationTable.java From skin-composer with MIT License | 6 votes |
private void showQuitDialog() { pauseInstall = true; var dialog = new Dialog("", getSkin()) { @Override protected void result(Object object) { pauseInstall = false; if ((Boolean) object) { Core.transition(InstallationTable.this, new MenuTable(getSkin(), getStage()), 0.0f, .5f); continueInstall = false; } } }; dialog.getContentTable().pad(10.0f); dialog.getButtonTable().pad(10.0f); dialog.text("Quit installation?"); dialog.button("Quit", true).button("Install", false); dialog.key(Keys.ENTER, true).key(Keys.ESCAPE, false); dialog.show(getStage()); }
Example #15
Source File: GuiRenderer.java From Cubes with MIT License | 6 votes |
@Override public boolean keyDown(int keycode) { if (functionKeys(keycode)) return true; if (keycode == blocksMenu) { toggleInventory(); return true; } int selected = -1; if (keycode == Keys.NUM_1) selected = 0; if (keycode == Keys.NUM_2) selected = 1; if (keycode == Keys.NUM_3) selected = 2; if (keycode == Keys.NUM_4) selected = 3; if (keycode == Keys.NUM_5) selected = 4; if (keycode == Keys.NUM_6) selected = 5; if (keycode == Keys.NUM_7) selected = 6; if (keycode == Keys.NUM_8) selected = 7; if (keycode == Keys.NUM_9) selected = 8; if (selected != -1) { Cubes.getClient().player.getInventory().hotbarSelected = selected; Cubes.getClient().player.getInventory().sync(); return true; } return false; }
Example #16
Source File: DialogFonts.java From skin-composer with MIT License | 6 votes |
private void showAddFontSizeError(String name) { Dialog dialog = new Dialog("", getSkin(), "bg"); dialog.getContentTable().defaults().pad(10.0f); Label label = new Label("Error adding font...", getSkin(), "title"); dialog.getContentTable().add(label); dialog.getContentTable().row(); dialog.text("Unable to add font \"" + name + "\". Ensure image dimensions\nare less than max texture dimensions (" + maxTextureWidth + "x" + maxTextureHeight + ").\nSee Project > Settings > Texture Packer Settings."); dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f); dialog.button("Ok"); dialog.key(Keys.ENTER, null).key(Keys.ESCAPE, null); dialog.show(getStage()); }
Example #17
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #18
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #19
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #20
Source File: OnBackPressedLmlAttribute.java From gdx-vfx with Apache License 2.0 | 6 votes |
@Override public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) { final ActorConsumer<?, Actor> action = parser.parseAction(rawAttributeData, actor); if (action == null) { parser.throwError("Could not find action for: " + rawAttributeData + " with actor: " + actor); } actor.addListener(new InputListener() { @Override public boolean keyDown(InputEvent event, int keycode) { if (keycode == Keys.BACK || keycode == Keys.ESCAPE) { action.consume(actor); return true; } return false; } }); }
Example #21
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #22
Source File: ChaseCam.java From ud406 with MIT License | 6 votes |
public void update(float delta) { if (Gdx.input.isKeyJustPressed(Keys.SPACE)) { following = !following; } if (following) { camera.position.x = target.getPosition().x; camera.position.y = target.getPosition().y; } else { if (Gdx.input.isKeyPressed(Keys.A)) { camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.D)) { camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.W)) { camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED; } if (Gdx.input.isKeyPressed(Keys.S)) { camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED; } } }
Example #23
Source File: HelpScreen.java From FruitCatcher with Apache License 2.0 | 5 votes |
@Override public boolean keyDown(int keycode) { if(keycode == Keys.BACK){ game.gotoMenuScreen(); } else if (keycode == Keys.UP && startLine > 0) { startLine--; } else if (keycode == Keys.DOWN && startLine < lastLineIndex) { startLine++; } return true; }
Example #24
Source File: GigaGal.java From ud406 with MIT License | 5 votes |
public void update(float delta) { lastFramePosition.set(position); velocity.y -= Constants.GRAVITY; position.mulAdd(velocity, delta); if (jumpState != JumpState.JUMPING) { jumpState = JumpState.FALLING; if (position.y - Constants.GIGAGAL_EYE_HEIGHT < 0) { jumpState = JumpState.GROUNDED; position.y = Constants.GIGAGAL_EYE_HEIGHT; velocity.y = 0; } } if (Gdx.input.isKeyPressed(Keys.LEFT)) { moveLeft(delta); } else if (Gdx.input.isKeyPressed(Keys.RIGHT)) { moveRight(delta); } if (Gdx.input.isKeyPressed(Keys.Z)) { switch (jumpState) { case GROUNDED: startJump(); break; case JUMPING: continueJump(); } } else { endJump(); } }
Example #25
Source File: NoiseVisualizationScreen.java From TerraLegion with MIT License | 5 votes |
public void update() { camera.update(); if (Gdx.input.isKeyPressed(Keys.A)) { camera.setPosition(camera.getPos().x - 4, camera.getPos().y); } if (Gdx.input.isKeyPressed(Keys.D)) { camera.setPosition(camera.getPos().x + 4, camera.getPos().y); } if (Gdx.input.isKeyPressed(Keys.W)) { camera.setPosition(camera.getPos().x, camera.getPos().y + 4); } if (Gdx.input.isKeyPressed(Keys.S)) { camera.setPosition(camera.getPos().x, camera.getPos().y - 4); } }
Example #26
Source File: GameScreen.java From TerraLegion with MIT License | 5 votes |
public void update() { camera.update(); gameHud.update(camera); if (Gdx.input.isKeyJustPressed(Keys.I)) { System.out.println("Saving"); WorldIO.saveWorld(world); } world.update(camera); }
Example #27
Source File: DiceTutorial.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
public static Array<TutorialTask> finalBossTasks() { return tasks( new WaitPreStart(), new PauseRoundController(), new ScrollTo("boss"), new ApplyAbility("boss", "invulnerability"), new ApplyAbility("boss", "boss-protection"), new RestrictKeyPresses(Keys.ESCAPE, Keys.MENU, Keys.BACK), new ShowTutorialMessage("tutorial-boss-intro", true, true), new ForceClickStage(), new HideTutorialMessage(), new AllowKeyPresses(Keys.ESCAPE, Keys.MENU, Keys.BACK), new ResumeRoundController(), new WaitAllStepDetectorsActivate(), new WaitPreNextTurnStart(), new PauseRoundController(), new ScrollTo("boss"), new RemoveEffectOfGroup("boss", "invulnerability"), new RestrictKeyPresses(Keys.ESCAPE, Keys.MENU, Keys.BACK), new Delay(AddEffectVisualizer.DURATION), new ShowTutorialMessage("tutorial-boss-vulnerability", true, true), new ForceClickStage(), new HideTutorialMessage(), new AllowKeyPresses(Keys.ESCAPE, Keys.MENU, Keys.BACK), new ResumeRoundController(), new WaitEndGame(true), new WaitSetAppState("app", GameMapState.class), new ShowWindowTask<String>(new TutorialMessageWindow("ending-pic", 28, 85), "tutorial-final-ending") ); }
Example #28
Source File: BouncingBall.java From ud405 with MIT License | 5 votes |
@Override public boolean keyDown(int keycode) { if (keycode == Keys.SPACE) { randomKick(); } if (keycode == Keys.R) { init(); } return true; }
Example #29
Source File: MenuScreen.java From FruitCatcher with Apache License 2.0 | 5 votes |
@Override public boolean keyDown(int keycode) { if(keycode == Keys.BACK){ Gdx.app.exit(); return true; } return false; }
Example #30
Source File: PlayerInput.java From xibalba with MIT License | 5 votes |
@Override public boolean keyUp(int keycode) { keyHeld = -1; switch (keycode) { case Keys.SHIFT_LEFT: case Keys.SHIFT_RIGHT: holdingShift = false; break; default: } return true; }