Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Window_Run(TGUIWindow *AWindow)
- {
- TIterator *BIteratorWidget = NULL;
- TGUIWidget *BClientWidget = NULL;
- double BTime = glfwGetTime();
- unsigned int BFrames = 0;
- long BDiff = 0;
- struct timespec BRenderingClockLast;
- struct timespec BRenderingClockCurrent;
- clock_gettime(CLOCK_REALTIME, &BRenderingClockLast);
- TGUIWidgetProperties *BWidgetProperties = NULL;
- AWindow->FRunning = TRUE;
- glfwGetWindowSize(AWindow->FGLFW_Window, &AWindow->FWidth, &AWindow->FHeight);
- #ifdef GUI_DEBUG_MODE
- printf("[MESSAGE] Running window.\n");
- #endif
- Window_ResolveAlignment(AWindow);
- glfwShowWindow(AWindow->FGLFW_Window);
- while (!glfwWindowShouldClose(AWindow->FGLFW_Window))
- {
- glfwPollEvents();
- clock_gettime(CLOCK_REALTIME, &BRenderingClockCurrent);
- BDiff = time_diff(&BRenderingClockCurrent, &BRenderingClockLast);
- if (BDiff > 16.666666667)
- {
- clock_gettime(CLOCK_REALTIME, &BRenderingClockLast);
- Window_Render(AWindow);
- glfwSwapBuffers(AWindow->FGLFW_Window);
- };
- BFrames++;
- if (glfwGetTime() - BTime >= 1)
- {
- #ifdef GUI_DEBUG_MODE
- if ((BFrames < 59) || (AWindow->FRenderingFrameRate < 59))
- {
- // This message is printed only if the frame-rate is bellow the normal.
- printf("[MESSAGE] Process frame-rate: %i frames per second.\n", BFrames);
- printf("[MESSAGE] Rendering frame-rate: %i frames per second.\n", AWindow->FRenderingFrameRate);
- };
- #endif
- AWindow->FRenderingFrameRate = 0;
- BFrames = 0;
- BTime = glfwGetTime();
- };
- };
- #ifdef GUI_DEBUG_MODE
- printf("[MESSAGE] Finishing window.\n");
- #endif
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement