void GuiGame::waitUntil(std::function<bool()> booleanFunction) { while(not booleanFunction()) { refreshScreen(); processWindowEvents(); } }
void run() { while (runLoop) { profilerStartSyncPoint(); { PROFILER_CPU_TIMESLICE("Frame"); processWindowEvents(); { PROFILER_CPU_TIMESLICE("Frame sync and gfx init"); gfx::beginFrame(); } uint64_t time = timerAbsoluteTime(); float dt = (time-prevTime)*0.000001f; prevTime = time; ui::update(dt); app::update(dt); if (recompileGLPrograms) { recompileGLPrograms = false; app::recompilePrograms(); } { PROFILER_CPU_TIMESLICE("onPaint"); app::render(); } ui::render(); gfx::endFrame(); { PROFILER_CPU_TIMESLICE("SDL_GL_SwapBuffers"); SDL_GL_SwapWindow(window); } } profilerStopSyncPoint(); } }