package projectzombie.input.types;

import gl_engine.vec.Vec2d;
import projectzombie.Main;
import projectzombie.menu.gui.GUI;
import projectzombie.util.gl.GlHelpers;

public class InputGUI implements Input
{
	private GUI gui;
	private boolean gunStateLast = false;
	private boolean actionStateLast = false;
	
	public InputGUI(GUI gui) {
		this.gui = gui;
	}
	
	public GUI getGUI() {
		return gui;
	}
	
	@Override
	public void move(boolean state, double angle) {
		this.gui.onMove(state, angle);
	}

	@Override
	public void fire(boolean state) {
		if(state) {
			gunStateLast = true;
		}

		else if(gunStateLast) {
			gunStateLast = false;
			gui.onMouseClick();
		}
	}

	@Override
	public void camera(boolean state, double amount) {}

	@Override
	public void itemAction(boolean state) {
		if(state) {
			actionStateLast = true;
		}

		else if(actionStateLast) {
			actionStateLast = false;
			gui.onRightClick();
		}
	}

	@Override
	public void itemDrop(boolean state) {}

	@Override
	public void pause(boolean state) {}

	@Override
	public void hotbarGoto(boolean state, int pos) {}

	@Override
	public void hotbarShift(boolean state, int amount) {
		gui.onScroll(amount);
	}
	
	@Override
	public void back(boolean state) {
		gui.onBack();
	}
	
	@Override
	public void activate(boolean state) {
		gui.onActivate();
	}
	
	@Override
	public void openInventory() {
	}
	
	@Override
	public void type(char character) {
		gui.type(character);
	}
	
	@Override
	public void key(int key) {
		gui.keyPress(key);
	}
	
	@Override
	public void keyCtrl(int key) {
		gui.keyPressCtrl(key);
	}

}
