Dardan
2004.08.11, 03:43 AM
Hello everyone,
I'd first like to say that I have long used this forum as a valuable resource, and I just now got around to registering, so this is my first post! YaY! :)
Anyway, I am trying to set up a Carbon event loop that uses an idle event timer to drive the game loop. My problem is this: Xcode will not compile the callback function that my timer calls.
This is the error I get:
Prototypes.h:36: error: parse error before "EventIdleAction"
That error refers to the third line in this prototype:
pascal void NextFrame( EventLoopTimerRef timer,
void *userData,
EventIdleAction action );
I have no problem compiling a regular event timer callback, so it seems that EventIdleAction is the only thing giving me grief. I have read the Apple online docs, but the very code they supply does not compile. I have searched and searched for an example that uses idle event loop timers, and I have found nothing.
I set my timer up like this (almost exactly like the example in the Apple docs):
EventLoopRef mainLoop;
EventLoopIdleTimerUPP idleTimerUPP;
EventLoopTimerRef theTimer;
mainLoop = GetMainEventLoop();
idleTimerUPP = NewEventLoopTimerUPP( NextFrame );
InstallEventLoopIdleTimer( mainLoop,
0,
kEventDurationNoWait,
idleTimerUPP,
NULL,
&theTimer );
RunApplicationEventLoop();
Has anyone had this problem? If not, can someone please post a working example (or a summary of one anyway)?
Thanks a lot!
---
Dard.
I'd first like to say that I have long used this forum as a valuable resource, and I just now got around to registering, so this is my first post! YaY! :)
Anyway, I am trying to set up a Carbon event loop that uses an idle event timer to drive the game loop. My problem is this: Xcode will not compile the callback function that my timer calls.
This is the error I get:
Prototypes.h:36: error: parse error before "EventIdleAction"
That error refers to the third line in this prototype:
pascal void NextFrame( EventLoopTimerRef timer,
void *userData,
EventIdleAction action );
I have no problem compiling a regular event timer callback, so it seems that EventIdleAction is the only thing giving me grief. I have read the Apple online docs, but the very code they supply does not compile. I have searched and searched for an example that uses idle event loop timers, and I have found nothing.
I set my timer up like this (almost exactly like the example in the Apple docs):
EventLoopRef mainLoop;
EventLoopIdleTimerUPP idleTimerUPP;
EventLoopTimerRef theTimer;
mainLoop = GetMainEventLoop();
idleTimerUPP = NewEventLoopTimerUPP( NextFrame );
InstallEventLoopIdleTimer( mainLoop,
0,
kEventDurationNoWait,
idleTimerUPP,
NULL,
&theTimer );
RunApplicationEventLoop();
Has anyone had this problem? If not, can someone please post a working example (or a summary of one anyway)?
Thanks a lot!
---
Dard.