org.lwjgl.input
Class Cursor

java.lang.Object
  extended by org.lwjgl.input.Cursor

public class Cursor
extends java.lang.Object

A class representing a native cursor. Instances of this class can be used with Mouse.setCursor(), if available.

Version:
$Revision: 3418 $ $Id: Cursor.java 3418 2010-09-28 21:11:35Z spasi $
Author:
elias_naur

Field Summary
static int CURSOR_8_BIT_ALPHA
          8 bit alhpa native cursor
static int CURSOR_ANIMATION
          animation native cursor
static int CURSOR_ONE_BIT_TRANSPARENCY
          1 bit transparency for native cursor
 
Constructor Summary
Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, java.nio.IntBuffer images, java.nio.IntBuffer delays)
          Constructs a new Cursor, with the given parameters.
 
Method Summary
 void destroy()
          Destroy the native cursor.
static int getCapabilities()
          Get the capabilities of the native cursor.
static int getMaxCursorSize()
          Gets the maximum size of a native cursor.
static int getMinCursorSize()
          Gets the minimum size of a native cursor.
protected  boolean hasTimedOut()
          Determines whether this cursor has timed out
protected  void nextCursor()
          Changes to the next cursor
protected  void setTimeout()
          Sets the timout property to the time it should be changed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURSOR_ONE_BIT_TRANSPARENCY

public static final int CURSOR_ONE_BIT_TRANSPARENCY
1 bit transparency for native cursor

See Also:
Constant Field Values

CURSOR_8_BIT_ALPHA

public static final int CURSOR_8_BIT_ALPHA
8 bit alhpa native cursor

See Also:
Constant Field Values

CURSOR_ANIMATION

public static final int CURSOR_ANIMATION
animation native cursor

See Also:
Constant Field Values
Constructor Detail

Cursor

public Cursor(int width,
              int height,
              int xHotspot,
              int yHotspot,
              int numImages,
              java.nio.IntBuffer images,
              java.nio.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 width
height - cursor image height
xHotspot - the x coordinate of the cursor hotspot
yHotspot - the y coordinate of the cursor hotspot
numImages - 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 Detail

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



Copyright © 2002-2009 lwjgl.org. All Rights Reserved.