To use Carbon events in your application, you must call the function RunApplicationEventLoop(). This function installs the standard application event handler and dispatches events to event handlers.
void GameApp::EventLoop(void)
{
RunApplicationEventLoop();
}
For a fullscreen game, calling RunApplicationEventLoop() is all you need to call to use the event handlers you write. Write event handlers for the keyboard and mouse and install a Carbon event timer (Read my article on Carbon event timers for more information) to run your game loop. Now you have a full-featured control scheme without writing a lot of code.
If you’re using Mac OS X windows in your application, you should install the standard window event handler. Call InstallStandardEventHandler() and supply a target, which will be a window for a window event handler.
WindowRef window; OSStatus error; error = InstallStandardEventHandler(GetWindowEventTarget(window));
Next (Installing Your Event Handler)
Previous (Introduction)