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


Java Keys.D屬性代碼示例

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


在下文中一共展示了Keys.D屬性的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: keyDown

public boolean keyDown(int keycode) {
	switch(keycode) {
	case Keys.A:case Keys.LEFT: leftFlag = true; break;
	case Keys.D:case Keys.RIGHT:rightFlag = true;break;
	case Keys.SPACE:jumpFlag = true;break;
	}
	return false;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:8,代碼來源:Base2dTests.java

示例3: keyUp

public boolean keyUp(int keycode) {
	switch(keycode) {case Keys.A:case Keys.LEFT:leftFlag = false;break;
	case Keys.D:case Keys.RIGHT:rightFlag = false;break;
	case Keys.SPACE:jumpFlag = false;break;
	}
	return false;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:7,代碼來源:Base2dTests.java

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

示例5: keyDown

@Override
public boolean keyDown(int keycode) {
	if (keycode == Keys.D) {
		//engine.getSystem(RenderingSystem.class).toggleDebug();
		return true;
	}
	
	return false;
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:9,代碼來源:GameScreen.java

示例6: keyUp

public boolean keyUp(int k) {
	if(mode==0){
		if(k == Keys.W || k == Keys.UP) MyInput.setKey(Input.UP, false);
		if(k == Keys.A || k == Keys.LEFT) MyInput.setKey(Input.LEFT, false);
		if(k == Keys.S || k == Keys.DOWN) MyInput.setKey(Input.DOWN, false);
		if(k == Keys.D || k == Keys.RIGHT) MyInput.setKey(Input.RIGHT, false);
		if(k == Keys.SPACE) MyInput.setKey(Input.JUMP, false);
		if(k == Keys.Q || k == Keys.CONTROL_RIGHT) MyInput.setKey(Input.INTERACT, false);
		if(k == Keys.E || k == Keys.NUMPAD_0) MyInput.setKey(Input.ATTACK, false);
		if(k == Keys.SHIFT_LEFT) MyInput.setKey(Input.SPECIAL, false);
		if(k == Keys.CONTROL_LEFT || k == Keys.Z) MyInput.setKey(Input.RUN, false);
		if(k == Keys.R || k == Keys.NUMPAD_1) MyInput.setKey(Input.USE, false);
		if(k == Keys.ESCAPE) MyInput.setKey(Input.PAUSE, false);
		if(k == Keys.ENTER) MyInput.setKey(Input.ENTER, false);
		if(k == Keys.TAB) MyInput.setKey(Input.RESPAWN, false);
		if(k == Keys.NUMPAD_8 || k == Keys.U) MyInput.setKey(Input.DEBUG_UP, false);
		if(k == Keys.NUMPAD_2 || k == Keys.J) MyInput.setKey(Input.DEBUG_DOWN, false);
		if(k == Keys.NUMPAD_4 || k == Keys.I) MyInput.setKey(Input.DEBUG_LEFT, false);
		if(k == Keys.NUMPAD_6 || k == Keys.O) MyInput.setKey(Input.DEBUG_RIGHT, false);
		if(k == Keys.NUMPAD_7 || k == Keys.LEFT_BRACKET) MyInput.setKey(Input.DEBUG_LEFT2, false);
		if(k == Keys.NUMPAD_9 || k == Keys.RIGHT_BRACKET) MyInput.setKey(Input.DEBUG_RIGHT2, false);
		if(k == Keys.M) MyInput.setKey(Input.DEBUG_CENTER, false);
		if(k == Keys.F1) MyInput.setKey(Input.COLLISION, false);
		if(k == Keys.F2) MyInput.setKey(Input.LIGHTS, false);
		if(k == Keys.F3) MyInput.setKey(Input.DEBUG_TEXT, false);
		if(k == Keys.F4) MyInput.setKey(Input.RENDER, false);
		if(k == Keys.EQUALS) MyInput.setKey(Input.ZOOM_IN, false);
		if(k == Keys.MINUS) MyInput.setKey(Input.ZOOM_OUT, false);
	} else {
		if(k == Keys.ESCAPE){ MyInput.setKey(Input.PAUSE, false); }
		if(k == Keys.SPACE){ MyInput.setKey(Input.JUMP, false); }
		if(k == Keys.ENTER){ MyInput.setKey(Input.ENTER, false); }
		if(k == Keys.LEFT){ MyInput.setKey(Input.LEFT, false); }
		if(k == Keys.RIGHT){  MyInput.setKey(Input.RIGHT, false); }
		if(Keys.toString(k).toLowerCase().equals("delete")){ MyInput.setKey(Input.DOWN, false); }
		if(k == Keys.SHIFT_LEFT || k == Keys.SHIFT_RIGHT){ MyInput.setKey(Input.UP, false); }
	}
	return true;
}
 
開發者ID:JayKEm,項目名稱:Aftamath,代碼行數:39,代碼來源:MyInputProcessor.java

示例7: loadDefault

public void loadDefault() {
	//player
	forward = Keys.W;
	right = Keys.D;
	left = Keys.A;
	back = Keys.S;
	shoot = Keys.SPACE;
	changeVehicle = Keys.G;
	land = Keys.T;
	
	//ui
	toggleHUD = Keys.H;
	toggleEdgeMap = Keys.M;
	toggleSpaceMap = Keys.P;
	
	//screen
	fullscreen = Keys.F11;
	vsync = Keys.F8;
	zoomOut = Keys.MINUS;
	zoomIn = Keys.EQUALS;
	resetZoom = Keys.PERIOD;
	zoomCharacter = Keys.SLASH;
	zoomSpace = Keys.COMMA;
	rotateLeft = Keys.LEFT_BRACKET;
	rotateRight = Keys.RIGHT_BRACKET;
	
	//debug menu
	toggleDebug = Keys.F3;
	togglePos = Keys.NUMPAD_0;
	toggleComponents = Keys.NUMPAD_1;
	toggleBounds = Keys.NUMPAD_2;
	toggleFPS = Keys.NUMPAD_3;
	toggleOrbit = Keys.NUMPAD_4;
	toggleVector = Keys.NUMPAD_5;
	toggleMenu = Keys.NUMPAD_9;		
}
 
開發者ID:0XDE57,項目名稱:SpaceProject,代碼行數:36,代碼來源:KeyConfig.java

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

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

示例10: keyDown

@Override
public boolean keyDown(InputEvent event, int keyCode) {
    Game.State gameState = Globals.getGameState();
    if (gameState == Game.State.RUNNING || gameState == Game.State.WAIT_FOR_INPUT) {
        if (keyCode == Keys.A) {
            Player player = Level.getInstance().getPlayer();
            if (player != null) {
                player.jump();
            }
        }
    }

    switch (keyCode) {
        case Keys.BACK:
            if (mainMenuOnBack) {
                // TODO: Game.instance.setScreen(new MainMenu(Game.instance));
            }
            break;
        case Keys.ESCAPE:
            Gdx.app.exit();
            break;
        case Keys.D:
            Globals.debugPhysics = !Globals.debugPhysics;
            break;
        case Keys.C:
            DAO.getInstance().clear();
            break;
        case Keys.P:
            Globals.printDebugInfo = !Globals.printDebugInfo;
            break;
        case Keys.E:
            Globals.customCameraInfo = !Globals.customCameraInfo;
            MainCamera.getInstance().setPlayerFocus(true);
            break;
        case Keys.Q:
            MainCamera.getInstance().takeScreenshot();
            break;
        case Keys.ENTER:
            if (Globals.getGameState() == Game.State.LEVEL_COMPLETE) {
                HUD.getInstance().hideLevelComplete();
            }
            Level.getInstance().loadNext();

            break;
        default:
            if (Level.getInstance().getPlayer() != null &&
                    Globals.getGameState() == Game.State.WAIT_FOR_INPUT) {
                Globals.setGameState(Game.State.RUNNING);
            }

            return false;
    }

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

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

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

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


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