//-------------------------------------------------------------- // constructor mgOSXServices::mgOSXServices() { // set global pointer to framework mgPlatform = this; m_windowWidth = 800; m_windowHeight = 600; m_windowX = 100; m_windowY = 100; m_fullscreen = false; m_multiSample = false; m_swapImmediate = false; m_library = ""; m_libraryFound = MG_LIBRARY_NONE; m_mouseRelative = false; m_active = false; m_lastCursorX = 0; m_lastCursorY = 0; m_mouseInside = false; m_errorTable = new mgPlatformErrorTable(); m_eventFlags = 0; m_sessionStart = mgOSGetTime(); resetTiming(); }
//-------------------------------------------------------------- // constructor mgScriptPlatform::mgScriptPlatform() { // set global pointer to framework mgPlatform = this; m_windowTitle = "Debug Framework"; m_windowWidth = 800; m_windowHeight = 600; m_windowX = 100; m_windowY = 100; m_fullscreen = false; m_multiSample = false; m_swapImmediate = false; m_library = ""; m_libraryFound = MG_LIBRARY_NONE; m_mouseRelative = false; m_lastCursorX = 0; m_lastCursorY = 0; m_mouseInside = false; m_lastKeyDown = 0; m_shutdown = false; m_errorTable = new mgPlatformErrorTable(); m_active = false; m_initialized = false; resetTiming(); }
void RenderTimer::printTiming() { time_t diff = getTiming(); gravUtil::logVerbose( "%lu\n", (unsigned long)diff ); resetTiming(); }
//-------------------------------------------------------------- // initialize view void mgScriptPlatform::initView() { #ifdef STUFF // do the initial resize mgPlatform->windowResized(m_windowWidth, m_windowHeight); // create the display services mgPlatform->cursorInitState(m_lastCursorX, m_lastCursorY); // start timing resetTiming(); #endif }
//-------------------------------------------------------------- // write frames per second to log void mgOSXServices::logTiming( BOOL forceReport) { if (m_frameCount == 0) return; // get elapsed time since last report double interval = mgOSGetTime() - m_timingStart; // don't report more than once per minute if (!forceReport && interval < FPS_REPORT_INTERVAL) return; double frameTime = interval / m_frameCount; int fps = (int) (1000.0 / frameTime); mgDebug(":Session fps: %d fps, %.2f ms/frame, over %d frames, %.2f seconds", fps, frameTime, m_frameCount, interval/1000.0); resetTiming(); // don't count log time }
//-------------------------------------------------------------- // constructor mgWinServices::mgWinServices() { // set global pointer to platform services mgPlatform = this; m_theApp = NULL; m_instance = NULL; m_window = NULL; m_dc = NULL; m_support = NULL; m_windowTitle = "mgFramework"; m_windowClass = tmpnam(NULL); m_windowWidth = 800; m_windowHeight = 600; m_windowX = 100; m_windowY = 100; m_fullscreen = false; m_multiSample = false; m_swapImmediate = false; m_library = ""; m_libraryFound = MG_LIBRARY_NONE; m_mouseRelative = false; m_lastCursorX = 0; m_lastCursorY = 0; m_mouseInside = false; m_eventFlags = 0; // mouse and modifier flags m_active = false; m_initialized = false; resetTiming(); m_errorTable = new mgPlatformErrorTable(); }