Search in sources :

Example 1 with GestureDetector

use of com.badlogic.gdx.input.GestureDetector in project libgdx by libgdx.

the class BulletTestCollection method create.

@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);
}
Also used : CameraInputController(com.badlogic.gdx.graphics.g3d.utils.CameraInputController) InputMultiplexer(com.badlogic.gdx.InputMultiplexer) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) GestureDetector(com.badlogic.gdx.input.GestureDetector) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont)

Example 2 with GestureDetector

use of com.badlogic.gdx.input.GestureDetector in project libgdx by libgdx.

the class Box2DTestCollection method create.

@Override
public void create() {
    if (this.app == null) {
        this.app = Gdx.app;
        Box2DTest test = tests[testIndex];
        test.create();
    }
    InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(this);
    multiplexer.addProcessor(new GestureDetector(this));
    Gdx.input.setInputProcessor(multiplexer);
}
Also used : InputMultiplexer(com.badlogic.gdx.InputMultiplexer) Box2DTest(com.badlogic.gdx.tests.box2d.Box2DTest) GestureDetector(com.badlogic.gdx.input.GestureDetector)

Example 3 with GestureDetector

use of com.badlogic.gdx.input.GestureDetector in project libgdx by libgdx.

the class GestureDetectorTest method create.

@Override
public void create() {
    texture = new Texture("data/stones.jpg");
    batch = new SpriteBatch();
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    controller = new CameraController();
    gestureDetector = new GestureDetector(20, 0.5f, 2, 0.15f, controller);
    Gdx.input.setInputProcessor(gestureDetector);
}
Also used : OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) GestureDetector(com.badlogic.gdx.input.GestureDetector) Texture(com.badlogic.gdx.graphics.Texture) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

Aggregations

GestureDetector (com.badlogic.gdx.input.GestureDetector)3 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)2 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)1 Texture (com.badlogic.gdx.graphics.Texture)1 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 CameraInputController (com.badlogic.gdx.graphics.g3d.utils.CameraInputController)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 Box2DTest (com.badlogic.gdx.tests.box2d.Box2DTest)1