www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/02:32:04

From: abc AT abc DOT com (Dave)
Newsgroups: comp.os.msdos.djgpp
Subject: allegro interrupts, when to use them (in games)...
Date: Wed, 28 Jan 1998 07:29:09 GMT
Organization: Magna Data - Internet Solutions Provider
Lines: 33
Message-ID: <34cedb35.40042112@news.magna.com.au>
NNTP-Posting-Host: saccess-06-073.magna.com.au
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

OK, I am doing a bit of game programming and am wondering when to use
the interrupts (timers, etc, supplied by allegro)

My main loop :
	- processes keystrokes
	- moves player + other objects
	- draws them onto buffer
	- waits for vsync
	- blits buffer to screen, then back to beginning of loop.

My problem is if the graphics get complicated, the main loop takes
more than one vsync.  The concept of time is lost, or slowed down,
because the players keys are only read once per loop, and it's running
slower.

To get around this the players keys should be read during an interrupt
routine, so that they are guaranteed to be read at a constant rate.
Is this correct?

Then, if they press KEY_UP I apply a scaling matrix to the velocity
vector, to increase its size.  Are matrices too heavy to use in an
interrupt?  I believe they are quite fast but is it better to put them
elsewhere? 

Also, while I am here, how should  I store the velocity vector for my
player, cartesian (x/y) or polar (roe, theta) coordinates???  Either
way, it seems like there are some times when one is more useful, so I
have to keep converting... from your experience which is best.  I use
cartesian coords for the players position currently.

Thanks a lot,

David

- Raw text -


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