Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!caen!etsu!cmi.com!davet From: davet@cmi.com (David Temkin) Newsgroups: comp.sys.mac.programmer Subject: Game input -- Bypassing GetNextEvent Message-ID: <10219@etsu.CMI.COM> Date: 30 Apr 91 21:13:55 GMT Sender: news@etsu.CMI.COM Organization: Center for Machine Intelligence, EDS Corp. Lines: 52 I've run into a problem with a game I'm developing. The game is one of those "take-over-the-screen" arcade-type games, and I don't use the mouse pointer as such, although I do read the mouse for input. Currently, the technique I use to read the keyboard and mouse is very simple, and it nearly works: I call GetNextEvent frequently. These are the problems: 1. Under Multifinder, if the user clicks in the upper right of the menu bar (although neither the menu bar nor the pointer is visible), the game application can be "switched out," which causes all kinds of problems, owing mainly to the fact that I'm writing directly to the screen and I want the cursor to be invisible. Is there a legitimate way of removing the menu bar? How do other games take over the screen in a foolproof manner? 2. Screen savers: These will kick in of their own accord as a result of calling GetNextEvent a certain number of times without an event occurring. BUT, since I write directly to the screen and refresh most of the screen every time, this can be unsightly -- particularly since I use double-buffering when the hardware allows it. 3. I need a way of changing the mouse's location. I'm aware of the low memory mouse globals and all that; it seems to work fine. Question: Is there a way of reading the movements of the mouse at a lower level, i.e. before they've been converted into coordinates? This would be most helpful. 4. Calling GetNextEvent is slow. According to the THINK C profile, the game spends an inordinate amount of time doing this. What are the alternatives? Other than suspending certain types of background processing, what would this break? Would it be safe to repeatedly read the low-memory globals for the mouse and, say, call GetKeys to read the keyboard? (the low memory keyboard map doesn't seem to get updated unless GetNextEvent gets called). Anyway, I'm interested in hearing people's experiences with these issues. How do other games out there handle these problems? What are the consequences/techniques for bypassing the event manager altogether? Although I don't intend this game to be a very "cooperative" (windowing) application, I would like to ensure that it at least does not crash or cause any other serious problems under Multifinder and System 7. Suggestions? David Temkin Center for Machine Intelligence, EDS Corp. davet@cmi.com