Example usage for com.badlogic.gdx InputProcessor keyDown

List of usage examples for com.badlogic.gdx InputProcessor keyDown

Introduction

In this page you can find the example usage for com.badlogic.gdx InputProcessor keyDown.

Prototype

public boolean keyDown(int keycode);

Source Link

Document

Called when a key was pressed

Usage

From source file:com.blackboxgaming.engine.factories.LayerFactory.java

@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
    InputProcessor input = Gdx.input.getInputProcessor();
    input.keyDown(Keys.SPACE);
    return true;/* w w  w.j a v  a  2 s . co  m*/
}

From source file:com.blackboxgaming.engine.factories.LayerFactory.java

@Override
public void touchDragged(InputEvent event, float x, float y, int pointer) {
    float cx = x - 75;
    cx = (cx < -25 ? -1 : (cx > 25 ? 1 : 0));
    InputProcessor input = Gdx.input.getInputProcessor();
    if (cx == 1) {
        input.keyDown(Keys.E);
        input.keyUp(Keys.Q);//  w w  w  .j  a va 2 s  .  co m
    } else if (cx == -1) {
        input.keyDown(Keys.Q);
        input.keyUp(Keys.E);
    } else if (cx == 0) {
        input.keyUp(Keys.Q);
        input.keyUp(Keys.E);
    }
}

From source file:com.kamigaku.libgdx.extension.InputMultiplexerToggle.java

@Override
public boolean keyDown(int keycode) {
    for (InputProcessor ip : _processors.keySet())
        if (_processors.get(ip) && ip.keyDown(keycode))
            return true;
    return false;
}