Package org.lwjgl.input
Class Cursor
java.lang.Object
org.lwjgl.input.Cursor
A class representing a native cursor. Instances of this
class can be used with Mouse.setCursor(), if available.
- Version:
- $Revision$ $Id$
- Author:
- elias_naur <elias_naur@users.sourceforge.net>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
8 bit alhpa native cursorstatic final int
animation native cursorstatic final int
1 bit transparency for native cursor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Destroy the native cursor.static int
Get the capabilities of the native cursor.static int
Gets the maximum size of a native cursor.static int
Gets the minimum size of a native cursor.protected boolean
Determines whether this cursor has timed outprotected void
Changes to the next cursorprotected void
Sets the timout property to the time it should be changed
-
Field Details
-
CURSOR_ONE_BIT_TRANSPARENCY
1 bit transparency for native cursor- See Also:
-
CURSOR_8_BIT_ALPHA
8 bit alhpa native cursor- See Also:
-
CURSOR_ANIMATION
animation native cursor- See Also:
-
-
Constructor Details
-
Cursor
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported. So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values. The constructor will copy the images and delays, so there's no need to keep them around.- Parameters:
width
- cursor image widthheight
- cursor image heightxHotspot
- the x coordinate of the cursor hotspotyHotspot
- the y coordinate of the cursor hotspotnumImages
- number of cursor images specified. Must be 1 if animations are not supported.images
- A buffer containing the images. The origin is at the lower left corner, like OpenGL.delays
- An int buffer of animation frame delays, if numImages is greater than 1, else null- Throws:
LWJGLException
- if the cursor could not be created for any reason
-
-
Method Details
-
getMinCursorSize
public static int getMinCursorSize()Gets the minimum size of a native cursor. Can only be called if The Mouse is created and cursor caps includes at least CURSOR_ONE_BIT_TRANSPARANCY.- Returns:
- the maximum size of a native cursor
-
getMaxCursorSize
public static int getMaxCursorSize()Gets the maximum size of a native cursor. Can only be called if The Mouse is created and cursor caps includes at least CURSOR_ONE_BIT_TRANSPARANCY.- Returns:
- the maximum size of a native cursor
-
getCapabilities
public static int getCapabilities()Get the capabilities of the native cursor. Return a bit mask of the native cursor capabilities. The CURSOR_ONE_BIT_TRANSPARANCY indicates support for cursors with one bit transparancy, the CURSOR_8_BIT_ALPHA indicates support for 8 bit alpha and CURSOR_ANIMATION indicates support for cursor animations.- Returns:
- A bit mask with native cursor capabilities.
-
destroy
public void destroy()Destroy the native cursor. If the cursor is current, the current native cursor is set to null (the default OS cursor) -
setTimeout
protected void setTimeout()Sets the timout property to the time it should be changed -
hasTimedOut
protected boolean hasTimedOut()Determines whether this cursor has timed out- Returns:
- true if the this cursor has timed out, false if not
-
nextCursor
protected void nextCursor()Changes to the next cursor
-