All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kennycason.gdx.controller.KeyboardController Maven / Gradle / Ivy

The newest version!
package com.kennycason.gdx.controller;

import com.badlogic.gdx.Gdx;
import com.kennycason.gdx.controller.controls.Controls;
import com.kennycason.gdx.controller.mapping.ButtonMapper;

/**
 * Created by kenny on 5/22/15.
 *
 * A very basic keyboard controller implementation.
 */
public class KeyboardController extends Controller {

    public KeyboardController(final ButtonMapper buttonMapper) {
        super.buttonMapper = buttonMapper;
    }

    @Override
    public boolean isPressed(V control) {
        final boolean pressed = Gdx.input.isKeyPressed(buttonMapper.get(control));
        if (pressed) { record(control); }
        return pressed;
    }

    @Override
    public float getAxis(V control) {
        return 0f;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy