CompuServe Thread

TIME & IDCMP

5 messages in this thread
#108274From: Francis KostellaJun 11, 1990 1:16 AM
I've got my first "real" Amiga program (meaning that someone else may one day see it) up and running, now I'd like to start refining it and dressing it up (it's a game). I've got main two problems to tackle right now and need some advice from you experienced folks. I'm not necessarily looking for code examples, but there's so many system calls, etc., that I'd rather be pointed to the proper areas, then I could muck about and have fun crashing the machine (the sooner you make your first 1000 mistakes, etc.). First, my biggest problem is getting IDCMP to ignore other windows when a new window is put up. Is there a simple way to do this? Or shouldn't I use windows when I want the user to make a simple choice? Problem two. This is a RISK type game and during a battle I want to put up two bars indicating the relative strength of the two opponents and shrink them as the battle progresses AND have some grisly sound effects. The problem isn't the graphics or sound, but rather the speed of the battle, the thing runs too fast and is kind of unpleasant. What I need is a simple timekeeper. If I were doing this on a single-tasking machine in assembly, I'd write interrupt code, but I suspect there's a better way on the Amiga. (Incidentally, I read the chapter on interrupts in the RKM, and it seemed to be overkill for my needs, besides I'm still relatively new to C & don't want to try writing interrupt code, just yet.) Any and all help appreciated, thanks in advance. –Fran
#108866From: John DraperJun 16, 1990 1:18 AM
Fran, There are a few very easy ways to delay things on the Amiga, and a few that aren't so easy. It really depends on what you need when you are deciding what to use. Here are a few areas to look at… Easy: Delay() – this is a Dos call. Caution, do not use it if there is any chance you might call it with a zero delay value (some say not to call it with a small value at all. WaitTOF() – this is an Intuition call, and waits for Top Of Frame (video frame). Handy for syncronizing things to video, or as a way to delay something that runs too fast. If it works for your application, great, but often you will find that it cr4eates too long or too short a delay. Not so easy: Intuiticks. These can be easy or difficult, depending on whether you are already receiving IntuiMessages or not. timer.device – This is usually the best way to implement accurate delays or timing of events if your application is oin need of a number of different delays, possibly all happening at once. Basically, you open the timer device and treat it like any other IO device, sending it commands. Hope this points you in the right directions. -larry
#108872From: Khalid AldoseriJun 16, 1990 5:03 AM
Larry, interesting about Delay() and small values. I've heard the same thing, but used it reliably with a value of 1 many many times. (just a sideline 🙂 Khalid.
#108901From: Steve AhlstromJun 16, 1990 11:06 AM
Khalid, I'm not positive, but I think that problem was fixed in 1.3. -sja
#108954From: Mike Roth/LatticeJun 16, 1990 11:31 PM
I've talked to some CATS people and they have indicated to me that the AmigaDOS Delay() function can still break with small values. They would not tell me how small their 'small' was. I took this to mean that you could have problems with delays of 2 or 3 ticks also. The best method for safety is to use the timer.device. — Mike Roth / Lattice