- (void) applicationDidFinishLaunching:(UIApplication *)application
{
//set up main loop
[NSTimer scheduledTimerWithTimeInterval:0.033
target:self selector:@selector(gameLoop:) userInfo:nil repeats:NO];
//create instance of the first GameState
[self doStateChange:[gsMain class]];
}
- (void) gameLoop: (id) sender
{
[((GameState*)viewController.view) Update];
[((GameState*)viewController.view) Render];
[NSTimer scheduledTimerWithTimeInterval:0.033 target:self
selector:@selector(gameLoop:) userInfo:nil repeats:NO];
}
This code is from a iPhone game development book. I don't know why the gameLoop method need to call the NSTimer again? in the applicationDidFinishLaunching, it set the NSTimer to do, why don't let it do every 0.033s, why add the same NSTimer code in the gameLoop method? thz.
Update: Sorry, my question should be clarify... ...Why the code don't just simply call repeats: YES?