Added mouse event

This commit is contained in:
MachineMuse 2013-09-04 15:00:04 -06:00
parent d9b72a2282
commit e3e3ea54f9
2 changed files with 37 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import java.util.TreeSet;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import net.minecraftforge.client.event.MouseEvent;
import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display; import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -325,6 +326,10 @@ public class ForgeHooksClient
} }
} }
public static boolean postMouseEvent() {
return MinecraftForge.EVENT_BUS.post(new MouseEvent());
}
/** /**
* Initialization of Forge Renderers. * Initialization of Forge Renderers.
*/ */

View file

@ -0,0 +1,32 @@
package net.minecraftforge.client.event;
import net.minecraftforge.event.Cancelable;
import net.minecraftforge.event.Event;
import org.lwjgl.input.Mouse;
/**
* Author: MachineMuse (Claire Semple)
* Created: 2:46 PM, 9/4/13
*/
@Cancelable
public class MouseEvent extends Event {
public final int x;
public final int y;
public final int dx;
public final int dy;
public final int dwheel;
public final int button;
public final boolean buttonstate;
public final long nanoseconds;
public MouseEvent() {
this.x = Mouse.getEventX();
this.y = Mouse.getEventY();
this.dx = Mouse.getEventDX();
this.dy = Mouse.getEventDY();
this.dwheel = Mouse.getEventDWheel();
this.button = Mouse.getEventButton();
this.buttonstate = Mouse.getEventButtonState();
this.nanoseconds = Mouse.getEventNanoseconds();
}
}