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


Java KeyEvent.isKeyDown方法代码示例

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


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

示例1: updateKeyboard

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

	if(event.isKeyDown(KeyEvent.TSK_1)) {
		client.sendMessage("Hi!");
	}

	else if(event.isKeyDown(KeyEvent.TSK_2)) {
		client.sendMessage("Help Me!");
	}

	else if(event.isKeyDown(KeyEvent.TSK_3)) {
		client.sendMessage("Run!!");
	}

	//Ignore Repeat Keys
	if(event.getState() != KeyState.TYPED)
		client.sendKeyAction(new KeyAction(event.getKey(), event.getState()));

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:multiplayer,代码行数:22,代码来源:ClientApplication.java

示例2: updateKeyboard

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

	controller1.updateKeyboard(event);
	controller2.updateKeyboard(event);

	if (event.isKeyDown(KeyEvent.TSK_I)) {
		droneCamera1.offsetX(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_K)) {
		droneCamera1.offsetX(-1);
	}

	if (event.isKeyDown(KeyEvent.TSK_L)) {
		droneCamera1.offsetZ(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_J)) {
		droneCamera1.offsetZ(-1);
	}

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:25,代码来源:MultiPilotEnvironment.java

示例3: updateKeyboard

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

	controller.updateKeyboard(event);

	if (event.isKeyDown(KeyEvent.TSK_I)) {
		droneCamera.offsetX(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_K)) {
		droneCamera.offsetX(-1);
	}

	if (event.isKeyDown(KeyEvent.TSK_L)) {
		droneCamera.offsetZ(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_J)) {
		droneCamera.offsetZ(-1);
	}

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:24,代码来源:CleanEnvironment.java

示例4: updateKeyboard

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

	controller1.updateKeyboard(event);

	if (event.isKeyDown(KeyEvent.TSK_I)) {
		droneCamera1.offsetX(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_K)) {
		droneCamera1.offsetX(-1);
	}

	if (event.isKeyDown(KeyEvent.TSK_L)) {
		droneCamera1.offsetZ(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_J)) {
		droneCamera1.offsetZ(-1);
	}

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:24,代码来源:WindEnvironment.java

示例5: 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

示例6: updateKeyboard

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

	if (event.isKeyDown(KeyEvent.TSK_I)) {

		// droneCamera.getTarget().setOffsetX(+1);
		droneCamera.offsetX(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_K)) {

		// droneCamera.getTarget().setOffsetX(-1);
		droneCamera.offsetX(-1);
	}

	if (event.isKeyDown(KeyEvent.TSK_L)) {

		// droneCamera.getTarget().setOffsetZ(+1);
		droneCamera.offsetZ(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_J)) {

		// droneCamera.getTarget().setOffsetZ(-1);
		droneCamera.offsetZ(-1);
	}

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:30,代码来源:RemoteEnvironment.java

示例7: updateKeyboard

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

	controller.updateKeyboard(event);

	if (event.isKeyDown(KeyEvent.TSK_1)) {
		currentCamera = cameraGL;
	} else if (event.isKeyDown(KeyEvent.TSK_2)) {
		currentCamera = personView;
	}
	
	if (event.isKeyDown(KeyEvent.TSK_I)) {

		// droneCamera.getTarget().offsetX(+1);
		droneCamera.offsetX(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_K)) {

		// droneCamera.getTarget().offsetX(-1);
		droneCamera.offsetX(-1);
	}

	if (event.isKeyDown(KeyEvent.TSK_L)) {

		// droneCamera.getTarget().offsetZ(+1);
		droneCamera.offsetZ(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_J)) {

		// droneCamera.getTarget().offsetZ(-1);
		droneCamera.offsetZ(-1);
	}
	
	if (event.isKeyDown(KeyEvent.TSK_Z)) {
		drone.offsetX(-10);
		
		//terrain.offsetX(-20);
	}
	if (event.isKeyDown(KeyEvent.TSK_X)) {
		drone.offsetX(10);
		
		//terrain.offsetX(-20);
	}
	if (event.isKeyDown(KeyEvent.TSK_C)) {
		//terrain.offsetX(+20);
	}

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:52,代码来源:BeachEnvironment.java

示例8: 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

示例9: 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

示例10: 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

示例11: updateKeyboard

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

	controller.updateKeyboard(event);

	if (event.isKeyDown(KeyEvent.TSK_I)) {

		// droneCamera.getTarget().setOffsetX(+1);
		droneCamera.offsetX(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_K)) {

		// droneCamera.getTarget().setOffsetX(-1);
		droneCamera.offsetX(-1);
	}

	if (event.isKeyDown(KeyEvent.TSK_L)) {

		// droneCamera.getTarget().setOffsetZ(+1);
		droneCamera.offsetZ(+1);
	}

	if (event.isKeyDown(KeyEvent.TSK_J)) {

		// droneCamera.getTarget().setOffsetZ(-1);
		droneCamera.offsetZ(-1);
	}

	return GUIEvent.NONE;
}
 
开发者ID:yuripourre,项目名称:drone4,代码行数:32,代码来源:SportsEnvironment.java


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