本文整理汇总了Java中org.newdawn.slick.Input类的典型用法代码示例。如果您正苦于以下问题:Java Input类的具体用法?Java Input怎么用?Java Input使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Input类属于org.newdawn.slick包,在下文中一共展示了Input类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @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_N) {
curTest++;
curTest %= NUMTESTS;
}
if(key == Input.KEY_C) {
colorIndex++;
colorIndex %= 4;
setColors();
}
if(key == Input.KEY_T) {
hideOverlay = !hideOverlay;
}
}
示例2: MouseOverArea
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* Create a new mouse over area
*
* @param container
* The container displaying the mouse over area
* @param image
* The normalImage to display
* @param shape
* The shape defining the area of the mouse sensitive zone
*/
public MouseOverArea(GUIContext container, Image image, Shape shape) {
super(container);
area = shape;
normalImage = image;
currentImage = image;
mouseOverImage = image;
mouseDownImage = image;
currentColor = normalColor;
state = NORMAL;
Input input = container.getInput();
over = area.contains(input.getMouseX(), input.getMouseY());
mouseDown = input.isMouseButtonDown(0);
updateImage();
}
示例3: keyReleased
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#keyReleased(int, char)
*/
public void keyReleased(int key, char c) {
if (key == Input.KEY_Q) {
scaleUp = false;
}
if (key == Input.KEY_A) {
scaleDown = false;
}
if( key == Input.KEY_LEFT) {
moveLeft = false;
}
if( key == Input.KEY_UP ) {
moveUp = false;
}
if( key == Input.KEY_RIGHT ) {
moveRight = false;
}
if( key == Input.KEY_DOWN ) {
moveDown = false;
}
}
示例4: keyReleased
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
*/
public void keyReleased(int key, char c) {
if (key == Input.KEY_DOWN) {
selected++;
if (selected >= options.length) {
selected = 0;
}
}
if (key == Input.KEY_UP) {
selected--;
if (selected < 0) {
selected = options.length - 1;
}
}
if (key == Input.KEY_1) {
game.enterState(TestState1.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
if (key == Input.KEY_2) {
game.enterState(TestState2.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
}
示例5: update
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
*/
public void update(GameContainer container, int delta) {
lshift = container.getInput().isKeyDown(Input.KEY_LSHIFT);
rshift = container.getInput().isKeyDown(Input.KEY_RSHIFT);
space = container.getInput().isKeyDown(Input.KEY_SPACE);
if (controllerLeft[0]) {
x -= delta * 0.1f;
}
if (controllerRight[0]) {
x += delta * 0.1f;
}
if (controllerUp[0]) {
y -= delta * 0.1f;
}
if (controllerDown[0]) {
y += delta * 0.1f;
}
}
示例6: update
import org.newdawn.slick.Input; //导入依赖的package包/类
@Override
public void update(GameContainer gc, StateBasedGame sbg, int i) throws SlickException {
if (shouldToggleFullscreen) {
shouldToggleFullscreen = false;
boolean fs = !gc.isFullscreen();
AppGameContainer agc = (AppGameContainer)gc;
agc.setDisplayMode(fs ? agc.getScreenWidth() : Application.DISPLAY_WIDTH,
fs ? agc.getScreenHeight() : Application.DISPLAY_HEIGHT, fs);
}
if (gc.getInput().isKeyPressed(Input.KEY_ENTER)) {
click.play(1.0f, CLICK_VOLUME);
mainMenu.fade(1000, 0.0f, true);
sbg.enterState(Application.GAME, new FadeOutTransition(Color.black, 1000), new EmptyTransition());
}
if (gc.getInput().isKeyPressed(Input.KEY_C)) {
sbg.enterState(Application.CREDITS);
}
}
示例7: update
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
*/
public void update(GameContainer container, int delta) throws SlickException {
ang += delta * 0.1f;
if (container.getInput().isKeyDown(Input.KEY_LEFT)) {
x -= delta * 0.1f;
}
if (container.getInput().isKeyDown(Input.KEY_RIGHT)) {
x += delta * 0.1f;
}
if (container.getInput().isKeyDown(Input.KEY_UP)) {
y -= delta * 0.1f;
}
if (container.getInput().isKeyDown(Input.KEY_DOWN)) {
y += delta * 0.1f;
}
}
示例8: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @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_F2) {
app.setDefaultMouseCursor();
}
if (key == Input.KEY_F1) {
if (app != null) {
try {
app.setDisplayMode(640,480,false);
} catch (SlickException e) {
Log.error(e);
}
}
}
}
示例9: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @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;
}
}
示例10: keyReleased
import org.newdawn.slick.Input; //导入依赖的package包/类
@Override
public void keyReleased(int key, char c) {
if(key == Input.KEY_GRAVE) {
console.setPauseTime(time);
consoleOpen = !consoleOpen;
}
else if((key == Input.KEY_P) && !consoleOpen) {
if(!paused) MusicPlayer.getInstance().pause();
else MusicPlayer.getInstance().resume();
paused = !paused;
}
else {
if(consoleOpen) {
console.keyReleased(key, c);
} else {
Globals.inputs.remove(key);
Globals.released.add(key);
}
}
}
示例11: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @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;
}
}
示例12: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @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;
}
}
示例13: update
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
*/
public void update(GameContainer container, int delta) throws SlickException {
fire.update(delta);
if (container.getInput().isKeyPressed(Input.KEY_P)) {
writeTo("ImageOutTest.png");
}
if (container.getInput().isKeyPressed(Input.KEY_J)) {
writeTo("ImageOutTest.jpg");
}
if (container.getInput().isKeyPressed(Input.KEY_T)) {
writeTo("ImageOutTest.tga");
}
}
示例14: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @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;
}
}
}
示例15: keyPressed
import org.newdawn.slick.Input; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#keyPressed(int, char)
*/
public void keyPressed(int key, char c) {
currentGame.keyPressed(key, c);
if (key == Input.KEY_ENTER) {
nextGame();
}
}