Mail Archives: djgpp/2000/02/27/16:45:37
| From: | "Kermit" <pkermit AT hotmail DOT com>
|
| Newsgroups: | comp.os.msdos.djgpp
|
| Subject: | Allegro: Many things happening at various speeds.
|
| Lines: | 53
|
| 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: | <WAgu4.387$i3.20823@news0.mobilixnet.dk>
|
| Date: | Sun, 27 Feb 2000 22:26:53 +0100
|
| NNTP-Posting-Host: | 212.97.202.214
|
| X-Complaints-To: | abuse AT mobilixnet DOT dk
|
| X-Trace: | news0.mobilixnet.dk 951686582 212.97.202.214 (Sun, 27 Feb 2000 22:23:02 MET)
|
| NNTP-Posting-Date: | Sun, 27 Feb 2000 22:23:02 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...
Please tell me, if I am on the "right track"...
I am doing a game, using Allegro and DJGPP.
Now, I have come to the point, where I must decide how to update the my
playing screen.
I though of doing as follows (it's written in pseudo-C++... :o)):
Ah... before I begin - I have installed a timer (install_timer) which
activates a function at a certain interval increasing a number, gameCounter
(Long-value).
okay... here goes:
BITMAP *bmp1, *bmp2;
load_picture( "niceBackgroundImageOfPlanets.bmp", bmp1 );
while ( notDead )
{
if ( gameCounter % 100 == 0 )
{
move_ship();
check_for_collision();
}
if ( gameCounter % 10 == 0 )
move_stars();
if ( gameCounter % 50 == 0 )
move_rock();
blit( bmp1, bmp2, 0, 0, 0, 0, 640, 480 );
ship.putSprite ( x, y, bmp2 ); // My own sprite-class
stars.putSprite( xs, ys, bmp2 );
rock.putSprite ( xr, yr, bmp2 );
show_mouse(NULL);
blit( bmp2, screen, 0, 0, 0, 0, 640, 480 );
show_mouse(screen);
}
Could someone please tell me, if that's the best way of doing it?
I tried doing a few small tests with it and it seemed that mouse-pointer
flickered even though I used the show_mouse(NULL) before updating the screen
(That was in 320x200).
Kermit
- Raw text -