Allows you to set an image for the cursor. This must be an image uploaded using the asset manager.
The 'image' can be used in two different ways. First it can be the name of an uploaded image:
setCursor( 'my_image.png' )
It can also be an image object:
cursor = new Image( 'my_image.png' )
setCursor( cursor )
Finally to clear the cursor, and go back to the default, you can pass in 'null'.
setCursor( null )
This version of setCursor allows you to specify the 'hotspot' inside the cursor. This is the location in the image which should be used as the clicking point of the cursor.
By default, the top left corner of the image, at the location 0x0, is the hotspot.
For example if you have a cross hair, then this could be located at half the width and half the image height.
setCursor( crosshair, crosshair.getWidth()/2, crosshair.getHeight()/2 )
In this example, a cursor is created, and then set. The image set is then updated later, showing how the cursor will keep displaying that image given, and change over time.
* An example of setting a cursor, which you
* then manually change yourself, over time.
cursor = new Image( 100, 100 )
// cursor is set here, and updated later
setCursor( cursor, cursor.getWidth()/2, cursor.getHeight()/2 )
// The code inside this do block is run each frame
fill( :white )
// work out current cursor colour
angle = ( getTime() / 10 ).toRadians()
cursor.setColor( angle.sin(0, 255), angle.cos(0, 255), angle.tan(0, 255) )
cursor.fillCircle( 0, 0, 100 )