Counts ticks
authordsc <david.schoonover@gmail.com>
Mon, 16 May 2011 19:13:55 +0000 (12:13 -0700)
committerdsc <david.schoonover@gmail.com>
Mon, 16 May 2011 19:13:55 +0000 (12:13 -0700)
src/game/Game.h
src/game/Game.mm

index 7628110..3232ced 100644 (file)
@@ -5,6 +5,9 @@
 
 
 @interface Game : SPStage {
+    
+    long ticks;
+    
 @private
     Unit*  _unit;
     World* _world;
index d010137..9f8aa0b 100644 (file)
@@ -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 {