package net.minecraft.src;

import net.lax1dude.eaglercraft.EaglerAdapter;

public class MouseHelper
{
    /** Mouse delta X this frame */
    public int deltaX;

    /** Mouse delta Y this frame */
    public int deltaY;

    /**
     * Grabs the mouse cursor it doesn't move and isn't seen.
     */
    public void grabMouseCursor()
    {
        int var1 = Minecraft.getMinecraft().displayWidth;
        int var2 = Minecraft.getMinecraft().displayHeight;

        EaglerAdapter.mouseSetCursorPosition(var1 / 2, var2 / 2);
        EaglerAdapter.mouseSetGrabbed(true);
        this.deltaX = 0;
        this.deltaY = 0;
    }

    /**
     * Ungrabs the mouse cursor so it can be moved and set it to the center of the screen
     */
    public void ungrabMouseCursor()
    {
        //EaglerAdapter.mouseSetCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2);
        EaglerAdapter.mouseSetGrabbed(false);
    }

    public void mouseXYChange()
    {
        this.deltaX = EaglerAdapter.mouseGetDX();
        this.deltaY = EaglerAdapter.mouseGetDY();
    }
}
