void RenderTimer::printTiming() { time_t diff = getTiming(); gravUtil::logVerbose( "%lu\n", (unsigned long)diff ); resetTiming(); }
DaySimulator::DaySimulator(QObject *parent) : EventSimulator(parent) { this->setCycle(kDayCycle); this->setDuration(kDayEventDuration); setRandomTime(kDayRandom); setTiming( ((kDayCycle-kDayRandom) / 2.0) / kDayCycle); qDebug() << "Random time for day is " << getRandomTime() <<", timing is " << getTiming(); }
bool AudioWorld::playMusicTheme(const std::string& name) { #ifdef RE_USE_SOUND if (m_MusicVM->getDATFile().hasSymbolName(Utils::uppered(name))) { size_t i = m_MusicVM->getDATFile().getSymbolIndexByName(Utils::uppered(name)); Daedalus::GameState::MusicThemeHandle h = m_MusicVM->getGameState().createMusicTheme(); Daedalus::GEngineClasses::C_MusicTheme& mt = m_MusicVM->getGameState().getMusicTheme(h); m_MusicVM->initializeInstance(ZMemory::toBigHandle(h), i, Daedalus::IC_MusicTheme); return playSegment(mt.file, getTiming(mt.transSubType)); } #endif return false; }
int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst, LPSTR lpszCmdLine, int nCmdShow) { openConsoleWindow(); HINSTANCE hinst = hCurrentInst; registerWindowsClass(hinst); setupApplication(); double avg_frame_time = 0.0; double next_frame_time=-1.0, last_frame_time=0.0; int frame_num = 0; ::ShowWindow( hwnd, SW_SHOW ); ::SetForegroundWindow( hwnd ); ::SetFocus( hwnd ); // do the draw/update/event loop MSG msg; bool quit = false; while(!quit) { if( ::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { if(msg.message == WM_QUIT) { cleanupApplication(); poWindow *win = (poWindow*)GetWindowLongPtr(hwnd,GWL_USERDATA); delete win; cleanupWindow(); break; } ::TranslateMessage( &msg ); ::DispatchMessage( &msg ); } double now = getTiming(); if(now >= next_frame_time) { next_frame_time = now + 1.0 / 60.0; double dt = now - last_frame_time; poWindow *win = (poWindow*)GetWindowLongPtr(hwnd,GWL_USERDATA); if(win) { win->makeCurrent(); win->update(); win->draw(); } SwapBuffers(dc); frame_num++; last_frame_time = now; } else { Sleep(1); } } cleanupWindow(); #if defined WIN32 && defined _DEBUG //_CrtDumpMemoryLeaks(); #endif return msg.wParam; }