User Tools

Site Tools


en:tutorials:display:custom_mouse_cursor

This is an old revision of the document!


Custom Mouse Cursors

The Cursor property allows you set the type of mouse cursor image that is used when over the active window, or game. There are several standard ones built-in provided by the OSarrow|ibeam|crosshair|hand|hresize|vresize|default

[Display]
Cursor = hand

Alternatively, a very nifty feature is to provide your own png image as the cursor. Great for games where a fancy cursor is needed, ie:

[Display]
Cursor = amiga-cursor.png

By default, this will place the cursor in the top left hand corner. You can move this hotspot by providing an optional vector, ie:

[Display]
cursor = amiga-cursor.png # (10, 10, 0)

And like a normal cursor, it will hang outside the bounds of the window when you are the right or bottom extremes. Very nice.

You can change cursors using the Orx Console. Press the ~ key to open the console and type:

  Mouse.SetCursor crosshair

Finally, you can set a mouse cursor in code:

orxMouse_SetCursor("hresize", orxNULL);

This will set the cursor to a hand, and keep the default hotspot by using orxNULL. Change the hotspot position using a vector like:

orxVECTOR hotspot = orxVECTOR_0;
hotspot.fX = 10;
hotspot.fY = 10;
 
orxMouse_SetCursor("hresize", &hotspot);
en/tutorials/display/custom_mouse_cursor.1536573844.txt.gz · Last modified: 2018/09/10 06:04 (7 years ago) (external edit)