Created
July 12, 2009 20:09
-
-
Save reklis/145780 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) applicationDidFinishLaunching:(UIApplication*)application | |
{ | |
// create our rendering timer | |
[self performSelectorOnMainThread:@selector(mainGameLoop) withObject:nil waitUntilDone:NO]; | |
} | |
- (void) mainGameLoop | |
{ | |
while (gameRunning) | |
{ | |
// Yield to system calls (touches, etc.) | |
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, kGameSystemCallYield, FALSE) == kCFRunLoopRunHandledSource); | |
// Update the game logic. | |
shell->UpdateScene(); | |
// Draw the game. | |
shell->RenderScene(); | |
[_glView swapBuffers]; | |
} | |
NSLog(@"game no longer running"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) applicationDidFinishLaunching:(UIApplication*)application | |
{ | |
// create our rendering timer | |
[NSTimer scheduledTimerWithTimeInterval:(1.0 / kFPS) target:self selector:@selector(update) userInfo:nil repeats:YES]; | |
} | |
- (void) update | |
{ | |
if (!gameRunning) { | |
NSLog(@"game no longer running"); | |
return; | |
} | |
if(!shell->UpdateScene()) | |
printf("UpdateScene error\n"); | |
if(!shell->RenderScene()) | |
printf("RenderScene error\n"); | |
[_glView swapBuffers]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment