当前位置: 首页>>代码示例>>Java>>正文


Java Input类代码示例

本文整理汇总了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;
	}

}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:GeomAccuracyTest.java

示例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();
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:28,代码来源:MouseOverArea.java

示例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;
   }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:25,代码来源:TransformTest2.java

示例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));
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:TestState3.java

示例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;
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:22,代码来源:InputTest.java

示例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);
    }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:MainMenu.java

示例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;
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:BigImageTest.java

示例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);
			}
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:GUITest.java

示例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;
   }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:TransformTest2.java

示例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);
		}
	}
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:21,代码来源:GameState.java

示例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;
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:15,代码来源:TransformTest.java

示例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;
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:TrueTypeFontPerformanceTest.java

示例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");
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:17,代码来源:ImageOutTest.java

示例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;
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:ImageTest.java

示例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();
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:TestBox.java


注:本文中的org.newdawn.slick.Input类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。