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


Java KeyEvent.isKeyUp方法代码示例

本文整理汇总了Java中br.com.etyllica.core.event.KeyEvent.isKeyUp方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.isKeyUp方法的具体用法?Java KeyEvent.isKeyUp怎么用?Java KeyEvent.isKeyUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在br.com.etyllica.core.event.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.isKeyUp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateKeyboard

import br.com.etyllica.core.event.KeyEvent; //导入方法依赖的package包/类
@Override
public GUIEvent updateKeyboard(KeyEvent event) {

	if(event.isKeyDown(KeyEvent.TSK_UP_ARROW)){
		paddleUP = true;
		paddleDOWN = false;
	}else if(event.isKeyUp(KeyEvent.TSK_UP_ARROW)){
		paddleUP = false;
	}

	if(event.isKeyDown(KeyEvent.TSK_DOWN_ARROW)){
		paddleDOWN = true;
		paddleUP = false;
	}
	else if(event.isKeyUp(KeyEvent.TSK_DOWN_ARROW)){
		paddleDOWN = false;
	}

	return null;
}
 
开发者ID:yuripourre,项目名称:etyllic-pong,代码行数:21,代码来源:PongApplication.java

示例2: updateKeyboard

import br.com.etyllica.core.event.KeyEvent; //导入方法依赖的package包/类
public GUIEvent updateKeyboard(KeyEvent event) {

		if(event.isAnyKeyDown(KeyEvent.TSK_SHIFT_RIGHT, KeyEvent.TSK_SHIFT_LEFT)) {
			shiftPressed = true;
		} else if(event.isAnyKeyUp(KeyEvent.TSK_SHIFT_RIGHT, KeyEvent.TSK_SHIFT_LEFT)) {
			shiftPressed = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_UP_ARROW)) {
			//if(shiftPressed) {
			moveUp = true;
			//} else {
			//moveForward = true;
			//}

		} else if(event.isKeyUp(KeyEvent.TSK_UP_ARROW)) {
			moveUp = false;
			moveForward = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_UP_ARROW)) {
			moveUp = true;
		} else if(event.isKeyUp(KeyEvent.TSK_UP_ARROW)) {
			moveUp = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_DOWN_ARROW)) {
			moveDown = true;
		} else if(event.isKeyUp(KeyEvent.TSK_DOWN_ARROW)) {
			moveDown = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_LEFT_ARROW)) {
			turnLeft = true;
		} else if(event.isKeyUp(KeyEvent.TSK_LEFT_ARROW)) {
			turnLeft = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_RIGHT_ARROW)) {
			turnRight = true;
		} else if(event.isKeyUp(KeyEvent.TSK_RIGHT_ARROW)) {
			turnRight = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_D)) {
			moveRight = true;
		} else if(event.isKeyUp(KeyEvent.TSK_D)) {
			moveRight = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_A)) {
			moveLeft = true;
		} else if(event.isKeyUp(KeyEvent.TSK_A)) {
			moveLeft = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_S)) {
			turnDown = true;
		} else if(event.isKeyUp(KeyEvent.TSK_S)) {
			turnDown = false;
		}

		if(event.isKeyDown(KeyEvent.TSK_W)) {
			turnUp = true;
			//moveForward = true;
		} else if(event.isKeyUp(KeyEvent.TSK_W)) {
			turnUp = false;
			//moveForward = false;
		}

		return null;
	}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:73,代码来源:DEMView.java

示例3: updateKeyboard

import br.com.etyllica.core.event.KeyEvent; //导入方法依赖的package包/类
public GUIEvent updateKeyboard(KeyEvent event) {
	
	if(event.isAnyKeyDown(KeyEvent.TSK_SHIFT_RIGHT, KeyEvent.TSK_SHIFT_LEFT)) {
		shiftPressed = true;
	} else if(event.isAnyKeyUp(KeyEvent.TSK_SHIFT_RIGHT, KeyEvent.TSK_SHIFT_LEFT)) {
		shiftPressed = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_UP_ARROW)) {
		//if(shiftPressed) {
			moveUp = true;
		//} else {
			//moveForward = true;
		//}
		
	} else if(event.isKeyUp(KeyEvent.TSK_UP_ARROW)) {
		moveUp = false;
		moveForward = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_UP_ARROW)) {
		moveUp = true;
	} else if(event.isKeyUp(KeyEvent.TSK_UP_ARROW)) {
		moveUp = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_DOWN_ARROW)) {
		moveDown = true;
	} else if(event.isKeyUp(KeyEvent.TSK_DOWN_ARROW)) {
		moveDown = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_LEFT_ARROW)) {
		turnLeft = true;
	} else if(event.isKeyUp(KeyEvent.TSK_LEFT_ARROW)) {
		turnLeft = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_RIGHT_ARROW)) {
		turnRight = true;
	} else if(event.isKeyUp(KeyEvent.TSK_RIGHT_ARROW)) {
		turnRight = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_D)) {
		moveRight = true;
	} else if(event.isKeyUp(KeyEvent.TSK_D)) {
		moveRight = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_A)) {
		moveLeft = true;
	} else if(event.isKeyUp(KeyEvent.TSK_A)) {
		moveLeft = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_S)) {
		turnDown = true;
	} else if(event.isKeyUp(KeyEvent.TSK_S)) {
		turnDown = false;
	}
	
	if(event.isKeyDown(KeyEvent.TSK_W)) {
		turnUp = true;
		//moveForward = true;
	} else if(event.isKeyUp(KeyEvent.TSK_W)) {
		turnUp = false;
		//moveForward = false;
	}
	
	return null;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:73,代码来源:TriangulatorView.java

示例4: updateKeyboard

import br.com.etyllica.core.event.KeyEvent; //导入方法依赖的package包/类
@Override
public GUIEvent updateKeyboard(KeyEvent event){

	if(event.isKeyDown(KeyEvent.TSK_Q)){
		box.pressUpperLeft();
		markq.setVisible(true);

		//beat1.play();

	}else if(event.isKeyUp(KeyEvent.TSK_Q)){
		
		box.unpressUpperLeft();
		markq.setVisible(false);
	}

	if(event.isKeyDown(KeyEvent.TSK_A)){
		box.pressLowerLeft();
		marka.setVisible(true);
		
		//beat2.play();
	}else if(event.isKeyUp(KeyEvent.TSK_A)){
		box.unpressLowerLeft();
		marka.setVisible(false);
	}

	if(event.isKeyDown(KeyEvent.TSK_P)){
		box.pressUpperRight();
		markp.setVisible(true);
		
		//beat1.play();

	}else if(event.isKeyUp(KeyEvent.TSK_P)){
		box.unpressUpperRight();
		markp.setVisible(false);
	}

	if(event.isKeyDown(KeyEvent.TSK_L)){
		box.pressLowerRight();
		markl.setVisible(true);
		
		//beat2.play();

	}else if(event.isKeyUp(KeyEvent.TSK_L)){
		box.unpressLowerRight();
		markl.setVisible(false);
	}


	return GUIEvent.NONE;

}
 
开发者ID:yuripourre,项目名称:htbm-v2,代码行数:52,代码来源:HeartGame.java


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