本文整理匯總了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);
}
}
}
示例2: Fullbright
public Fullbright()
{
super("Fullbright", "Turns on NightVision effect to brighten the world.", Keyboard.KEY_C, Category.WORLD);
}