Java Code Examples for org.newdawn.slick.Input#KEY_SPACE
The following examples show how to use
org.newdawn.slick.Input#KEY_SPACE .
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: SoundPositionTest.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) { if (music.playing()) { music.pause(); } else { music.resume(); } } if (key == Input.KEY_RIGHT) { music.setPosition(music.getPosition()+5); } }
Example 2
Source File: TrueTypeFontPerformanceTest.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) { visible = !visible; } }
Example 3
Source File: FontPerformanceTest.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) { visible = !visible; } }
Example 4
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 5
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 6
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 7
Source File: ImageTest.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) { if (image == gif) { image = tga; } else { image = gif; } } }
Example 8
Source File: KeyRepeatTest.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) { count++; if (key == Input.KEY_SPACE) { if (input.isKeyRepeatEnabled()) { input.disableKeyRepeat(); } else { input.enableKeyRepeat(300,100); } } }
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: CanvasContainerTest.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) { if (image == gif) { image = tga; } else { image = gif; } } }
Example 11
Source File: AnimationTest.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_SPACE) { limited.restart(); } }
Example 12
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; } }
Example 13
Source File: SoundURLTest.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); } if (key == Input.KEY_SPACE) { sound.play(); } if (key == Input.KEY_B) { burp.play(); } if (key == Input.KEY_A) { sound.playAt(-1, 0, 0); } if (key == Input.KEY_L) { sound.playAt(1, 0, 0); } if (key == Input.KEY_RETURN) { charlie.play(1.0f,1.0f); } if (key == Input.KEY_P) { if (music.playing()) { music.pause(); } else { music.resume(); } } if (key == Input.KEY_C) { music.stop(); if (music == musica) { music = musicb; } else { music = musica; } music.loop(); } if (key == Input.KEY_E) { if (engine.playing()) { engine.stop(); } else { engine.loop(); } } if (c == '+') { volume += 1; setVolume(); } if (c == '-') { volume -= 1; setVolume(); } }