Re: [AD] Using system mouse cursor

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


Evert Glebbeek wrote:
Basically, what we have now is thwe following division of mouse pointers:

Right. Except on systems where Allegro implements a true hardware cursor, you can't have a system pointer since there is no default cursor there. IMO, it would cause an unnecessarry system-specific option on top of something that's already system-specific.

Basically with your way, the programmer would have to try to enable the hardware cursor. If this fails, system behavior won't be all that affected since Allegro will still draw the pointer. Then he has to try setting the OS cursor type. Now, this will only work on systems where the OS has default cursors.. if it doesn't work, the programmer has to do addition work to try and get suitable behavior.

With my way, the programmer still has to try setting up the hardware cursor, but beyond that, the API makes no distinction between a true hardware mouse, or an OS-based one. If you don't set any cursors, the default one (Allegro's for systems that don't have their own.. their can be a function to test this) is automatically set up. Then all you have to do is select which one of the pre-set cursor types you want to use. Any additional work that might happen would be done once at setup.

The latter also has the advantage of not needing to hijack set_mouse_sprite, since the hardware functions can call back onto that function if we're in a non-hardware mode. So really, we could rename set/select_hardware_cursor to set/select_mouse_cursor and have them behave the same not only between systems where their may or may not be a system cursor, but also on systems where there may or may not be a "hardware" cursor. Plus, set_mouse_cursor can be set up to return if the current system (eg. Windows in hardware mode) can accept the mouse cursor and allow the programmer to set something else if it can't (set_mouse_sprite doesn't have a return value, so there's no way to know if your mouse pointer was really set or not).

You could even have a few CURSOR_USER# types to make it easier to cycle through custom cursors (for animations or other uses).

- Kitty Cat




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