Re: [AD] Preparing for RC2 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sat, 2005-08-27 at 01:07 -0700, Chris wrote:
> On Saturday 27 August 2005 12:02 am, Victor wrote:
> > No please! I ALWAYS show the mouse in memory bitmaps. With this technic
> > is easy to avoid flickering in cases where i don't care with
> > performance. And when drawing the mouse in memory bitmaps i can easily
> > create some effects like multiple mouse cursors moving synchrounous
> > (for a game). Or create a mouse pointer in a moving bitmap.
>
> It'd be better to just use
> draw_sprite(memory_bmp, mouse_sprite, mouse_x, mouse_y);
> before blitting to the screen. Showing the mouse on a memory bitmap causes the
> mouse to be drawn to it over and over and over again where it'll never be
> seen, and if you try to draw to the bitmap at the same time as the mouse
> timer, you'll get undefinable behavior (mouse droppings and/or incomplete
> draws).
Actually, there would be valid reasons to draw to a memory buffer, for
example:
blit(background, buffer, ...)
...
show_mouse(buffer)
while(1) {
...
blit(buffer, screen, ...)
}
There's no (easy) way to use draw_sprite instead. But, we would need a
mutex around that last blit to be sure to keep the mouse drawer out of
it. freeze_mouse_flag wouldn't work, since it doesn't wait for the mouse
drawer to complete. acquire_bitmap wouldn't work as well, since memory
bitmaps have it as no-op.
So, in the end, I agree - with the current implementation we can't allow
it. But the reason is only technical.
The attached patch should disallow it - but I didn't think much about
consequences yet, so might not apply yet for RC2, it's only a trivial
change anyway.
--
Elias Pschernig
Index: src/mouse.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/mouse.c,v
retrieving revision 1.37
diff -r1.37 mouse.c
591a592,594
> if (bmp && is_memory_bitmap(bmp))
> return;
>