www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/28/08:14:21

From: "Kermit" <pkermit AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <WAgu4.387$i3 DOT 20823 AT news0 DOT mobilixnet DOT dk> <89c978$nse$1 AT cubacola DOT tninet DOT se>
Subject: Re: Allegro: Many things happening at various speeds.
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.5600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.5600
Message-ID: <_buu4.435$i3.22107@news0.mobilixnet.dk>
Date: Mon, 28 Feb 2000 13:52:17 +0100
NNTP-Posting-Host: 212.97.200.27
X-Complaints-To: abuse AT mobilixnet DOT dk
X-Trace: news0.mobilixnet.dk 951742330 212.97.200.27 (Mon, 28 Feb 2000 13:52:10 MET)
NNTP-Posting-Date: Mon, 28 Feb 2000 13:52:10 MET
Organization: Mobilix Internet -- http://www.mobilixnet.dk/
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019