public class Mouse
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_SIZE
Internal use - event size in bytes
|
Modifier and Type | Method and Description |
---|---|
static void |
create()
"Create" the mouse.
|
static void |
destroy()
"Destroy" the mouse.
|
static int |
getButtonCount() |
static int |
getButtonIndex(java.lang.String buttonName)
Get's a button's index.
|
static java.lang.String |
getButtonName(int button)
Gets a button's name
|
static int |
getDWheel() |
static int |
getDX() |
static int |
getDY() |
static int |
getEventButton() |
static boolean |
getEventButtonState()
Get the current events button state.
|
static int |
getEventDWheel() |
static int |
getEventDX() |
static int |
getEventDY() |
static long |
getEventNanoseconds()
Gets the time in nanoseconds of the current event.
|
static int |
getEventX() |
static int |
getEventY() |
static Cursor |
getNativeCursor()
Gets the currently bound native cursor, if any.
|
static int |
getX()
Retrieves the absolute position.
|
static int |
getY()
Retrieves the absolute position.
|
static boolean |
hasWheel() |
static boolean |
isButtonDown(int button)
See if a particular mouse button is down.
|
static boolean |
isClipMouseCoordinatesToWindow() |
static boolean |
isCreated() |
static boolean |
isGrabbed() |
static boolean |
isInsideWindow()
Retrieves whether or not the mouse cursor is within the bounds of the window.
|
static boolean |
next()
Gets the next mouse event.
|
static void |
poll()
Polls the mouse for its current state.
|
static void |
setClipMouseCoordinatesToWindow(boolean clip) |
static void |
setCursorPosition(int new_x,
int new_y)
Set the position of the cursor.
|
static void |
setGrabbed(boolean grab)
Sets whether or not the mouse has grabbed the cursor
(and thus hidden).
|
static Cursor |
setNativeCursor(Cursor cursor)
Binds a native cursor.
|
static void |
updateCursor()
Updates the cursor, so that animation can be changed if needed.
|
public static final int EVENT_SIZE
public static Cursor getNativeCursor()
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException
cursor
- the native cursor object to bind. May be null.LWJGLException
- if the cursor could not be set for any reasonpublic static boolean isClipMouseCoordinatesToWindow()
public static void setClipMouseCoordinatesToWindow(boolean clip)
public static void setCursorPosition(int new_x, int new_y)
new_x
- The x coordinate of the new cursor position in OpenGL coordinates relative
to the window origin.new_y
- The y coordinate of the new cursor position in OpenGL coordinates relative
to the window origin.public static void create() throws LWJGLException
LWJGLException
- if the mouse could not be created for any reasonpublic static boolean isCreated()
public static void destroy()
public static void poll()
next
for each event you
want to read. You can query which button caused the event by using
getEventButton
. To get the state of that button, for that event, use
getEventButtonState
.
NOTE: This method does not query the operating system for new events. To do that,
Display.processMessages() (or Display.update()) must be called first.public static boolean isButtonDown(int button)
button
- The index of the button you wish to test (0..getButtonCount-1)public static java.lang.String getButtonName(int button)
button
- The buttonpublic static int getButtonIndex(java.lang.String buttonName)
buttonName
- The button namepublic static boolean next()
getEventButton()
(if any). To get the state of that key, for that event, use
getEventButtonState
. To get the current mouse delta values use getEventDX()
and getEventDY()
.getEventButton()
,
getEventButtonState()
public static int getEventButton()
public static boolean getEventButtonState()
public static int getEventDX()
public static int getEventDY()
public static int getEventX()
public static int getEventY()
public static int getEventDWheel()
public static long getEventNanoseconds()
public static int getX()
public static int getY()
public static int getDX()
public static int getDY()
public static int getDWheel()
public static int getButtonCount()
public static boolean hasWheel()
public static boolean isGrabbed()
public static void setGrabbed(boolean grab)
grab
- whether the mouse should be grabbedpublic static void updateCursor()
public static boolean isInsideWindow()
Copyright © 2002-2009 lwjgl.org. All Rights Reserved.