当前位置: 首页>>代码示例>>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;未经允许,请勿转载。