www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/15/10:39:22

Message-ID: <D1FB30BBA491D1118E6D006097BCAE39261C3E@Probe-nt-2a.Probe.co.uk>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Interrupt Handler
Date: Tue, 14 Apr 1998 10:25:40 +0100
MIME-Version: 1.0

Robert Robbins writes:
> I want to execute a function which uses putpixel while a sprite can
> still be moved with the arrow keys. ALLEGRO's install_int function
> only illustrates using a counter.

Just because the Allegro timer example is a counter, that doesn't
mean you are unable to replace this with different code of your own!
The timer callback is just a C function, so you can easily insert
whatever instructions you like inside it. Many internal parts of 
Allegro use timers for various things like this: look at the 
pointer display code in mouse.c, the music playback code in midi.c,
or the double-click detection code in gui.c.

I must advise against drawing to the screen from inside a timer
interrupt, though. This will only work reliably if the main program
doesn't ever touch the screen itself, because the SVGA bank 
switching code will get very confused if your timer code interrupts
some other drawing operation. The Allegro graphics functions are
in general not reentrant, so this is likely to cause you a lot of
grief.

	Shawn Hargreaves.

- Raw text -


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