Mail Archives: djgpp/2000/02/28/08:14:21
Hi...
I solved the mouse-problem by drawing the mouse on bmp2 and then blitting
bmp2 to the screen. That solved the flickering-problem.
"Marcus" wrote:
> Why even use a
> game loop? Can't you fix it with some function callbacks?
I don't see how? Can't you post some pseudo-examples? ;o)
I was thinking of structuring it in a new way - as follows:
(still with a timer interrupt, increasing a global long-value, gameCounter)
while ( playing )
{
show_mouse(NULL);
blit(page1, page2, 0, 0, 0, 0, 320, 200);
moveShip(page2);
moveStars(page2);
show_mouse(page2);
blit(page2, screen, 0, 0, 0, 0, 320, 200);
if ( (mouse_b & 1) )
{
}
else if ( keypressed() )
{
}
}
void moveShip(BITMAP *bmp)
{
static int gct = gameCounter;
ship.putSprite( x, y, bmp );
if ( (gameCounter - gct) >= 20 ) /* 20 => The "speed" of which the
ship moves */
{
/* Here goes: change x and y, so that the ship moves! */
gct = gameCounter;
}
}
Oh no! - I have been infected by a signature-virus!!! :o)
--
Kermit
Hi, I'm a signature virus. plz set me as your signature and help me spread
:)
- Raw text -