I have a task that updates my airplane game.
AsyncTask::DoneStatus GamePlayTask(GenericAsyncTask* task, void* data) {
if (bKeyPressed)
cout<<"time is:"<<globalClock->get_frame_time()<<endl;
Airplane::S_OnLoop(globalClock->get_frame_time());
// Tell the task manager to continue this task the next frame.
return AsyncTask::DS_cont;
}
....start main() and the window and stuff...
taskMgr->add(new GenericAsyncTask("Runs the Game",&GamePlayTask, (void*) NULL));
framework.main_loop();
The problem is that globalClock->get_frame_time() is increasing every frame, its giving me the exact same value as globalClock->get_real_time().
So my airplane is moving and turning faster and faster as the application runs. I thought that maybe its because globalClock->tick() wasn’t being called automatically so I tried manually calling it in the beginning of my task, but with no apparent improvement.
I did make a workaround by declaring a double called OldTime and using it with globalClock->get_real_time();
Airplane::S_OnLoop(globalClock->get_real_time() - OldTime);
OldTime = globalClock->get_real_time();
but the fact that get_frame_Time didn’t work still bothers me.