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


Java Keyboard.KEY_S属性代码示例

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


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

示例1: keyUp

@Override
public void keyUp(int keycode)
{
    if (keycode == Keyboard.KEY_W || keycode == Keyboard.KEY_UP)
        setSelected(selected - 1);
    if (keycode == Keyboard.KEY_S || keycode == Keyboard.KEY_DOWN)
        setSelected(selected + 1);
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:8,代码来源:GuiIfTabletSESelector.java

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

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

示例4: update

public void update() {
	draw();
	editorUI.drawString(WIDTH + 3, HEIGHT / 2, "Press 's' to");
	editorUI.drawString(WIDTH + 3, HEIGHT / 2 + 20, "save this");
	editorUI.drawString(WIDTH + 3, HEIGHT / 2 + 40, "map!");
	editorUI.drawString(WIDTH + 3, HEIGHT / 2 + 80, "Press 'm' to");
	editorUI.drawString(WIDTH + 3, HEIGHT / 2 + 100, "return to");
	editorUI.drawString(WIDTH + 3, HEIGHT / 2 + 120, "the menu!");
	
	// Mouse Input
	if (Mouse.next()){
		boolean mouseClicked = Mouse.isButtonDown(0);
		if (mouseClicked) {
			if (tilePickerMenu.isButtonClicked("Grass")) {
				index = 0;
			} else if (tilePickerMenu.isButtonClicked("Dirt")){
				index = 1;
			} else if (tilePickerMenu.isButtonClicked("Water")) {
				index = 2;
			} else if (tilePickerMenu.isButtonClicked("DirtStone")) {
				index = 3;
			} else if (tilePickerMenu.isButtonClicked("StoneFloor")) {
				index = 4;
			} else if (tilePickerMenu.isButtonClicked("Sand")) {
				index = 5;
			} else if (tilePickerMenu.isButtonClicked("Crystal")) {
				index = 6;
			} else {
				if (Mouse.getX() < WIDTH)
					setTile();
			}
		}
	}

	// Keyboard Input
	while (Keyboard.next()) {
		if (Keyboard.getEventKey() == Keyboard.KEY_S && Keyboard.getEventKeyState()) {
			SaveMap(MAP_NAME, grid);
			StateManager.checkMap = 0;
		}
		if (Keyboard.getEventKey() == Keyboard.KEY_M && Keyboard.getEventKeyState()) {
			StateManager.setState(GameState.MAINMENU);
		}
	}
}
 
开发者ID:imaTowan,项目名称:Towan,代码行数:45,代码来源:Editor.java


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