Java 类com.badlogic.gdx.Input.Keys 实例源码

项目:libgdx-learnlib    文件:WorldController.java   
private void handleInputGame(float deltaTime) {
    if (cameraHelper.hasTarget(level.bunnyHead)) {
        // Player Movement
        if (Gdx.input.isKeyPressed(Keys.LEFT)) {
            level.bunnyHead.velocity.x = -level.bunnyHead.terminalVelocity.x;
        } else if (Gdx.input.isKeyPressed(Keys.RIGHT)) {
            level.bunnyHead.velocity.x = level.bunnyHead.terminalVelocity.x;
        } else {
            // Execute auto-forward movement on non-desktop platform
            if (Gdx.app.getType() != Application.ApplicationType.Desktop) {
                level.bunnyHead.velocity.x = level.bunnyHead.terminalVelocity.x;
            }
        }
        // Bunny Jump
        if (Gdx.input.isTouched() || Gdx.input.isKeyPressed(Keys.SPACE))
            level.bunnyHead.setJumping(true);
        else
            level.bunnyHead.setJumping(false);
    }
}
项目:GDX-Engine    文件:BirdEyeCamera.java   
@Override
public void update()
{
 float gameTime = Gdx.graphics.getDeltaTime();

    if (Gdx.input.isKeyPressed(Keys.UP))      //Forward
        AddToCameraPosition(new Vector3(0, 0, -cameraSpeed * gameTime));
    if (Gdx.input.isKeyPressed(Keys.DOWN))    //Backward
        AddToCameraPosition(new Vector3(0, 0, cameraSpeed * gameTime));
    if (Gdx.input.isKeyPressed(Keys.RIGHT))   //Right
        AddToCameraPosition(new Vector3(cameraSpeed * gameTime, 0, 0));
    if (Gdx.input.isKeyPressed(Keys.LEFT))    //Left
        AddToCameraPosition(new Vector3(-cameraSpeed * gameTime, 0, 0));
    if (Gdx.input.isKeyPressed(Keys.Q))                                     //Up
        AddToCameraPosition(new Vector3(0, cameraSpeed * gameTime, 0));
    if (Gdx.input.isKeyPressed(Keys.Z))                                     //Down
        AddToCameraPosition(new Vector3(0, -cameraSpeed * gameTime, 0));                     
}
项目:GDX-Engine    文件:AngryBirdScene.java   
@Override
   public void update(float gameTime) {
super.update(gameTime);
if (Utils.isKeyDown(Keys.SPACE)) {
    // create a new bird after press space key if the bird is not
    // existed
    if (!checkExistingBird())
    createBird();
}

if (Gdx.input.isKeyPressed(Keys.CONTROL_LEFT)) {
    if (!uiManager.isMenuVisible()) {
    uiManager.setMenuVisible(true);
    }
}
   }
