Class Cursor


  • public class Cursor
    extends Object
    A class representing a native cursor. Instances of this class can be used with Mouse.setCursor(), if available.
    Version:
    $Revision$ $Id$
    Author:
    elias_naur
    • Constructor Detail

      • 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 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