iDevGames Forums
When to run event loop... - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: When to run event loop... (/thread-7635.html)

When to run event loop... - SethWillits - Aug 6, 2002 12:40 PM

I'm writing a game engine that takes over the whole screen so no standard UI elements are seen. As in any game, I want to show some company logo movies, a game intro movie, and then the main menu for the game. The question is, when do you call RunApplicationEventLoop? Or should I not in a game?

I was thinking that in a setup routine you'd load up the first movie, set a callback for when the movie is done and the call RunAppEventLoop. When the callback is fired you call the next movie with another callback etc... until you're done with the movies. When the last movie's 'finished' callbac is done, you load the main menu with custom controls (which I need to ask about) and install event handlers to handle the interactions.

Is this an okay way to do it?

When to run event loop... - kainsin - Aug 6, 2002 02:44 PM

The only requirement is that you need to run the event loop before main exits. Otherwise your application will quit. Smile

You method seems fine, just as long as everything works as it is supposed to. Don't forget that you can have more than just one event loop. You can have, for instance, 'Initial screen event loop' that knows what all of the controls are in the opening screen and 'Game event loop' that knows what to do when certain keys are pressed while in the game.

When to run event loop... - OneSadCookie - Aug 6, 2002 02:44 PM

Sounds good. It also means you'll be able to trap key presses, mouse clicks, &c so that the user can skip the movies if they want.

When to run event loop... - ededed - Aug 11, 2002 07:48 AM

I think you should just do it all like a normal cocoa NSView thing. You will still be able to do it fullscreen but it will allow a windowed option, you will be able to hide the cursor ([NSCursor hide], [NSCursor unhide]) and you can lock the mouse to have you own custom cursor (i.e a cursor that mouse in a funny way or with a ceartain sensitivity).
You can use OpenGL with a cocoa application without using glut (GLCubes is a good example). And you can use quicktime to play movies. You should be able to do all the custom interface stuff very easily with that system.

Good luck.