Re: [AD] Using system mouse cursor

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
I'm still not sure I like the idea of having to use a different function to
set a custom mouse cursor for the hardware mouse though...

You don't. set_mouse_cursor would set the internal mouse bitmap holder for the specified cursor_id.. this is irrespective of whether or not the hardware mouse is used or not.. it just stores a (copy of the?) bitmap internally. Then when you call select_mouse_cursor, it sets either the Allegro mouse sprite pointer (for software mode) or sets the OS/hardware cursor. Passing NULL to set_mouse_cursor will use the default OS cursor if available (and return success) or the default Allegro cursor (and return failure).

So, in summary, that would mean:

int set_mouse_cursor(int cursor_id, BITMAP *sprite);
Sets the cursor ID to the bitmap sprite. If sprite is NULL, the default OS
cursor is used. Returns (something) on success or (not something) on failure.

void select_mouse_cursor(int cursor_id);
Selects the mouse pointer pointed at by cursor_id.

How about going a step further: use the same function to set Allegro's
software cursor.

This is exactly what I proposed. :) Here, cursor_id will basically just be an array index, except we'd have macro defines for programmers to use.

This would be trivial to add, and we could then deprecate
set_mouse_sprite() (less functions for doing a similar task is good).

Sounds alright to me.

But with your new system, you would need to pass NULL to set_mouse_cursor()
to select the OS default cursor, or non-null to use a custom one. In other
words, you would still need to check if the OS cursor can be used if you
want, because you don't want to override it by default.

If you pass NULL and it can't select the default OS cursor for the id, it would select the default Allegro cursor for that id.

The next step would be to make Allegro's GUI objects aware of the OS cursor
and be able to change it when they have focus. ;)

Sounds fun. ;)

- Kitty Cat




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/