From ebcf455ca9dd92816ba53fc17f02f89809a986f7 Mon Sep 17 00:00:00 2001 From: dsc Date: Mon, 16 May 2011 12:13:55 -0700 Subject: [PATCH] Counts ticks --- src/game/Game.h | 3 +++ src/game/Game.mm | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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 { -- 1.7.0.4