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


Java Keys.NUM_4属性代码示例

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


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

示例1: keycodeSelectionIf

private int keycodeSelectionIf(int keycode){
	if (keycode == Keys.NUM_1) {
		selected = 0;
	}
	if (keycode == Keys.NUM_2) {
		selected = 1;
	}
	if (keycode == Keys.NUM_3) {
		selected = 2;
	}
	if (keycode == Keys.NUM_4) {
		selected = 3;
	}
	if (keycode == Keys.NUM_5) {
		selected = 4;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:GuiRenderer.java

示例2: keyDown

@Override
public boolean keyDown(int keycode) {
  if (functionKeys(keycode)) return true;

  if (keycode == blocksMenu) {
    toggleInventory();
    return true;
  }

  int selected = -1;
  if (keycode == Keys.NUM_1) selected = 0;
  if (keycode == Keys.NUM_2) selected = 1;
  if (keycode == Keys.NUM_3) selected = 2;
  if (keycode == Keys.NUM_4) selected = 3;
  if (keycode == Keys.NUM_5) selected = 4;
  if (keycode == Keys.NUM_6) selected = 5;
  if (keycode == Keys.NUM_7) selected = 6;
  if (keycode == Keys.NUM_8) selected = 7;
  if (keycode == Keys.NUM_9) selected = 8;
  if (selected != -1) {
    Cubes.getClient().player.getInventory().hotbarSelected = selected;
    Cubes.getClient().player.getInventory().sync();
    return true;
  }
  return false;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:26,代码来源:GuiRenderer.java

示例3: keyDown

@Override
public boolean keyDown(int keycode) {
    switch (keycode) {
        case Keys.A:
            inputController.setLeft(true);
            return true;
        case Keys.D:
            inputController.setRight(true);
            return true;
        case Keys.W:
            inputController.setUp(true);
            return true;
        case Keys.S:
            inputController.setDown(true);
            return true;
        case Keys.NUM_1:
            inputController.setNumberKey(1, true);
            return true;
        case Keys.NUM_2:
            inputController.setNumberKey(2, true);
            return true;
        case Keys.NUM_3:
            inputController.setNumberKey(3, true);
            return true;
        case Keys.NUM_4:
            inputController.setNumberKey(4, true);
            return true;
        case Keys.Q:
            inputController.setSwitchWeapon(true);
            return true;
        case Keys.E:
            inputController.setWeaponAbility(true);
            return true;
        default:
            return false;
    }
}
 
开发者ID:vs-slavchev,项目名称:Virtual-Evil,代码行数:37,代码来源:GameInputProcessor.java

示例4: keyUp

@Override
public boolean keyUp(int keycode) {
    switch (keycode) {
        case Keys.A:
            inputController.setLeft(false);
            return true;
        case Keys.D:
            inputController.setRight(false);
            return true;
        case Keys.W:
            inputController.setUp(false);
            return true;
        case Keys.S:
            inputController.setDown(false);
            return true;
        case Keys.NUM_1:
            inputController.setNumberKey(1, false);
            return true;
        case Keys.NUM_2:
            inputController.setNumberKey(2, false);
            return true;
        case Keys.NUM_3:
            inputController.setNumberKey(3, false);
            return true;
        case Keys.NUM_4:
            inputController.setNumberKey(4, false);
            return true;
        case Keys.Q:
            inputController.setSwitchWeapon(false);
            return true;
        case Keys.E:
            inputController.setWeaponAbility(false);
            return true;
        default:
            return false;
    }
}
 
开发者ID:vs-slavchev,项目名称:Virtual-Evil,代码行数:37,代码来源:GameInputProcessor.java

示例5: keyDown

public boolean keyDown(int k) {
		if(mode==0){
			if(k == Keys.W || k == Keys.UP) MyInput.setKey(Input.UP, true);
			if(k == Keys.A || k == Keys.LEFT) MyInput.setKey(Input.LEFT, true);
			if(k == Keys.S || k == Keys.DOWN) MyInput.setKey(Input.DOWN, true);
			if(k == Keys.D || k == Keys.RIGHT) MyInput.setKey(Input.RIGHT, true);
			if(k == Keys.SPACE) MyInput.setKey(Input.JUMP, true);
			if(k == Keys.Q || k == Keys.CONTROL_RIGHT) MyInput.setKey(Input.INTERACT, true);
			if(k == Keys.E || k == Keys.NUMPAD_0) MyInput.setKey(Input.ATTACK, true);
			if(k == Keys.SHIFT_LEFT) MyInput.setKey(Input.SPECIAL, true);
			if(k == Keys.CONTROL_LEFT || k == Keys.Z) MyInput.setKey(Input.RUN, true);
			if(k == Keys.R || k == Keys.NUMPAD_1) MyInput.setKey(Input.USE, true);
			if(k == Keys.ESCAPE) MyInput.setKey(Input.PAUSE, true);
			if(k == Keys.ENTER) MyInput.setKey(Input.ENTER, true);
			if(k == Keys.TAB) MyInput.setKey(Input.RESPAWN, true);
			if(k == Keys.NUMPAD_8 || k == Keys.U) MyInput.setKey(Input.DEBUG_UP, true);
			if(k == Keys.NUMPAD_2 || k == Keys.J) MyInput.setKey(Input.DEBUG_DOWN, true);
			if(k == Keys.NUMPAD_4 || k == Keys.I) MyInput.setKey(Input.DEBUG_LEFT, true);
			if(k == Keys.NUMPAD_6 || k == Keys.O) MyInput.setKey(Input.DEBUG_RIGHT, true);
			if(k == Keys.NUMPAD_7 || k == Keys.LEFT_BRACKET) MyInput.setKey(Input.DEBUG_LEFT2, true);
			if(k == Keys.NUMPAD_9 || k == Keys.RIGHT_BRACKET) MyInput.setKey(Input.DEBUG_RIGHT2, true);
			if(k == Keys.M) MyInput.setKey(Input.DEBUG_CENTER, true);
			if(k == Keys.F1) MyInput.setKey(Input.COLLISION, true);
			if(k == Keys.F2) MyInput.setKey(Input.LIGHTS, true);
			if(k == Keys.F3) MyInput.setKey(Input.DEBUG_TEXT, true);
			if(k == Keys.F4) MyInput.setKey(Input.RENDER, true);
			if(k == Keys.EQUALS) MyInput.setKey(Input.ZOOM_IN, true);
			if(k == Keys.MINUS) MyInput.setKey(Input.ZOOM_OUT, true);
		} else {
//			System.out.println(k+":"+Keys.toString(k));
			boolean entered = false;
			if(k == Keys.ESCAPE){ entered=true; MyInput.setKey(Input.PAUSE, true); }
			if(k == Keys.SPACE){ entered=true; MyInput.setKey(Input.JUMP, true); }
			if(k == Keys.ENTER){ entered=true; MyInput.setKey(Input.ENTER, true); }
			if(Keys.toString(k).toLowerCase().equals("delete")){ entered=true; MyInput.setKey(Input.DOWN, true); }
			if(k == Keys.LEFT){ entered=true; MyInput.setKey(Input.LEFT, true); }
			if(k == Keys.RIGHT){ entered=true; MyInput.setKey(Input.RIGHT, true); }
			if(k == Keys.HOME){ entered=true; Game.inputIndex = 0;}
			if(k == Keys.END){ entered=true; Game.inputIndex = Game.getInput().length() - 1; }
			if(k == Keys.SHIFT_LEFT || k == Keys.SHIFT_RIGHT){ entered=true; MyInput.setKey(Input.UP, true); }
			
			if(MyInput.isDown(Input.UP)){
				if(k == Keys.NUM_1){ entered = true; Game.addInputChar("!"); }
				if(k == Keys.NUM_2){ entered = true; Game.addInputChar("@"); }
				if(k == Keys.NUM_3){ entered = true; Game.addInputChar("#"); }
				if(k == Keys.NUM_4){ entered = true; Game.addInputChar("$"); }
				if(k == Keys.NUM_5){ entered = true; Game.addInputChar("%"); }
				if(k == Keys.NUM_6){ entered = true; Game.addInputChar("^"); }
				if(k == Keys.NUM_7){ entered = true; Game.addInputChar("&"); }
				if(k == Keys.NUM_8){ entered = true; Game.addInputChar("*"); }
				if(k == Keys.NUM_9){ entered = true; Game.addInputChar("("); }
				if(k == Keys.NUM_0){ entered = true; Game.addInputChar(")"); }
				if(k == Keys.EQUALS){ entered = true; Game.addInputChar("+"); }
				if(k == Keys.MINUS){ entered = true; Game.addInputChar("_"); }
				if(k == Keys.PERIOD){ entered = true; Game.addInputChar(">"); }
				if(k == Keys.COMMA){ entered = true; Game.addInputChar("<"); }
				if(k == Keys.SLASH){ entered = true; Game.addInputChar("?"); }
			}
			
			if(k == Keys.NUMPAD_1){ k = Keys.NUM_1; }
			if(k == Keys.NUMPAD_2){ k = Keys.NUM_2; }
			if(k == Keys.NUMPAD_3){ k = Keys.NUM_3; }
			if(k == Keys.NUMPAD_4){ k = Keys.NUM_4; }
			if(k == Keys.NUMPAD_5){ k = Keys.NUM_5; }
			if(k == Keys.NUMPAD_6){ k = Keys.NUM_6; }
			if(k == Keys.NUMPAD_7){ k = Keys.NUM_7; }
			if(k == Keys.NUMPAD_8){ k = Keys.NUM_8; }
			if(k == Keys.NUMPAD_9){ k = Keys.NUM_9; }
			if(k == Keys.NUMPAD_0){ k = Keys.NUM_0; }
			
			if(!entered && !ignoreKeys.contains(k, false))
				if(MyInput.isDown(Input.UP) || MyInput.isCaps)
					Game.addInputChar(Keys.toString(k));
				else
					Game.addInputChar(Keys.toString(k).toLowerCase());
		}
		
		return true;
	}
 
开发者ID:JayKEm,项目名称:Aftamath,代码行数:79,代码来源:MyInputProcessor.java

示例6: keyDown

public boolean keyDown(int keycode) {
    if(NerdShooter.shooter.useKeys){
        if (keycode == NerdShooter.shooter.keys[0]){
            controller.leftPressed(-1);
        }
        if (keycode == NerdShooter.shooter.keys[1]){
            controller.rightPressed(-1);
        }
        if (keycode == NerdShooter.shooter.keys[2]){
            controller.jumpPressed(-1);
        }
        if (keycode == NerdShooter.shooter.keys[3]){
            controller.firePressed(-1);
        }
    } else {
        if (keycode == Keys.LEFT){
            controller.leftPressed(-1);
        }
        if (keycode == Keys.RIGHT){
            controller.rightPressed(-1);
        }
        if (keycode == Keys.SPACE){
            controller.jumpPressed(-1);
        }
        if (keycode == Keys.X){
            controller.firePressed(-1);
        }
    }
    
    if ((keycode == Keys.BACK) || (keycode == Keys.ESCAPE)){
        finishLevel(ExitBlock.EXIT_NOCLEAR);
    }
    
    if (keycode == Keys.S && NerdShooter.sanic){
        NerdShooter.sanic = false;
        jaxon.loadTextures();
        StartScreen.reloadMusic();
    } else if (keycode == Keys.S && !NerdShooter.sanic){
        NerdShooter.sanic = true;
        jaxon.loadTextures();
        StartScreen.reloadMusic();
    }
    
    if (keycode == Keys.NUM_1){
        jaxon.inventory.setSelctedItem(3);
    }
    if (keycode == Keys.NUM_2){
        jaxon.inventory.setSelctedItem(2);
    }
    if (keycode == Keys.NUM_3){
        jaxon.inventory.setSelctedItem(1);
    }
    if (keycode == Keys.NUM_4){
        jaxon.inventory.setSelctedItem(0);
    }
    
    return true;
}
 
开发者ID:Xemplar,项目名称:NerdShooter,代码行数:58,代码来源:GameScreen.java


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