GLUSboolean GLUSAPIENTRY glusWindowLoop(GLUSvoid) { if (!g_done) // Loop That Runs While done=FALSE { if (glusUpdate) { g_done = !glusUpdate(glusWindowGetElapsedTime()); } eglSwapBuffers(g_eglDisplay, g_eglSurface); // Swap Buffers (Double Buffering) _glusOsPollEvents(); } return !g_done; }
GLUSboolean GLUSAPIENTRY glusRun(GLUSvoid) { // Init Engine if (glusInit) { if (!glusInit()) { glusDestroyWindow(); // Destroy The Window return GLUS_FALSE; // Exit The Program } } g_initdone = GLUS_TRUE; // Do the first reshape if (glusReshape) { glusReshape(g_width, g_height); } while (!g_done) // Loop That Runs While done=FALSE { if (glusUpdate) { g_done = !glusUpdate(glusGetElapsedTime()); } eglSwapBuffers(g_eglDisplay, g_eglSurface); // Swap Buffers (Double Buffering) _glusPollEvents(); } // Terminate Game if (glusTerminate) { glusTerminate(); } // Shutdown glusDestroyWindow(); // Destroy The Window return GLUS_TRUE; // Exit The Program }
GLUSboolean GLUSAPIENTRY glusLoop(GLUSvoid) { if (!glfwWindowShouldClose(g_window)) { if (glusUpdate) { if (!glusUpdate(glusGetElapsedTime())) { glfwSetWindowShouldClose(g_window, GLUS_TRUE); } } glfwSwapBuffers(g_window); // Swap Buffers glfwPollEvents(); return GLUS_TRUE; } return GLUS_FALSE; }
GLUSboolean GLUSAPIENTRY glusWindowLoopDoRecording(GLUSvoid) { if (!g_done) // Loop That Runs While done=FALSE { if (glusUpdate) { // Still consume and update time, as a fixed recording time is used. glusWindowGetElapsedTime(); g_done = !glusUpdate(_glusWindowGetRecordingTime()); if (!g_done) { if (_glusWindowGetCurrentRecordingFrame() < _glusWindowGetRecordingFrames()) { if (glusScreenshotUseTga(0, 0, _glusWindowGetRecordingImageTga())) { static const GLUSchar* filenameTemplate = "screenshot-%04d.tga"; static GLUSchar filename[20]; sprintf(filename, filenameTemplate, _glusWindowGetCurrentAndIncreaseRecordingFrame()); glusImageSaveTga(filename, _glusWindowGetRecordingImageTga()); } } else { g_done = GLUS_TRUE; } } } eglSwapBuffers(g_eglDisplay, g_eglSurface); // Swap Buffers (Double Buffering) _glusOsPollEvents(); } return !g_done; }
GLUSboolean GLUSAPIENTRY glusRun(GLUSvoid) { MSG msg; // Windows Message Structure GLUSboolean done = GLUS_FALSE; // Bool Variable To Exit Loop // Init Engine if (glusInit) { if (!glusInit()) { glusDestroyWindow(); // Destroy The Window return GLUS_FALSE; // Exit The Program } } g_initdone = GLUS_TRUE; // Do the first reshape if (glusReshape) { glusReshape(g_width, g_height); } while(!done) // Loop That Runs While done=FALSE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done = GLUS_TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key if (g_active) // Program Active? { if (glusUpdate) { done = !glusUpdate(glusGetElapsedTime()); } if (!done) { SwapBuffers(g_hDC); // Swap Buffers (Double Buffering) } } } } // Terminate Game if (glusTerminate) { glusTerminate(); } // Shutdown glusDestroyWindow(); // Destroy The Window return GLUS_TRUE; // Exit The Program }