Re: [AD] Mouse cusor documentation

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


Evert Glebbeek wrote:
Because gfx_capabilities is only updated after show_mouse() has been called. You don't know if you have a hardware cursor or not until after show_mouse() has been called. It's always been this way.

I think he means if you call show_mouse previously, then enable the hardware cursor. Do you need to call show_mouse after setting the hardware cursor if you called it before hand?

Also, note that you can't check for the precense of relevant entries in teh vtable to set gfx_capabilities once and for all: in Windows, you will only be able to get a hardware cursor for cursors upto 32x32 pixels, not above. So setting it always is unreliable.

But the vtable function to set a custom hardware cursor should be able to indicate failure via a return value. Doesn't it already do this?

No, we don't. Allegro uses a software cursor automatically if it can't let the OS draw the cursor. No need to disable the hardware cursor for that.

I think he means disable temporarilly, until it's shown on the screen again.

I'm not sure... I think this could be considered an API breakage. Anyway, with the new system and custom cursors, the code needs to be somewhat rethought anyway.

True.. and I'm not really against having some API breakage as long as it follows these rules: 1) the break can only happen after the programmer explicitly calls a function that alters behavior (and the called function is documented to change the behavior of the other functions). And 2) the altered behavior is disabled by default.

Now, since enable_hardware_mouse is a new function, everything's pretty much fair game when it's called.. behavior changes to existing functions included. This includes show_mouse. /However/, the changes should be kept reasonable if not minimal, and I personally don't quite see the reason to change show_mouse. If the OS/hardware can't handle the cursor Allegro tries to set, it falls back to software until the proper conditions are met and it can use the OS/hardware again. This should include not only bitmap size/color restrictions, but also target bitmaps.

So, IMO when enable_hardware_mouse is called, it should use the hardware/OS only when the target is "screen" (not the physical screen, since page flipping/scrolling can change what's in view and where, but the pointer to the screen bitmap), and the OS/hardware can accept the pointer bitmap.

- Kitty Cat




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