本文整理汇总了Java中org.newdawn.slick.KeyListener类的典型用法代码示例。如果您正苦于以下问题:Java KeyListener类的具体用法?Java KeyListener怎么用?Java KeyListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyListener类属于org.newdawn.slick包,在下文中一共展示了KeyListener类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inputEnded
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
@Override
public void inputEnded(){
super.inputEnded();
for(KeyListener listener : keyListeners){
listener.inputEnded();
}
}
示例2: inputStarted
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
@Override
public void inputStarted(){
super.inputStarted();
for(KeyListener listener : keyListeners){
listener.inputStarted();
}
}
示例3: keyReleased
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
@Override
public void keyReleased(int key, char c){
super.keyReleased(key, c);
for(KeyListener listener : keyListeners){
listener.keyReleased(key, c);
}
}
示例4: setInput
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
@Override
public void setInput(Input input){
super.setInput(input);
for(KeyListener listener : keyListeners){
listener.setInput(input);
}
}
示例5: keyPressed
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
@Override
public void keyPressed(int key, char c){
super.keyPressed(key, c);
listen: {
if(key == Input.KEY_ESCAPE){
for(TSMenu menu : getMenus()){
if(menu.isVisible()){
menu.close();
break listen;
}
}
if(ge.isActive()){
ge.paused = true;
setForegroundEngine(me);
break listen;
}
else if(mge.isActive()){
mge.paused = true;
setForegroundEngine(me);
break listen;
}
else if(me.isActive()){
if(Main.debug){
System.out.println("Exiting system");
}
System.exit(0);
}
}
if(key == Input.KEY_SPACE){
if(me.isActive()){
if(hasInputFocus()){
ge.setArcadeMode(true);
startGame();
}
}
break listen;
}
if(key == Input.KEY_ENTER){
if(me.isActive()){
if(hasInputFocus()){
ge.setArcadeMode(false);
startGame();
}
}
break listen;
}
if(getHighScoreMenu().hasInputFocus()){
if(key == Input.KEY_RIGHT){
getHighScoreMenu().setIndex(
getHighScoreMenu().getIndex() + 10);
break listen;
}
if(key == Input.KEY_LEFT){
getHighScoreMenu().setIndex(
getHighScoreMenu().getIndex() - 10);
break listen;
}
}
if(getStatsMenu().hasInputFocus()){
getStatsMenu().pushChar(key, c);
break listen;
}
if(getMultiplayerMenu().hasInputFocus()){
getMultiplayerMenu().pushChar(key, c);
break listen;
}
}
for(KeyListener listener : keyListeners){
listener.keyPressed(key, c);
}
}
示例6: addKeyListener
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
public void addKeyListener(KeyListener listener){
keyListeners.add(listener);
}
示例7: removeKeyListener
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
public void removeKeyListener(KeyListener listener){
keyListeners.remove(listener);
}
示例8: getKeyListeners
import org.newdawn.slick.KeyListener; //导入依赖的package包/类
public Set<KeyListener> getKeyListeners(){
return keyListeners;
}