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


Java Keyboard.KEY_C属性代码示例

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


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

示例1: input

private void input() {
	if (mouseEnabled || Mouse.isButtonDown(0)) {
		mouseEnabled = true;
		int mousex = Mouse.getX();
		int mousey = 480 - Mouse.getY() - 1;
		boolean mouseClicked = Mouse.isButtonDown(0);
		selector_x = Math.round(mousex / World.BLOCK_SIZE);
		selector_y = Math.round(mousey / World.BLOCK_SIZE);
		if (mouseClicked) {
			grid.setAt(selector_x, selector_y, selection);
		}
	}
	
	while (Keyboard.next()) {
		if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT && Keyboard.getEventKeyState()) {
			if (!(selector_x + 1 > World.BLOCKS_WIDTH - 2)) {
				mouseEnabled = false;
				selector_x++;
			}
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_LEFT && Keyboard.getEventKeyState()) {
			if (!(selector_x - 1 < 0)) {
				mouseEnabled = false;
				selector_x--;
			}
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_UP && Keyboard.getEventKeyState()) {
			if (!(selector_y - 1 < 0)) {
				mouseEnabled = false;
				selector_y--;
			}
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_DOWN && Keyboard.getEventKeyState()) {
			if (!(selector_y + 1 > World.BLOCKS_HEIGHT - 2)) {
				mouseEnabled = false;
				selector_y++;
			}
		}
		
		if (Keyboard.getEventKey() == Keyboard.KEY_S) {
			grid.save(new File("save.xml"));
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_L) {
			grid.load(new File("save.xml"));
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_1) {
			selection = BlockType.STONE;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_2) {
			selection = BlockType.DIRT;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_3) {
			selection = BlockType.GRASS;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_4) {
			selection = BlockType.AIR;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_C) {
			grid.clear();
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_SPACE) {
			grid.setAt(selector_x, selector_y, selection);
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
			Display.destroy();
			System.exit(0);
		}
	}
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:69,代码来源:Boot.java

示例2: Fullbright

public Fullbright()
{
	super("Fullbright", "Turns on NightVision effect to brighten the world.", Keyboard.KEY_C, Category.WORLD);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:4,代码来源:Fullbright.java


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