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


Java Keys.X屬性代碼示例

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


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

示例1: keyDown

@Override
public boolean keyDown(InputEvent event, int keyCode) {
    switch (keyCode) {
        case Keys.ESCAPE:
            Gdx.app.exit();
            break;
        case Keys.Z:
            sizeScale = Math.max(0.1f, sizeScale - 0.1f);
            break;
        case Keys.X:
            sizeScale += 0.1f;
            break;
        case Keys.C:
            ParticleEffectManager.getInstance().clearLiveEffects();
            break;
        case Keys.D:
            Globals.printDebugInfo = !Globals.printDebugInfo;
            break;
    }

    return true;
}
 
開發者ID:alexschimpf,項目名稱:joe,代碼行數:22,代碼來源:ParticleEffectViewer.java

示例2: setKeyAssign

public void setKeyAssign(Mode mode, boolean enable) {
	switch (mode) {
	case BEAT_5K:
	case BEAT_7K:
		keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
				Keys.CONTROL_LEFT };
		break;
	case BEAT_10K:
	case BEAT_14K:
	default:
		keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
				Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.APOSTROPHE,
				Keys.UNKNOWN, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
		break;
	case POPN_5K:
	case POPN_9K:
		keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.G, Keys.B };
		break;
	case KEYBOARD_24K:
		keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
				Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.APOSTROPHE,
				Keys.UNKNOWN, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
		keys = Arrays.copyOf(keys, 26);
		break;
	case KEYBOARD_24K_DOUBLE:
		keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
				Keys.CONTROL_LEFT, Keys.COMMA, Keys.L, Keys.PERIOD, Keys.SEMICOLON, Keys.SLASH, Keys.APOSTROPHE,
				Keys.UNKNOWN, Keys.SHIFT_RIGHT, Keys.CONTROL_RIGHT };
		keys = Arrays.copyOf(keys, 52);
		break;
	}
	if(!enable) {
		Arrays.fill(keys, -1);
	}
	start = Keys.Q;
	select = Keys.W;			
}
 
開發者ID:exch-bms2,項目名稱:beatoraja,代碼行數:37,代碼來源:PlayConfig.java

示例3: onTurn

@Override
/*********************************************************
 * Called on every turn
 * @return true if something actually happened in a turn
 * (if false, the player is NOT moved in the queue!)
 *********************************************************/
public boolean onTurn(){
	super.onTurn();
	Core.redraw = true; 
	Integer log = input.checkKeys();
	if (log == null) return false; 
	switch (log){
	case Keys.LEFT: 
		move(-1, 0);
		break; 
	case Keys.RIGHT:
		move(1, 0);
		break; 
	case Keys.UP:
		move(0, 1);
		break; 
	case Keys.DOWN:
		move(0, -1); 
		break; 
	case Keys.E:
		Core.game.setScreen(new DungeonOverviewScreen(holder.getDungeon().getWorld()));
	case Keys.X:
		holder.useStairs();
		holder.getDungeon().getWorld().changeFloors(holder.getDungeon());
		break; 
	default:
		return false; 
	}
	housekeep(); 
	return true; 
}
 
開發者ID:lries,項目名稱:Oozelike,代碼行數:36,代碼來源:PlayerAI.java

示例4: checkKeys

/********************************************
 * Check keys for presses
 * Automatically converts synonymous keys
 * @return the highest priority active key
 ********************************************/
public Integer checkKeys(){
	if (checkKey(Keys.UP) || checkKey(Keys.W)) return Keys.UP;
	if (checkKey(Keys.DOWN) || checkKey(Keys.S)) return Keys.DOWN;
	if (checkKey(Keys.LEFT) || checkKey(Keys.A)) return Keys.LEFT;
	if (checkKey(Keys.RIGHT) || checkKey(Keys.D)) return Keys.RIGHT;
	if (checkNewKey(Keys.X)) return Keys.X;
	if (checkNewKey(Keys.E)) return Keys.E; 
	return null; 
}
 
開發者ID:lries,項目名稱:Oozelike,代碼行數:14,代碼來源:KeyLogger.java

示例5: keyDown

@Override
public boolean keyDown(int keycode) {
    switch (keycode) {
        case Keys.ESCAPE:
            gsm.setCurrentState(StateType.MAIN_MENU);
            return true;
        case Keys.F10:
            saveScreenshot();
            return true;
        case Keys.Z:
            Game.TESTING = !Game.TESTING;
            return true;
        case Keys.X:
            Gdx.app.exit();
            return true;

        //examples
        case Keys.TAB:
            //open inventory
            return true;
        case Keys.T:
            //open talents/perks
            return true;
        case Keys.L:
            //open mission/quest/tasks log
            return true;
        default:
            return false;
    }
}
 
開發者ID:vs-slavchev,項目名稱:Virtual-Evil,代碼行數:30,代碼來源:UiInputProcessor.java

示例6: keyDown

@Override
public boolean keyDown(int keycode) {
	if (keycode == Keys.Z) {
		currentScene.processTouchDown(this, 0, 0);
	}
	else if (keycode == Keys.X) {
		currentScene.processTouchDown(this, Gdx.graphics.getWidth(), 0);
	}
	return true;
}
 
開發者ID:igorcrevar,項目名稱:GoingUnder,代碼行數:10,代碼來源:GameListener.java

示例7: keyUp

