package uk.co.beercave.gunboat;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.OrthographicCamera;

public class KeyboardController implements GameController {

	private float x;
	private boolean fire;
	@Override
	public float getX() {
		return x;
	}

	@Override
	public boolean getFire() {
		return fire;
	}

	@Override
	public void drawUIElements() {
		//nothing to do here, but the touchscreen versions will be able to draw control overlays
	}

	
	@Override
	public void update(float delta, OrthographicCamera camera) {
		x = 0;
		if (Gdx.input.isKeyPressed(Keys.LEFT)) x = -1;
		if (Gdx.input.isKeyPressed(Keys.RIGHT)) x = 1;
		fire = Gdx.input.isKeyPressed(Keys.SPACE) || Gdx.input.isKeyPressed(Keys.CONTROL_LEFT);
	}

}
