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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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
/**
 * @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 Project: opsu   File: DownloadsMenu.java    License: GNU General Public License v3.0 4 votes vote down vote up
@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
/**
 * @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();
	}

}