package com.hexabeast.lasermonster;

import com.badlogic.gdx.Input;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputProcessor;

public class Inputs implements InputProcessor{
	public static Inputs instance;
	public boolean mouseup;
	private boolean tomouseup;
	
	public boolean mousedown;
	private boolean tomousedown;
	
	public boolean leftmousedown;
	private boolean toleftmousedown;
	
	public boolean rightmousedown;
	private boolean torightmousedown;
	
	public boolean leftmouseup;
	private boolean toleftmouseup;
	
	public boolean rightmouseup;
	private boolean torightmouseup;
	
	public boolean middleOrAPressed;
	public boolean tomiddleOrAPressed;
	
	public boolean Q = false;
	public boolean Z = false;
	public boolean S = false;
	public boolean D = false;
	public boolean shift = false;
	public boolean space = false;
	public boolean spacePressed = false;
	
	@Override
	public boolean keyTyped(char character) {return false;}
	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		tomousedown = true;
		
		if (button == Input.Buttons.RIGHT)torightmousedown = true;
		if (button == Input.Buttons.LEFT)toleftmousedown = true;
		
		if(button == Input.Buttons.MIDDLE)tomiddleOrAPressed = true;

		return false;
	}


	public void update()
	{
		
		if(tomouseup)
		{
			mouseup = true;
			tomouseup = false;
		}
		else
		{
			mouseup = false;
		}
		
		if(toleftmouseup)
		{
			leftmouseup = true;
			toleftmouseup = false;
		}
		else
		{
			leftmouseup = false;
		}
		
		if(tomiddleOrAPressed)
		{
			middleOrAPressed = true;
			tomiddleOrAPressed = false;
		}
		else
		{
			middleOrAPressed = false;
		}
		
		if(torightmouseup)
		{
			rightmouseup = true;
			torightmouseup = false;
		}
		else
		{
			rightmouseup = false;
		}
		
		if(tomousedown)
		{
			mousedown = true;
			tomousedown = false;
		}
		else
		{
			mousedown = false;
		}

		
		if(toleftmousedown)
		{
			leftmousedown = true;
			toleftmousedown = false;
		}
		else
		{
			leftmousedown = false;
		}
		
		if(torightmousedown)
		{
			rightmousedown = true;
			torightmousedown = false;
		}
		else
		{
			rightmousedown = false;
		}
		
	}
	
	public void updateLate()
	{
		if(space)space = false;
	}


	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		tomouseup = true;
		if (button == Input.Buttons.RIGHT)torightmouseup = true;
		if (button == Input.Buttons.LEFT)toleftmouseup = true;
		return false;}
	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {return false;}
	@Override
	public boolean mouseMoved(int screenX, int screenY) {return false;}
	@Override
	public boolean scrolled(int amount) 
	{
		return false;
	}
	
	@Override
	public boolean keyDown(int keycode) {
		
			switch(keycode){
			case Keys.V:
				break;
			}
		return false;
	}
	

	@Override
	public boolean keyUp(int keycode) {
			switch(keycode){
			
			case Keys.V:
				break;
			}
		return false;
	}
}
