File add-sleep.patch of Package traingame

From cee1d01b8ce0a72b536da81114c0f0fa2d51fbe1 Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Tue, 9 Dec 2025 08:06:31 +0100
Subject: [PATCH] Add sleep

so that we don't waste CPU+GPU power to render 1000 frames/s

with 8ms sleep, we get around 115 fps that is sufficient
---
 src/OpenGLHelper.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/OpenGLHelper.cpp b/src/OpenGLHelper.cpp
index c83fcc3..90739a8 100644
--- a/src/OpenGLHelper.cpp
+++ b/src/OpenGLHelper.cpp
@@ -15,6 +15,7 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
+#include <unistd.h>
 #include <GL/glew.h>  // Must be included before other GL headers
 
 #include "OpenGLHelper.hpp"
@@ -92,6 +93,7 @@ void drawGLScene(IWindowPtr a_window, IGraphicsPtr a_context, IScreenPtr a_scree
 
    // Check for OpenGL errors
    checkGLError();
+   usleep(8000);
 }
 
 // Report the current OpenGL version
-- 
2.52.0

openSUSE Build Service is sponsored by