# CursorLoader (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.opengl
Class CursorLoader

    java.lang.Object
      org.newdawn.slick.opengl.CursorLoader

    public class CursorLoader

extends java.lang.Object

A utility to load cursors (thanks go to Kappa for the animated cursor loader)

Author:
  Kevin Glass, Kappa-One

Method Summary
`static CursorLoader` `get()` Retrieve the single instance of this loader - convinient huh?
`org.lwjgl.input.Cursor` `getAnimatedCursor(java.lang.String ref, int x, int y, int width, int height, int[] cursorDelays)` Get a cursor based on a image reference on the classpath.
`org.lwjgl.input.Cursor` `getCursor(java.nio.ByteBuffer buf, int x, int y, int width, int height)` Get a cursor based on a set of image data
`org.lwjgl.input.Cursor` `getCursor(ImageData imageData, int x, int y)` Get a cursor based on a set of image data
`org.lwjgl.input.Cursor` `getCursor(java.lang.String ref, int x, int y)` Get a cursor based on a image reference on the classpath

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### get

    public static CursorLoader get()

  Retrieve the single instance of this loader - convinient huh?

  Returns:
    The single instance of the cursor loader

### getCursor

    public org.lwjgl.input.Cursor getCursor(java.lang.String ref,
                                            int x,
                                            int y)
                                     throws java.io.IOException,
                                            org.lwjgl.LWJGLException

  Get a cursor based on a image reference on the classpath

  Parameters:
    `ref` - The reference to the image to be loaded
    `x` - The x-coordinate of the cursor hotspot (left -> right)
    `y` - The y-coordinate of the cursor hotspot (bottom -> top)
  Returns:
    The create cursor
  Throws:
    `java.io.IOException` - Indicates a failure to load the image
    `org.lwjgl.LWJGLException` - Indicates a failure to create the hardware cursor

### getCursor

    public org.lwjgl.input.Cursor getCursor(java.nio.ByteBuffer buf,
                                            int x,
                                            int y,
                                            int width,
                                            int height)
                                     throws java.io.IOException,
                                            org.lwjgl.LWJGLException

  Get a cursor based on a set of image data

  Parameters:
    `buf` - The image data (stored in RGBA) to load the cursor from
    `x` - The x-coordinate of the cursor hotspot (left -> right)
    `y` - The y-coordinate of the cursor hotspot (bottom -> top)
    `width` - The width of the image data provided
    `height` - The height of the image data provided
  Returns:
    The create cursor
  Throws:
    `java.io.IOException` - Indicates a failure to load the image
    `org.lwjgl.LWJGLException` - Indicates a failure to create the hardware cursor

### getCursor

    public org.lwjgl.input.Cursor getCursor(ImageData imageData,
                                            int x,
                                            int y)
                                     throws java.io.IOException,
                                            org.lwjgl.LWJGLException

  Get a cursor based on a set of image data

  Parameters:
    `imageData` - The data from which the cursor can read it's contents
    `x` - The x-coordinate of the cursor hotspot (left -> right)
    `y` - The y-coordinate of the cursor hotspot (bottom -> top)
  Returns:
    The create cursor
  Throws:
    `java.io.IOException` - Indicates a failure to load the image
    `org.lwjgl.LWJGLException` - Indicates a failure to create the hardware cursor

### getAnimatedCursor

    public org.lwjgl.input.Cursor getAnimatedCursor(java.lang.String ref,
                                                    int x,
                                                    int y,
                                                    int width,
                                                    int height,
                                                    int[] cursorDelays)
                                             throws java.io.IOException,
                                                    org.lwjgl.LWJGLException

  Get a cursor based on a image reference on the classpath. The image is assumed to be a set/strip of cursor animation frames running from top to bottom.

  Parameters:
    `ref` - The reference to the image to be loaded
    `x` - The x-coordinate of the cursor hotspot (left -> right)
    `y` - The y-coordinate of the cursor hotspot (bottom -> top)
    `width` - The x width of the cursor
    `height` - The y height of the cursor
    `cursorDelays` - image delays between changing frames in animation
  Returns:
    The created cursor
  Throws:
    `java.io.IOException` - Indicates a failure to load the image
    `org.lwjgl.LWJGLException` - Indicates a failure to create the hardware cursor

Copyright © 2006 New Dawn Software. All Rights Reserved.