项目:Cubes_2    文件:GuiRenderer.java   
private int keycodeSelectionIf(int keycode){
    if (keycode == Keys.NUM_1) {
        selected = 0;
    }
    if (keycode == Keys.NUM_2) {
        selected = 1;
    }
    if (keycode == Keys.NUM_3) {
        selected = 2;
    }
    if (keycode == Keys.NUM_4) {
        selected = 3;
    }
    if (keycode == Keys.NUM_5) {
        selected = 4;
    }
}
项目:Cubes_2    文件:GuiRenderer.java   
private int keycodeSelection(int keycode) {
    keycodeSelectionIf( keycode);


    if (keycode == Keys.NUM_6) {
        selected = 5;
    }
    if (keycode == Keys.NUM_7) {
        selected = 6;
    }
    if (keycode == Keys.NUM_8) {
        selected = 7;
    }
    if (keycode == Keys.NUM_9) {
        selected = 8;
    }
}
项目:VoiceChat    文件:TestGame.java   
public void render(){
    Gdx.gl.glClearColor(backgroundColour.r, backgroundColour.g, backgroundColour.b, backgroundColour.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    Gdx.graphics.setTitle("Voice Chat Test by James Billy - " + Gdx.graphics.getFramesPerSecond() + "fps");

    batch.begin();
    font.setColor(Color.BLACK);

    // Test only
    if(Gdx.input.isKeyPressed(Keys.SPACE)){         

        // This line here is important, it will send audio when called.
        this.sender.sendVoice(this.client, Gdx.graphics.getDeltaTime());    

        // Test only
        font.draw(batch, "Now sending audio...", 10, 20);           
    }else{
        // Test only
        font.draw(batch, "Press SPACE to send audio!\n"
                + "There may be latency. This is unavoidable, sorry.", 10, 60);
    }
    batch.end();
}
项目:water2d-libgdx    文件:GameMain.java   
@Override
public void render () {
    // Clean screen
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // creates a square at the clicked point
    if(Gdx.input.justTouched()){ 
        createBody();
    }
    // enable or disable debug mode
    if(Gdx.input.isKeyJustPressed(Keys.D)){ 
        water.setDebugMode(!water.isDebugMode());
    }

    world.step(1/60f, 6, 2);

    water.update();
    water.draw(camera);

    debugRenderer.render(world, camera.combined);
}
项目:MMORPG_Prototype    文件:PlayInputSingleHandle.java   
@Override
public boolean keyDown(int keycode)
{   
    if(shouldAvoidInput())
        return false;

    ActorManipulator dialogs = userInterface.getDialogs();
    if (dialogs.isMapped(keycode))
        dialogs.showOrHide(keycode);
    else if (keycode >= Keys.NUM_1 && keycode <= Keys.NUM_9)
        spellQuickAccessAction(keycode - Keys.NUM_1);
    else if (keycode >= Keys.F1 && keycode <= Keys.F12)
        itemQuickAccessAction(keycode - Keys.F1);

    return false;
}
项目:minihabits    文件:EditMiniHabitView.java   
private void createUI() {
    setMovable(true);

    text("Insert the Mini-Habit name:")
        .button("OK", true)
        .key(Keys.ENTER, true)
        .button("Cancel", false)
        .key(Keys.ESCAPE, false);

    tfHabitName = new TextField("", getSkin());
    tfHabitName.setMessageText("name");

    Table contentTable = getContentTable();
    contentTable.row();
    contentTable.add(tfHabitName).width(135);
}
项目:minihabits    文件:EditMiniHabitDialog.java   
private void createUI() {
    setMovable(true);

    text("Insert the Mini-Habit name:")
        .button("OK", true)
        .key(Keys.ENTER, true)
        .button("Cancel", false)
        .key(Keys.ESCAPE, false);

    tfHabitName = new TextField("", getSkin());
    tfHabitName.setMessageText("name");

    Table contentTable = getContentTable();
    contentTable.row();
    contentTable.add(tfHabitName).width(135);
}
项目:StarshipFighters    文件:PlayState.java   
@Override
public void handleInput() {

    // Escape to quit to exit faster. Remember to remove this later!
    if (Gdx.input.isKeyPressed(Keys.ESCAPE)) {
        dispose();
        Gdx.app.exit();
    }

    // Set Game Keys
    if (inputAllowed) {
        player.setLeft(GameKeys.isDown(GameKeys.LEFT));
        player.setRight(GameKeys.isDown(GameKeys.RIGHT));
        player.setUp(GameKeys.isDown(GameKeys.UP));
        player.setDown(GameKeys.isDown(GameKeys.DOWN));
        player.setShoot(GameKeys.isDown(GameKeys.SPACE));
        player.setMissile(GameKeys.isPressed(GameKeys.SHIFT));
    }

    // Update Keys
    GameKeys.update();
}
项目:alquran-alkarem    文件:book.java   
private void config_loading_stage() {
    // TODO Auto-generated method stub
    loading_stage = new Stage(managment_viewport, batch);
    loading_stage.addActor(logo_actor);
    loading_stage.addActor(loading_background_actor);
    loading_stage.addActor(loading_actor);
    loading_stage.addListener(new InputListener(){
        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            // TODO Auto-generated method stub
            if(keycode == Keys.BACK){
            back_button_down();
            }
            return true;
        }
    });
}
项目:Cubes    文件:GuiRenderer.java   
@Override
public boolean keyDown(int keycode) {
  if (functionKeys(keycode)) return true;

  if (keycode == blocksMenu) {
    toggleInventory();
    return true;
  }

  int selected = -1;
  if (keycode == Keys.NUM_1) selected = 0;
  if (keycode == Keys.NUM_2) selected = 1;
  if (keycode == Keys.NUM_3) selected = 2;
  if (keycode == Keys.NUM_4) selected = 3;
  if (keycode == Keys.NUM_5) selected = 4;
  if (keycode == Keys.NUM_6) selected = 5;
  if (keycode == Keys.NUM_7) selected = 6;
  if (keycode == Keys.NUM_8) selected = 7;
  if (keycode == Keys.NUM_9) selected = 8;
  if (selected != -1) {
    Cubes.getClient().player.getInventory().hotbarSelected = selected;
    Cubes.getClient().player.getInventory().sync();
    return true;
  }
  return false;
}
项目:Les-Chroniques-de-Norwand    文件:PlayState.java   
public void onKeyPressed(UserEvent e) {
    datapointer.playerinputconvertor.onKeyPressed(e);
    switch (e.value) {
        case Keys.ESCAPE:
            parent.parent.substate = new InGameMenuState(parent.parent);
            break;
        case Keys.A:
            activedcapacity = (byte) ((activedcapacity == 1 || datapointer.player.inventory
                    .getCapFromId((byte) 1) == null) ? 0 : 1);
            break;
        case Keys.Z:
            activedcapacity = (byte) ((activedcapacity == 2 || datapointer.player.inventory
                    .getCapFromId((byte) 2) == null) ? 0 : 2);
            break;
        case Keys.E:
            activedcapacity = (byte) ((activedcapacity == 3 || datapointer.player.inventory
                    .getCapFromId((byte) 3) == null) ? 0 : 3);
            break;
    }
}
项目:EvilBunnyGod    文件:Screen.java   
public Screen(ScreenManager manager) {
    this.manager = manager;

    adapter = new InputAdapter() {
        @Override
        public boolean keyDown(int keycode) {
            if (keycode == Keys.ESCAPE)
                Gdx.app.exit();

            keyPressed = true;
            ScreenManager.multiplexer.removeProcessor(adapter);
            return true;
        }
    };

    ScreenManager.multiplexer.addProcessor(adapter);
}
项目:base-template    文件:InputHandler.java   
@Override
public boolean keyDown(int keycode) {

    if (keycode == Keys.UP) {
        upPressed = true;
    } else if (keycode == Keys.LEFT) {
        leftPressed = true;
    } else if (keycode == Keys.DOWN) {
        downPressed = true;
    } else if (keycode == Keys.RIGHT) {
        rightPressed = true;
    }

    if (keycode == Keys.E) {
        ePressed = true;
    } else if (keycode == Keys.W) {
        wPressed = true;
    }

    return false;
}
项目:base-template    文件:InputHandler.java   
@Override
public boolean keyUp(int keycode) {

    if (keycode == Keys.UP) {
        upPressed = false;
    } else if (keycode == Keys.LEFT) {
        leftPressed = false;
    } else if (keycode == Keys.DOWN) {
        downPressed = false;
    } else if (keycode == Keys.RIGHT) {
        rightPressed = false;
    }

    // When releasing the action key, reset the key delay so they can be pressed again immediately
    if (keycode == Keys.E) {
        ePressed = false;
        actionDelay = 0;
    }

    return false;
}
项目:joe    文件:ParticleEffectViewer.java   
@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;
}
项目:skin-composer    文件:DialogFonts.java   
private void showAddFontSizeError(String name) {
    Dialog dialog = new Dialog("", getSkin(), "bg");

    dialog.getContentTable().defaults().pad(10.0f);
    Label label = new Label("Error adding font...", getSkin(), "title");
    dialog.getContentTable().add(label);

    dialog.getContentTable().row();
    dialog.text("Unable to add font \"" + name +
            "\". Ensure image dimensions\nare less than max texture dimensions (" +
            maxTextureWidth + "x" + 
            maxTextureHeight + ").\nSee project settings.");

    dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
    dialog.button("Ok");
    dialog.key(Keys.ENTER, null).key(Keys.ESCAPE, null);
    dialog.show(getStage());
}
项目:dice-heroes    文件:DiceTutorial.java   
public static Array<TutorialTask> playPotionsTasks() {
    return tasks(
        new RestrictKeyPresses(Keys.BACK),
        new RestrictKeyPresses(Keys.MENU),
        new RestrictKeyPresses(Keys.ESCAPE),
        new ShowTutorialMessage("tutorial-potions-play-action", false, true),
        new WaitNextLoopIteration(),
        new ShowTutorialArrowOnPotionPlayButton(),
        new ForceClickStage(),
        new HideTutorialArrow(),
        new ShowTutorialMessage("tutorial-potions-play-one-potion-per-turn", false, true),
        new ForceClickStage(),
        new HideTutorialMessage(),
        new AllowKeyPresses(Keys.BACK),
        new AllowKeyPresses(Keys.MENU),
        new AllowKeyPresses(Keys.ESCAPE),
        new EndPlayPotionsTutorial()
    );
}
项目:dice-heroes    文件:DiceTutorial.java   
public static Array<TutorialTask> spawnScrollingTasks() {
    return tasks(
        new RestrictKeyPresses(Keys.BACK),
        new RestrictKeyPresses(Keys.MENU),
        new RestrictKeyPresses(Keys.ESCAPE),
        new ShowTutorialMessage("tutorial-spawn-swipe", true, true),
        new ShowTutorialArrowOnSpawnPanel(),
        new ForceClickStage(),
        new HideTutorialArrow(),
        new HideTutorialMessage(),
        new AllowKeyPresses(Keys.BACK),
        new AllowKeyPresses(Keys.MENU),
        new AllowKeyPresses(Keys.ESCAPE),
        new CompleteSpawnSwipeTutorial()
    );
}
项目:space-arcade    文件:InputHandler.java   
@Override
public boolean keyDown(int keycode) {

    if (keycode == Keys.UP) {
        upPressed = true;
    } else if (keycode == Keys.LEFT) {
        leftPressed = true;
    } else if (keycode == Keys.DOWN) {
        downPressed = true;
    } else if (keycode == Keys.RIGHT) {
        rightPressed = true;
    }

    if (keycode == Keys.E) {
        firePressed = true;
    } else if (keycode == Keys.W) {
        shieldPressed = true;
    }

    if (keycode == Keys.ENTER) {
        startJustPressed = true;
    }

    return false;
}
项目:space-arcade    文件:InputHandler.java   
@Override
public boolean keyUp(int keycode) {

    if (keycode == Keys.UP) {
        upPressed = false;
    } else if (keycode == Keys.LEFT) {
        leftPressed = false;
    } else if (keycode == Keys.DOWN) {
        downPressed = false;
    } else if (keycode == Keys.RIGHT) {
        rightPressed = false;
    }

    // When releasing the action key, reset the key delay so they can be pressed again immediately
    if (keycode == Keys.E) {
        firePressed = false;
        actionDelay = 0;
    }

    return false;
}
项目:neblina-libgdx3d    文件:Invaders.java   
@Override
public void create () {
    Array<Controller> controllers = Controllers.getControllers();
    if (controllers.size > 0) {
        controller = controllers.first();
    }
    Controllers.addListener(controllerListener);

    setScreen(new MainMenu(this));
    music = Gdx.audio.newMusic(Gdx.files.getFileHandle("data/8.12.mp3", FileType.Internal));
    music.setLooping(true);
    music.play();
    Gdx.input.setInputProcessor(new InputAdapter() {
        @Override
        public boolean keyUp (int keycode) {
            if (keycode == Keys.ENTER && Gdx.app.getType() == ApplicationType.WebGL) {
                Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
            }
            return true;
        }
    });

    fps = new FPSLogger();
}
项目:Oozelike    文件:MainScreen.java   
@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0.f, 0.f, 0.f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Core.batch.setProjectionMatrix(camera.combined);
    menu.render(0, 0, (int) camera.viewportWidth, (int) camera.viewportHeight, 5, 5);
    if (Gdx.input.isKeyJustPressed(Keys.UP)){
        menu.increasePointer();
    }
    else if (Gdx.input.isKeyJustPressed(Keys.DOWN)){
        menu.decreasePointer(); 
    }
    else if (Gdx.input.isKeyJustPressed(Keys.ENTER)){
        switch (menu.click()){
        case 0: 
            startNewGame(); break; 
        default:
            loadSavedGame(); break; 
        }
    }
}
项目:RavTech    文件:RavUI.java   
/**
 * @param path - the path to the skin
 */
