Java Code Examples for org.newdawn.slick.Input#KEY_ESCAPE
The following examples show how to use
org.newdawn.slick.Input#KEY_ESCAPE .
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: TransformTest2.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } if (key == Input.KEY_Q) { scaleUp = true; } if (key == Input.KEY_A) { scaleDown = true; } if( key == Input.KEY_LEFT) { moveLeft = true; } if( key == Input.KEY_UP ) { moveUp = true; } if( key == Input.KEY_RIGHT ) { moveRight = true; } if( key == Input.KEY_DOWN ) { moveDown = true; } }
Example 2
Source File: UserSelectOverlay.java From opsu with GNU General Public License v3.0 | 5 votes |
@Override public void keyPressed(int key, char c) { if (!active) return; consumeEvent(); // esc: close overlay or clear text if (key == Input.KEY_ESCAPE) { if (state == State.CREATE_USER && !textField.getText().isEmpty()) { textField.setText(""); newUser.setName(""); } else listener.close(false); return; } if (UI.globalKeyPressed(key)) return; // key entry if (state == State.CREATE_USER) { // enter: create user if (key == Input.KEY_ENTER) { createNewUser(); return; } textField.setFocus(true); textField.keyPressed(key, c); textField.setFocus(false); newUser.setName(textField.getText()); if (c > 255 && Character.isLetterOrDigit(c)) { Fonts.loadGlyphs(Fonts.LARGE, c); Fonts.loadGlyphs(Fonts.MEDIUM, c); } } }
Example 3
Source File: FontTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } if (key == Input.KEY_SPACE) { try { container.setDisplayMode(640, 480, false); } catch (SlickException e) { Log.error(e); } } }
Example 4
Source File: Splash.java From opsu with GNU General Public License v3.0 | 5 votes |
@Override public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { // close program if (++escapeCount >= 3) container.exit(); // stop parsing beatmaps by sending interrupt to BeatmapParser else if (thread != null) thread.interrupt(); } }
Example 5
Source File: DuplicateEmitterTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { container.exit(); } if (key == Input.KEY_K) { explosionEmitter.wrapUp(); } }
Example 6
Source File: FlashTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_SPACE) { flash = !flash; } if (key == Input.KEY_ESCAPE) { container.exit(); } }
Example 7
Source File: ParticleTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } if (key == Input.KEY_SPACE) { mode = ParticleSystem.BLEND_ADDITIVE == mode ? ParticleSystem.BLEND_COMBINE : ParticleSystem.BLEND_ADDITIVE; system.setBlendingMode(mode); } }
Example 8
Source File: TransformTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } if (key == Input.KEY_Q) { scaleUp = true; } if (key == Input.KEY_A) { scaleDown = true; } }
Example 9
Source File: GraphicsTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } if (key == Input.KEY_SPACE) { clip = !clip; } }
Example 10
Source File: GradientImageTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_R) { rotating = !rotating; } if (key == Input.KEY_ESCAPE) { container.exit(); } }
Example 11
Source File: ImageBufferTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } }
Example 12
Source File: GeomTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } }
Example 13
Source File: PackedSheetTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { container.exit(); } }
Example 14
Source File: ImageOutTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { container.exit(); } }
Example 15
Source File: TileMapTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } }
Example 16
Source File: GradientTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { container.exit(); } }
Example 17
Source File: PureFontTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } }
Example 18
Source File: MainMenu.java From opsu with GNU General Public License v3.0 | 4 votes |
@Override public void keyPressed(int key, char c) { if (UI.globalKeyPressed(key)) return; switch (key) { case Input.KEY_ESCAPE: case Input.KEY_Q: ((ButtonMenu) game.getState(Opsu.STATE_BUTTONMENU)).setMenuState(MenuState.EXIT); game.enterState(Opsu.STATE_BUTTONMENU); break; case Input.KEY_P: SoundController.playSound(SoundEffect.MENUHIT); if (logoState == LogoState.DEFAULT || logoState == LogoState.CLOSING) openLogoMenu(); else enterSongMenu(); break; case Input.KEY_D: SoundController.playSound(SoundEffect.MENUHIT); game.enterState(Opsu.STATE_DOWNLOADSMENU, new EasedFadeOutTransition(), new FadeInTransition()); break; case Input.KEY_O: SoundController.playSound(SoundEffect.MENUHIT); if ((logoState == LogoState.DEFAULT || logoState == LogoState.CLOSING) && !(input.isKeyDown(Input.KEY_RCONTROL) || input.isKeyDown(Input.KEY_LCONTROL))) openLogoMenu(); else { showOptionsOverlay = true; optionsOverlayProgress.setTime(0); optionsOverlay.activate(); input.consumeEvent(); // don't let options overlay consume this keypress } break; case Input.KEY_F: Options.toggleFPSCounter(); break; case Input.KEY_Z: previousTrack(); UI.getNotificationManager().sendBarNotification("<< Prev"); break; case Input.KEY_X: if (MusicController.isPlaying()) { lastMeasureProgress = 0f; MusicController.setPosition(0); } else if (!MusicController.isTrackLoading()) MusicController.resume(); UI.getNotificationManager().sendBarNotification("Play"); break; case Input.KEY_C: if (MusicController.isPlaying()) { MusicController.pause(); UI.getNotificationManager().sendBarNotification("Pause"); } else if (!MusicController.isTrackLoading()) { MusicController.resume(); UI.getNotificationManager().sendBarNotification("Unpause"); } break; case Input.KEY_V: nextTrack(true); UI.getNotificationManager().sendBarNotification(">> Next"); break; case Input.KEY_R: nextTrack(true); break; case Input.KEY_UP: UI.changeVolume(1); break; case Input.KEY_DOWN: UI.changeVolume(-1); break; } }
Example 19
Source File: PedigreeTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { container.exit(); } }
Example 20
Source File: DownloadsMenu.java From opsu with GNU General Public License v3.0 | 4 votes |
@Override public void keyPressed(int key, char c) { // block input during beatmap importing if (importThread != null && !(key == Input.KEY_ESCAPE || key == Input.KEY_F12)) return; if (UI.globalKeyPressed(key)) return; switch (key) { case Input.KEY_ESCAPE: if (importThread != null) { // beatmap importing: stop parsing beatmaps by sending interrupt to BeatmapParser importThread.interrupt(); } else if (!search.getText().isEmpty()) { // clear search text search.setText(""); pageDir = Page.RESET; resetSearchTimer(); } else { // return to main menu SoundController.playSound(SoundEffect.MENUBACK); ((MainMenu) game.getState(Opsu.STATE_MAINMENU)).reset(); game.enterState(Opsu.STATE_MAINMENU, new EasedFadeOutTransition(), new FadeInTransition()); } break; case Input.KEY_ENTER: if (!search.getText().isEmpty()) { pageDir = Page.RESET; resetSearchTimer(); } break; case Input.KEY_F5: SoundController.playSound(SoundEffect.MENUCLICK); lastQuery = null; pageDir = Page.CURRENT; if (searchQuery != null) searchQuery.interrupt(); resetSearchTimer(); break; default: // wait for user to finish typing if (Character.isLetterOrDigit(c) || key == Input.KEY_BACK || key == Input.KEY_SPACE) { // load glyphs if (c > 255) Fonts.loadGlyphs(searchFont, c); // reset search timer searchTimer = 0; pageDir = Page.RESET; } break; } }