Java Code Examples for com.badlogic.gdx.Input.Keys#SPACE

The following examples show how to use com.badlogic.gdx.Input.Keys#SPACE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BouncingBall.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyDown(int keycode) {

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

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


    return true;
}
 
Example 2
Source File: BallScreen.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyUp(int keycode) {
    if (keycode == Keys.SPACE) {
        initBalls();
    }
    return false;
}
 
Example 3
Source File: BouncingBall.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyDown(int keycode) {

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

    return true;
}
 
Example 4
Source File: BouncingBall.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyDown(int keycode) {

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

    return true;
}
 
Example 5
Source File: DemoCamera.java    From ud405 with MIT License 5 votes vote down vote up
@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);
}
 
Example 6
Source File: BallScreen.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyUp(int keycode) {
    if (keycode == Keys.SPACE) {
        initBalls();
    }
    return false;
}
 
Example 7
Source File: BouncingBall.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyDown(int keycode) {

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

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

    return true;
}
 
Example 8
Source File: BouncingBall.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public boolean keyDown(int keycode) {

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

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


    return true;
}
 
Example 9
Source File: BouncingBall.java    From ud405 with MIT License 5 votes vote down vote up
@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;
}
 
Example 10
Source File: ScreenSwitcher.java    From ud405 with MIT License 5 votes vote down vote up
@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;
}
 
Example 11
Source File: BulletTargetInputProcessor.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
public boolean keyDown (int keycode) {
	if (keycode == Keys.SPACE) {
		moveTarget = true;
		return true;
	}
	return false;
}
 
Example 12
Source File: BulletTargetInputProcessor.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
@Override
public boolean keyUp (int keycode) {
	if (keycode == Keys.SPACE) {
		moveTarget = false;
		return true;
	}
	return false;
}
 
Example 13
Source File: BouncingBall.java    From ud405 with MIT License 3 votes vote down vote up
@Override
public boolean keyDown(int keycode) {

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

    // TODO: If Keys.R was pressed, call init() to reset the ball


    return true;
}
 
Example 14
Source File: BouncingBall.java    From ud405 with MIT License 3 votes vote down vote up
/**
 * TODO: Override keyDown
 *
 * keyDown receives an argument that says what key was pressed. In this case we check to see if
 * that key was the space bar. If so, we give the ball a random kick.
 *
 * The return value of all the InputProcessor methods is a boolean signifying whether the input
 * event was handled. This becomes relevant when you're dealing with a more complex game where
 * there might be multiple classes responding to input events. In this case, this is the only
 * class that cares about input events, so we can go ahead and say we dealt with the event.
 *
 * If we run the game right now, this will never be called, because we still need to tell LibGDX
 * that this class is interested in input events. Let's fix that over in BallScreen.
 */

@Override
public boolean keyDown(int keycode) {
    if (keycode == Keys.SPACE) {
        randomKick();
    }
    return true;
}