package speiger.src.coreengine.rendering.input.events;

import speiger.src.coreengine.rendering.input.window.ScaledResolution;
import speiger.src.coreengine.utils.eventbus.Event;

public class MouseEvent extends Event
{
	public int mouseX;
	public int mouseY;
	public final int originX;
	public final int originY;
	
	public MouseEvent(int x, int y)
	{
		mouseX = x;
		mouseY = y;
		originX = x;
		originY = y;
	}
	
	public void convertToOrigin()
	{
		mouseX = originX;
		mouseY = originY;
	}
	
	public void convertToScreenCoords(ScaledResolution res)
	{
		res.getScaledMouseEvent(this);
	}
	
	@Override
	public boolean isCancelable()
	{
		return true;
	}
	
	public boolean isForced()
	{
		return false;
	}
	
	public static class MouseClickEvent extends MouseEvent
	{
		public final int button;
		public final boolean press;
		
		public MouseClickEvent(int x, int y, int button, boolean press)
		{
			super(x, y);
			this.button = button;
			this.press = press;
		}
		
		//Forced so Buttons are always released. Maybe gets disabled. Not sure yet
		@Override
		public boolean isForced()
		{
			return !press;
		}
	}
	
	public static class MouseMoveEvent extends MouseEvent
	{
		public final int xMove;
		public final int yMove;
		
		public MouseMoveEvent(int x, int y, int xMove, int yMove)
		{
			super(x, y);
			this.xMove = xMove;
			this.yMove = yMove;
		}
	}
	
	public static class MouseScrollEvent extends MouseEvent
	{
		public final int scrollX;
		public final int scrollY;
		
		public MouseScrollEvent(int x, int y, int scrollX, int scrollY)
		{
			super(x, y);
			this.scrollX = scrollX;
			this.scrollY = scrollY;
		}
	}
}
