當前位置: 首頁>>代碼示例>>Java>>正文


Java Keyboard.KEY_L屬性代碼示例

本文整理匯總了Java中org.lwjgl.input.Keyboard.KEY_L屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEY_L屬性的具體用法?Java Keyboard.KEY_L怎麽用?Java Keyboard.KEY_L使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEY_L屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: input

private void input() {
	int mousex = Mouse.getX();
	int mousey = 480 - Mouse.getY() - 1;
	boolean mouseClicked = Mouse.isButtonDown(0);
	
	
	if (mouseClicked) {
		int grid_x = Math.round(mousex / World.BLOCK_SIZE);
		int grid_y = Math.round(mousey / World.BLOCK_SIZE);
		bt = getBT(bt);
		grid.setAt(grid_x, grid_y, bt);
	}
	while (Keyboard.next()) {
		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_SPACE) {
			if (bt == DIRT) {
				setBT(GRASS);
			} else if (bt == GRASS) {
				setBT(STONE);
			} else if (bt == STONE) {
				setBT(AIR);
			} else if (bt == AIR) {
				setBT(DIRT);
			}
		}
	}
}
 
開發者ID:nitrodragon,項目名稱:lwjgl_collection,代碼行數:32,代碼來源:AltBoot.java

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

示例3: AntiVelocity

public AntiVelocity() {
	super("AntiVelocity", "Blocks velocity.", Keyboard.KEY_L, 0xFFFFFF, Category.COMBAT);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:3,代碼來源:AntiVelocity.java


注:本文中的org.lwjgl.input.Keyboard.KEY_L屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。