Mail Archives: djgpp/1997/02/04/03:00:41
On Tue, 4 Feb 1997 04:04:33 GMT, Andrew Deren <aderen AT eecs DOT uic DOT edu>
wrote:
>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?
>Thanks in advance.
Presumably, if you're updating the screen that often, you're
synchronising your updates with the vertical retrace. If so, you can
hide the mouse while you update, then redraw it again, without the
user noticing at all. Just wait for the retrace, hide the mouse, then
do *all* the updating as quickly as possible, then show the mouse
again.
eg your main game loop could be:
while (not_finished) {
game_logic_and_stuff(); /* No screen updates in here */
vsync(); /* Wait for the vertical retrace */
show_mouse(NULL); /* Hide the mouse */
draw_everything_thats_changed(); /* Draw everything that's moved */
show_mouse(screen); /* Show the mouse again */
}
Alternatively you might consider buffering the screen, so that your
game_logic_and_stuff() can update this buffer whenever it needs to,
and make draw_everything_thats_changed() just blit this buffer onto
the real screen.
George Foot
- Raw text -