Mail Archives: djgpp/1997/02/04/18:56:41
Andrew Deren writes:
>I am planning to writea game that requires a mouse for pointing
>things, and I am having problems with that because in allegro (that's what
>i use and like) you have to hide and show mouse whenever you write to
>screen and I am updating the screen at about 20-30 fps and this causes the
>mouse to disapear and show. Is there some way to blit something to a sreen
>without hidding mouse pointer?
There's no way to draw onto a screen while the Allegro mouse pointer is
visible, becuase the pointer gets redrawn inside an interrupt handler,
and it's not good if this happens in the middle of some other drawing
operation.
If you are updating the screen fast enough (30 fps sounds fine to me),
you can draw your own pointer along with the rest of the image. Just
before you blit the frame onto the screen, draw a pointer sprite at
mouse_x, mouse_y, and there you have it...
Alternatively, you could tell Allegro to display the mouse pointer on
the memory bitmap you are using to prepare your frames, rather than
directly onto the screen. This would still allow the pointer to be
redrawn partway through the blit, but the blit is only reading the
memory bitmap, and there is no problem with changing an image while it
is being read by other code. The worst you could get is the odd frame
where the mouse pointer is invisible or ghosted in two places, but I
don't think this would be too noticable.
/*
* Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
* Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
*/
- Raw text -