public RavUI (String path) {        
    if (!VisUI.isLoaded())
        if(path.length() > 0)
            VisUI.load(path);
        else
            VisUI.load();
    screenStage = new Stage(new ScreenViewport());
    debugConsole = new DebugConsole();
    RavTech.input.addInputProcessor(screenStage);
    screenStage.addListener(new InputListener() {
        @Override
        public boolean keyDown (InputEvent event, int key) {
            if (key == Keys.F1)
                debugConsole.toggleVisible();
            return true;
        }
    });
    screenStage.addActor(debugConsole);
}
项目:RavTech    文件:ScriptLoader.java   
private void initEnvironment() {
    ObjectMap<String, Object> values = new ObjectMap<String, Object>();
    values.put("Keys", Keys.class);
    values.put("Input", RavTech.input);
    values.put("Debug", Debug.class);
    values.put("Vector2", Vector2.class);
    values.put("Color", Color.class);
    values.put("Buttons", Buttons.class);
    values.put("GameObject", GameObject.class);
    values.put("ComponentType", ComponentType.class);
    values.put("RavTech", RavTech.class);
    values.put("Settings", RavTech.settings);
    values.put("Graphics", Gdx.graphics);
    values.put("Box2DWorld", RavTech.sceneHandler.box2DWorld);
    values.put("Net", Gdx.net);
    this.environment = values;
}
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }
项目:libgdxjam    文件:CameraSystem.java   
private void updateFlyMode(float deltaTime) {
    velocity.set(0.0f, 0.0f);

    if (Gdx.input.isKeyPressed(Keys.RIGHT)) {
        velocity.x = 1.0f;
    }
    else if (Gdx.input.isKeyPressed(Keys.LEFT)) {
        velocity.x = -1.0f;
    }

    if (Gdx.input.isKeyPressed(Keys.UP)) {
        velocity.y = 1.0f;
    }
    else if (Gdx.input.isKeyPressed(Keys.DOWN)) {
        velocity.y = -1.0f;
    }

    velocity.nor();
    velocity.scl(deltaTime);
    velocity.scl(CAMERA_FLY_SPEED);
    camera.position.add(velocity.x, velocity.y, 0.0f);
}
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }
项目:libgdxjam    文件:PlayerSystem.java   
private void updateStance(Entity entity) {
    PlayerComponent player = Mappers.player.get(entity);

    boolean wasCrouching = player.crouching;

    player.crouching = player.grounded &&
                       !isInputBlocked && 
                       Gdx.input.isKeyPressed(Keys.DOWN);

    if (!wasCrouching && player.crouching) {
        setStance(entity, crouchStance);
    }
    else if (wasCrouching && !player.crouching) {
        setStance(entity, standStance);
    }

    player.currMaxVelX = 0.0f;

    if (player.grounded) {
        player.currMaxVelX = player.crouching ? player.maxVelocityCrouchX :
                                                player.maxVelocityX;
    }
    else {
        player.currMaxVelX = player.maxVelocityJumpX;
    }
}
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }
项目:clouboy    文件:IngameScreen.java   
@Override
protected void onRender(Batch batch, float delta) {
  if (Gdx.input.isKeyJustPressed(Keys.ESCAPE) || Gdx.input.isKeyJustPressed(Keys.BACK)) {
    if (!gameOver) {
      gameOver();
    } else {
      Gdx.app.exit();
      return;
    }
  }
  if (!gameOver) {
    cloudGenerator.update(delta);
  } else {
    wasTouchUp = !Gdx.input.isTouched();
  }
  background.setPosition(camera.position.x - (camera.zoom * camera.viewportWidth) / 2, camera.position.y
      - (camera.zoom * camera.viewportHeight) / 2);
  background.setSize(camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom);
  background.draw(batch, 1f);
  particleRenderer.updateAndRender(delta, batch);
  if (!gameOver) {
    world.updateAndRender(batch, delta);
    checkForGameOver();
  }
}
项目:eamaster    文件:BulletTestCollection.java   
@Override
public void create () {
    if (app == null) {
        app = Gdx.app;
        tests[testIndex].create();
    }

    cameraController = new CameraInputController(tests[testIndex].camera);
    cameraController.activateKey = Keys.CONTROL_LEFT;
    cameraController.autoUpdate = false;
    cameraController.forwardTarget = false;
    cameraController.translateTarget = false;
    Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));

    font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
    hud = new Stage();
    hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
    fpsLabel.setPosition(0, 0);
    hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
    titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
    hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
    instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
    instructLabel.setAlignment(Align.top | Align.left);
    instructLabel.setText(tests[testIndex].instructions);
}
项目:Protoman-vs-Megaman    文件:MenuLogic.java   
@Override
public boolean buttonDown(Controller controller, int buttonCode) {
    switch (buttonCode) {
        case 0: {
            // xbox A button
            keyDown(Keys.ENTER);
            break;
        }
        case 7: {
            // xbox START button
            keyDown(Keys.ESCAPE);
            break;
        }
    }

    return true;
}
项目:nvlist    文件:GdxInputAdapterTest.java   
@Test
public void convertKeyboard() throws IllegalArgumentException, IllegalAccessException {
    Set<Integer> unmapped = Sets.newHashSet();

    Map<String, Integer> keyConstants = ReflectUtil.getConstants(Keys.class, Integer.TYPE);
    for (Entry<String, Integer> entry : keyConstants.entrySet()) {
        int keycode = entry.getValue();
        KeyCode result = GdxInputAdapter.convertKeyboard(keycode);
        if (result == KeyCode.UNKNOWN) {
            unmapped.add(keycode);
        }
    }

    Set<Integer> expectedUnsupported = ImmutableSet.of(
            Keys.UNKNOWN, // Unknown should map to unknown
            Keys.ANY_KEY, // There is no 'any' key
            Keys.META_SHIFT_RIGHT_ON // These 'META' constants are not keys
    );
    Assert.assertEquals(expectedUnsupported, unmapped);
}
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }
项目:ud406    文件:ChaseCam.java   
public void update(float delta) {

        if (Gdx.input.isKeyJustPressed(Keys.SPACE)) {
            following = !following;
        }

        if (following) {
            camera.position.x = target.getPosition().x;
            camera.position.y = target.getPosition().y;
        } else {
            if (Gdx.input.isKeyPressed(Keys.A)) {
                camera.position.x -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.D)) {
                camera.position.x += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.W)) {
                camera.position.y += delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
            if (Gdx.input.isKeyPressed(Keys.S)) {
                camera.position.y -= delta * Constants.CHASE_CAM_MOVE_SPEED;
            }
        }
    }