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


Java Keys.SPACE屬性代碼示例

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


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

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

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

示例3: keyDown

@Override
public boolean keyDown(int keycode) {
    if (keycode == Keys.SPACE) {
        for (FlapListener flapListener : flapListeners) {
            flapListener.flapPressed();
        }
    }
    return false;
}
 
開發者ID:raeleus,項目名稱:bobbybird,代碼行數:9,代碼來源:InputManager.java

示例4: keyUp

@Override
public boolean keyUp(int keycode) {

	if (keycode == Keys.ESCAPE || (keycode == Keys.SPACE && PAUSED)) {

		PAUSED = !PAUSED;
		Gdx.input.setCursorCatched(!PAUSED);

	} else if (keycode == Keys.F5) {
		cameraMode++;
		cameraMode = cameraMode % 3;
		if (cameraMode == 2) {
			cameraMode = 0;
		}
	} else if (keycode == Keys.F6) {
		cameraMode = 2;
	} else if (keycode == Keys.F11) {
		ExterminateGame.fullscree = !ExterminateGame.fullscree;

		ExterminateGame.updateFullscreen();
	}
	if (keycode == Keys.F3) {
		InGame.showInfo = !InGame.showInfo;
	}
	if (keycode == Keys.F4) {
		drawHitBox = !drawHitBox;
	}

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

示例5: keyUp

@Override
public boolean keyUp (int keycode) {
	boolean result = tests[testIndex].keyUp(keycode);
	if ((result == false) && (keycode == Keys.SPACE || keycode == Keys.MENU)) {
		next();
		result = true;
	}
	return result;
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:9,代碼來源:BulletTestCollection.java

示例6: keyDown

@Override
public boolean keyDown (int keycode) {
	
	switch (state) {
	
	case GAME_READY:
		
		if (keycode == Keys.LEFT || keycode == Keys.RIGHT) {
			leftPrompt.addAction(Actions.fadeOut(FADE_INTERVAL));
			rightPrompt.addAction(Actions.fadeOut(FADE_INTERVAL));
			state = GAME_RUNNING;
		}
		//break;
	
	case GAME_RUNNING:
		
		if (keycode == Keys.LEFT) {
			player.getBody().setLinearVelocity(new Vector2(-BALL_JUMP_X, BALL_JUMP_Y));
		}
		if (keycode == Keys.RIGHT) {
			player.getBody().setLinearVelocity(new Vector2(BALL_JUMP_X, BALL_JUMP_Y));
		}
		break;
	
	case GAME_OVER:
		if (keycode == Keys.SPACE) {
			stage.addAction(Actions.sequence(Actions.fadeOut(0.25f), new Action() {
				public boolean act(float delta) {
					game.setScreen(new GameScreen(game));
					return true;
				}
			}));
		}
		break;
		
	}
	
	return true;
}
 
開發者ID:zozotintin,項目名稱:Dodgy-Dot,代碼行數:39,代碼來源:GameScreen.java

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

示例8: keyDown

@Override
public boolean keyDown(int keycode) {

    if (keycode == Keys.SPACE){
        randomKick();
    }

    if (keycode == Keys.R){
        init();
    }


    return true;
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:14,代碼來源:BouncingBall.java

示例9: main

public static void main (String[] args) {
data = InterScreenData.getInstance("desktop_keys");
int[] keys = new int[]{Keys.LEFT, Keys.RIGHT, Keys.SPACE, Keys.Z};
data.setData(keys);

try{
	UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e){
	
}

String out = (String) JOptionPane.showInputDialog(null, 
        "Setup",
        "Screen Resolution",
        JOptionPane.QUESTION_MESSAGE, 
        null, 
        res, 
        res[0]);

String[] options = null;

if(out == null){
	return;
} else if(out.equals("Full Screen")){
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	options = new String[]{(int)screenSize.getWidth() + "", (int)screenSize.getWidth() + ""};
} else {
	options = out.split(", ");
}

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.allowSoftwareMode = true;
config.fullscreen = out.equals("Full Screen");
config.width = Integer.parseInt(options[0]);
config.height = Integer.parseInt(options[1]);

      new LwjglApplication(new NerdShooter(), config);
  }
 
開發者ID:Xemplar,項目名稱:NerdShooter,代碼行數:38,代碼來源:DesktopLauncher.java

示例10: keyDown

@Override
public boolean keyDown(int keycode) {

    if (keycode == Keys.SPACE) {
        randomKick();
    }
    if (keycode == Keys.R) {
        init();
    }

    return true;
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:12,代碼來源:BouncingBall.java

示例11: keyUp

@Override
public boolean keyUp(int keycode) {
    if (keycode == Keys.SPACE) {
        inCloseupMode = !inCloseupMode;
    }
    // Reset
    if (keycode == Keys.R) {
        closeupCamera.setToOrtho(false, Gdx.graphics.getWidth() * INITIAL_ZOOM, Gdx.graphics.getHeight() * INITIAL_ZOOM);
    }
    if (keycode == Keys.F) {
        fixAspectRatio();
    }
    return super.keyUp(keycode);
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:14,代碼來源:DemoCamera.java

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

示例13: keyDown

@Override
public boolean keyDown(int keycode) {

    if (keycode == Keys.SPACE) {
        randomKick();
    }

    if (keycode == Keys.R) {
        init();
    }

    return true;
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:13,代碼來源:BouncingBall.java

示例14: keyDown

@Override
public boolean keyDown(int keycode) {

    if (keycode == Keys.SPACE){
        randomKick();
    }

    // TODO: If Keys.R was pressed, call init() to reset the ball
    if (keycode == Keys.R){
        init();
    }

    return true;
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:14,代碼來源:BouncingBall.java

示例15: keyUp

@Override
public boolean keyUp(int keycode) {
    if (keycode == Keys.SPACE) {
        if (currentScreen == 1) {
            currentScreen = 2;
            game.setScreen(screen2);
        } else {
            currentScreen = 1;
            game.setScreen(screen1);
        }
    }
    return true;
}
 
開發者ID:udacity,項目名稱:ud405,代碼行數:13,代碼來源:ScreenSwitcher.java


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