Mail Archives: djgpp/1999/01/02/17:38:40
From: | lawrencej AT ufrsd DOT k12 DOT nj DOT us
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Game speed timer a little jerky
|
Date: | Sat, 02 Jan 1999 22:02:06 GMT
|
Organization: | Deja News - The Leader in Internet Discussion
|
Lines: | 41
|
Message-ID: | <76m50v$cri$1@nnrp1.dejanews.com>
|
NNTP-Posting-Host: | 207.8.141.130
|
X-Article-Creation-Date: | Sat Jan 02 22:02:06 1999 GMT
|
X-Http-User-Agent: | Mozilla/3.0 (Win95; U)
|
X-Http-Proxy: | 1.0 x15.dejanews.com:80 (Squid/1.1.22) for client 207.8.141.130
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I'm using the game timer featured in George Foot's Allegro Vivace...
volatile int target_cycle;
void target_incrementor()
{
target_cycle++;
}
END_OF_FUNCTION (target_incrementor);
int actual_cycle;
int end_game;
void game_loop()
{
LOCK_VARIABLE (target_cycle);
LOCK_FUNCTION (target_incrementor);
install_int_ex (target_incrementor, BPS_TO_TIMER (cycles_per_sec));
end_game = 0;
actual_cycle = target_cycle = 0;
do {
draw_one_frame();
while (target_cycle > actual_cycle)
do_one_game_cycle();
} while (!end_game);
}
I'm using a double buffer (and vsync) in mode 13h and my cycles_per_sec is
set at 30. The program runs pretty smooth, but at what seems like regular
intervals of about 1-2 sec, it slightly jerks. I'm not blasting a lotta
graphics, or number crunching, so I believe the problem has to do with the
cycles_per_sec value. (I am throwing around a pointer to a 320x200x256 bitmap
a lot in my code, but that shouldn't affect it.) Any help?
-- JL
PS - I can e-mail the proggy to anyone, but not post it here since it's big.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
- Raw text -