+ //scalar nextUpdate = ticks;
+ //scalar nextDraw = ticks;
+ //scalar nextSecond = ticks + SCALAR(1.0);
+
+ fps_ = 0;
+ //int frameCount = 0;
+
+ //const scalar timestep = SCALAR(0.01);//timestep_;
+ //const scalar framerate = framerate_;
+
+ //const int MAX_FRAMESKIP = 15;
+ //const scalar inverseTimestep = SCALAR(1.0) / timestep;
+
+ is_running_ = true;
+ for (;;)
+ {
+ //timer::fire_expired_timers(); // 1. fire timers
+ dispatch_events(); // 2. dispatch events
+
+ //if (!is_running_) break;
+
+ //int i = 0;
+ //while (nextUpdate < timer::ticks() && i < MAX_FRAMESKIP)
+ //{
+ //totalTime += timestep; // 3. update state
+ //view_.update(totalTime, timestep);
+
+ ////previous = current;
+ ////integrate(current, totalTime, timestep);
+
+ //nextUpdate += timestep;
+ //++i;
+
+ //if (!is_running_) break;
+ //}
+
+ ////const float newTime = timer::ticks();
+ ////float deltaTime = newTime - currentTime;
+ ////currentTime = newTime;
+
+ ////if (deltaTime>0.25f)
+ ////deltaTime = 0.25f;
+
+ ////accumulator += deltaTime;
+
+ ////while (accumulator>=dt)
+ ////{
+ ////accumulator -= dt;
+ ////previous = current;
+ ////integrate(current, t, dt);
+ ////t += dt;
+ ////}
+
+ ////if (nextDraw < (ticks = timer::ticks()))
+ ////{
+ //ticks = timer::ticks();
+ //scalar diff = ticks - nextDraw;
+ ////log_info("difference:", diff);
+ //scalar alpha = (ticks + timestep - nextUpdate) * inverseTimestep;
+ ////scalar alpha = (nextUpdate - ticks) * inverseTimestep;
+ ////float alpha = accumulator/dt;
+ //if (alpha < SCALAR(0.0)) log_error("UH OH!!!!! It's NEGATIVE", alpha);
+ //if (alpha > SCALAR(1.0)) log_error("UH OH!!!!! It's POSITIVE", alpha);
+ //log_info("alpha:", alpha);
+
+ //view_.draw(alpha);
+
+ //// TEMP
+ ////State state = interpolate(previous, current, alpha);
+ ////glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ ////glBegin(GL_POINTS);
+ ////glColor3f(1,1,1);
+ ////glVertex3f(state.x, 0, 0);
+ ////glEnd();
+
+
+
+ //video_->swap(); // 4. draw state
+
+ //nextDraw += framerate;
+ //++frameCount;
+
+ //if (nextSecond < ticks)//timer::ticks())
+ //{
+ //fps_ = frameCount;
+ //frameCount = 0;
+
+ //if (show_fps_) log_info << fps_ << " fps" << std::endl;
+
+ //nextSecond += SCALAR(1.0);
+ //}
+ ////}