public boolean keyUp(int keycode) {
    if(NerdShooter.shooter.useKeys){
        if (keycode == NerdShooter.shooter.keys[0]){
            controller.leftReleased();
        }
        if (keycode == NerdShooter.shooter.keys[1]){
            controller.rightReleased();
        }
        if (keycode == NerdShooter.shooter.keys[2]){
            controller.jumpReleased();
        }
        if (keycode == NerdShooter.shooter.keys[3]){
            controller.fireReleased();
        }
    } else {
        if (keycode == Keys.LEFT){
            controller.leftReleased();
        }
        if (keycode == Keys.RIGHT){
            controller.rightReleased();
        }
        if (keycode == Keys.SPACE){
            controller.jumpReleased();
        }
        if (keycode == Keys.X){
            controller.fireReleased();
        }
    }
    return true;
}
 
開發者ID:Xemplar,項目名稱:NerdShooter,代碼行數:30,代碼來源:GameScreen.java

示例8: keyDown

@Override
  public boolean keyDown (int keycode) {
if ( keycode == Keys.X || keycode == Keys.BACK) {
 if (!menuPressed) {
	 menuPressed = true;
 }
}
return false;
  }
 
開發者ID:Mknsri,項目名稱:Drunk-Toss,代碼行數:9,代碼來源:Input.java

示例9: keyDown

@Override
public boolean keyDown(int keycode) {

	if (keycode == Keys.X && keys.containsKey(Keys.CONTROL_LEFT)) {
		System.exit(0);
	}

	if (keycode == Keys.M) {
		if(SoundManager.masterSound>0.1f) {
			SoundManager.stopAllSounds();
			SoundManager.pauseAllMusiques();
			SoundManager.masterSound = 0.f;				
			SoundManager.masterMusic = 0.f;				
		}
		else {
			SoundManager.masterSound = 0.3f;				
			SoundManager.masterMusic = 0.3f;				
		}
	}

	if ((keycode == Keys.SPACE) && InGame.dead) {
		InGame.score=5000;
		InGame.maxScore=0;
		InGame.nbKills=0;
		InGame.totalTime=0;
		InGame.speedEnergy = 250;
		InGame.dead=false;
		InGame.rouge = 0;
		InGame.player.timeBeforeRespawn = 0;
		Gdx.input.setCursorCatched(true);
		PAUSED = false;
	}

	if (keycode == Keys.UP) {
		STRAFE_LEFT = Keys.LEFT;
		STRAFE_RIGHT = Keys.RIGHT;
		FORWARD = Keys.UP;
		BACKWARD = Keys.DOWN;
	}

	if (keycode == Keys.C) {
		ScreenshotFactory.saveScreenshot();
	}

	if (keycode == Keys.W) {
		STRAFE_LEFT = Keys.A;
		STRAFE_RIGHT = Keys.D;
		FORWARD = Keys.W;
		BACKWARD = Keys.S;
	}

	if (keycode == Keys.Q) {
		STRAFE_LEFT = Keys.Q;
		STRAFE_RIGHT = Keys.D;
		FORWARD = Keys.Z;
		BACKWARD = Keys.S;
	}

	keys.put(keycode, keycode);
	return true;
}
 
開發者ID:Osaris31,項目名稱:exterminate,代碼行數:61,代碼來源:CameraController.java

示例10: validate

public void validate(int keys) {
	if (keyboard.keys == null) {
		keyboard.keys = new int[] { Keys.Z, Keys.S, Keys.X, Keys.D, Keys.C, Keys.F, Keys.V, Keys.SHIFT_LEFT,
				Keys.CONTROL_LEFT };
	}
	if (keyboard.keys.length != keys) {
		keyboard.keys = Arrays.copyOf(keyboard.keys, keys);
	}

	int index = 0;
	for (ControllerConfig c : controller) {
		if (c.keys == null) {
			c.keys = new int[] { BMKeys.BUTTON_4, BMKeys.BUTTON_7, BMKeys.BUTTON_3, BMKeys.BUTTON_8,
					BMKeys.BUTTON_2, BMKeys.BUTTON_5, BMKeys.LEFT, BMKeys.UP, BMKeys.DOWN };
		}
		if (c.keys.length != keys) {
			int[] newkeys = new int[keys];
			Arrays.fill(newkeys, -1);
			for (int i = 0; i < c.keys.length && index < newkeys.length; i++, index++) {
				newkeys[index] = c.keys[i];
			}
			c.keys = newkeys;
		}
	}

	if (midi.keys == null) {
		midi.keys = new MidiConfig().keys;
	}
	if (midi.keys.length != keys) {
		midi.keys = Arrays.copyOf(midi.keys, keys);
	}
	
	// KB, コントローラー, Midiの各ボタンについて排他的処理を実施
	boolean[] exclusive = new boolean[keyboard.keys.length];
	validate0(keyboard.keys,  exclusive);
	for(int i = 0;i < controller.length;i++) {
		validate0(controller[i].keys,  exclusive);
	}
			
	for(int i = 0;i < midi.getKeys().length;i++) {
		if(exclusive[i]) {
			midi.getKeys()[i] = null;
		}
	}
}
 
開發者ID:exch-bms2,項目名稱:beatoraja,代碼行數:45,代碼來源:PlayConfig.java

示例11: keyDown

public boolean keyDown(int k) {
    if (k == Keys.Z) BBInput.setKey(BBInput.BUTTON1, true);
    if (k == Keys.X) BBInput.setKey(BBInput.BUTTON2, true);
    return true;
}
 
開發者ID:awwong1,項目名稱:BlockBunny,代碼行數:5,代碼來源:BBInputProcessor.java

示例12: keyUp

public boolean keyUp(int k) {
    if (k == Keys.Z) BBInput.setKey(BBInput.BUTTON1, false);
    if (k == Keys.X) BBInput.setKey(BBInput.BUTTON2, false);
    return true;
}
 
開發者ID:awwong1,項目名稱:BlockBunny,代碼行數:5,代碼來源:BBInputProcessor.java

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