void CCore::_MainLoop() { if (_bDoExit) { _pMainWindow->KillWindow(); return; } uint64 time = GetPerfTimer()/1000; uint64 time_delta = time - _ui64TimeOld; bool flag = false; uint cycles_cnt = (uint)(time_delta/_uiProcessInterval); for (uint i = 0; i < cycles_cnt; i++) { if (!_clDelProcess.IsNull()) _clDelProcess.Invoke(); flag = true; } if (flag) _ui64TimeOld = time - time_delta % _uiProcessInterval; _clDelRender.Invoke(); }
void CRender3D::BeginFrame() { _ui64DrawDelay = GetPerfTimer(); _bFrCalculated = false; _uiObjsDrawnCount = 0; while (!_stackStates.empty()) _stackStates.pop(); _stCurState.matrixStack.Clear(MatrixIdentity()); _pCoreRenderer->SetMatrix(_stCurState.matrixStack.Top()); }
HRESULT CALLBACK CCore::InitializeEngine(uint uiResX, uint uiResY, const char* pcApplicationName, E_ENGINE_INIT_FLAGS eInitFlags) { if (!(eInitFlags & EIF_NO_LOGGING)) { _clLogFile.setf(ios_base::right, ios_base::adjustfield); _clLogFile.open("log.txt", ios::out|ios::trunc); TSysTimeAndDate time; GetLocalTimaAndDate(time); _clLogFile << "JTS Engine Log File" << endl; _clLogFile << "Log Started at " << time.ui16Day << "." << time.ui16Month << "." << time.ui16Year << "." << endl; } if (SUCCEEDED(_pMainWindow->InitWindow(&_clDelMLoop, &_clDelMProc))) { _pMainWindow->SetCaption(pcApplicationName); if ( (eInitFlags & EIF_NATIVE_RESOLUTION) && (eInitFlags & EIF_FULL_SCREEN)) GetDisplaySize(uiResX, uiResY); if (FAILED(_pMainWindow->ConfigureWindow(uiResX, uiResY, eInitFlags & EIF_FULL_SCREEN))) return E_ABORT; _pInput = new CInput(this); AddToLog("Engine initialized."); if (!_clDelInit.IsNull()) { AddToLog("Calling user initialization procedure..."); _clDelInit.Invoke(); AddToLog("Done."); } _ui64TimeOld = GetPerfTimer()/1000 - _uiProcessInterval; return _pMainWindow->BeginMainLoop(); } else return E_ABORT; }
void CRender3D::EndFrame() { _ui64DrawDelay = GetPerfTimer() - _ui64DrawDelay - Core()->pRender()->pRender2D()->GetAverallDelay(); }