From: dsc Date: Mon, 16 May 2011 19:13:55 +0000 (-0700) Subject: Counts ticks X-Git-Url: http://git.lttlst.com:3516/?a=commitdiff_plain;h=ebcf455ca9dd92816ba53fc17f02f89809a986f7;p=tanks-ios.git Counts ticks --- diff --git a/src/game/Game.h b/src/game/Game.h index 7628110..3232ced 100644 --- a/src/game/Game.h +++ b/src/game/Game.h @@ -5,6 +5,9 @@ @interface Game : SPStage { + + long ticks; + @private Unit* _unit; World* _world; diff --git a/src/game/Game.mm b/src/game/Game.mm index d010137..9f8aa0b 100644 --- a/src/game/Game.mm +++ b/src/game/Game.mm @@ -25,6 +25,7 @@ static Game* _currentGame = NULL; if ( (self = [super init]) ){ _currentGame = self; + ticks = 0l; _world = [[World alloc] init]; [self addEventListener:@selector(onEnterFrame:) atObject:self forType:SP_EVENT_TYPE_ENTER_FRAME]; @@ -46,8 +47,10 @@ static Game* _currentGame = NULL; } - (void) onEnterFrame:(SPEnterFrameEvent*)event { - NSLog(@"Time passed since last frame: %f", event.passedTime); - // [world step]; + ticks++; + if ((ticks % 100) == 0) + NSLog(@"[%ld] Time passed since last 100 frames: %f", ticks, event.passedTime); + [self.world step]; } + (Game*) current {