program.cpp
1 #include "program.h" 2 3 long long calibrate() { 4 unsigned long long start = __rdtsc(); 5 struct timespec ts; 6 ts.tv_sec = 0; 7 ts.tv_nsec = 100000000L; // 0.1 seconds 8 nanosleep(&ts, NULL); 9 return (__rdtsc() - start) * 10; 10 } 11 const long long enginend::CPUCLOCK=calibrate(); 12 void enginend::program::changescene(scene *scn) { 13 this->currentscene->exit(); 14 delete this->currentscene; 15 this->currentscene = scn; 16 this->currentscene->boot(); 17 }