DSp and RAEL

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
Oh, how I love to do acronym-only headings. Smile Sorry.

Just a question - I'm doing fullscreen with AGL and Drawsprocket, and all sample code mentions that I should let DSp have a stab at all events before I send them on down the line... but how would I do that when I'm using RAEL? Installing a custom event handler? Any thoughts, examples?
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #2
You're talking about DSpProcessEvent(), right? I'm not sure how you're supposed to handle that with Carbon Events because I've always just ignored it.

What I do instead is completely shut down DrawSprocket and return to the desktop if I detect a kEventClassApplication:kEventAppDeactivated event. When the user has dealt with whatever caused them to switch application, they can manually return to full screen mode from the menu.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #3
Yeah, that's the one. The thing is, yes, it works fine under X, but when a fullscreen DSp context is active under <9, there seems to be no event processing whatsoever. (I.e. Cmd-Q doesn't work, so I have to restart the computer whenever I enter fullscreen) So, your way is nice, but on 9, there is no nice way to sent the AppDeactivated event. (I'll probably put it to use anyway, so thanks!)
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #4
I've just remembered that there's a big difference in the way I handle OS9 and OSX for this kind of thing. I found that having an event loop on OS9 caused my game's frame rate to become extremely irregular, so I decided that under OS9 I would stop processing events altogether while the game is running. The player then has to press the escape key to stop the game and switch out of fullscreen mode, at which time I resume event processing (after flushing the event queue). I detect the escape key using GetKeys().

Under OSX I process events as normal and use keyboard events to detect the escape key. That also helps to work around the occasional death of the GetKeys() function on OSX - if it stops working, you can still get out of fullscreen mode. I still use GetKeys() for all other game input, but that's just because it's easier for me.

Incidentally, under OSX I use a Carbon Timer to control the game loop, but under OS9 I just use a do{}while loop, and that's what allows me to stop processing events. Are you using a Carbon Timer? If you're not, that's probably why you're not receiving any events.

Again, I don't call DSpProcessEvent() anywhere and I've never seen any ill effects from it. If you don't process events under OS9 it's impossible to switch applications anyway, so there should be no problem.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #5
Interesting - obviously I'll have to rebuild a few things here, but it'll probably be for the better. Yes, I use a Carbon timer...

Ah, I've copy-pasted your solution, and I'll definitely give it a spin tomorrow morning. Thanks!
Quote this message in a reply
Post Reply