Re: [AD] Mouse cusor documentation

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


On Mon, 2004-10-04 at 07:33 +0200, Evert Glebbeek wrote:
> > This looks perfect to me. Although I would like to request if you could 
> > make gfx_capabilities & GFX_HW_MOUSE (or whatever it is) be true if the 
> > mouse is shown on a NULL bitmap and the driver supports the current 
> > pointer.. this way you don't have to display the pointer if you want to 
> > find out if the current mouse pointer will work.
> 

Hm, so you could do:
enable_hardware_mouse();
show_mouse(NULL);
if(gfx_capabilities & GFX_HW_MOUSE)
   // hardware mouse is possible

A function like check_hardware_mouse() would look cleaner. Or, maybe we
can instead add a function show_hardware_mouse - which would take care
of the check function, and also do what the show_hardware_cursor I was
talking about previously would do:

void show_mouse(BITMAP *bmp)
{
    if (bmp == NULL)
    {
        // hide mouse
    }
    else if (bmp != screen || !show_hardware_mouse())
    {
        // show software mouse
    }
}

int show_hardware_mouse(void)
{
    // displays the hardware mouse, returns 1 on success, 0 on failure
}

That way, enable_hardware_mouse/disable_hardware_mouse would work just
like they already do. But, in cases where a program wants Allegro to
display a mouse only in case it is a hardware mouse, show_hardware_mouse
could be used directly, and we don't need things like setting the
HW_CURSOR flag if you call show_bitmap(NULL).

The documentation of show_hardware_mouse could be:
"Has exactly the same effect as calling enable_hardware_mouse(); and
show_mouse(screen); together - but in case no hardware mouse is
availabe, it returns 0 and doesn't display a software mouse. Can be
useful if you don't need Allegro's software cursor - but would still
want to use a hardware cursor in case it is available."

(Besides the already mentioned page flipping, I just thought of another
possibility where users would want this: If you have e.g. a mouse
drawing routine which draws flicker free above a playing animation,
which Allegro's software mouse can't do. But a HW mouse still would be
ok.)

-- 
Elias Pschernig





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