shithub: cstory

Download patch

ref: 7d51a80007b3a9090f3cce6fd9b8c88d38b8d687
parent: 84d6b50bc2db92dc695177445b2eb39e4b861a39
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Sep 7 23:56:52 EDT 2020

Remove C++11 from GLFW3 platform backend

--- a/src/Backends/Platform/GLFW3.cpp
+++ b/src/Backends/Platform/GLFW3.cpp
@@ -1,6 +1,5 @@
 #include "../Misc.h"
 
-#include <chrono>
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -7,8 +6,16 @@
 #include <stdlib.h>
 #include <string.h>
 #include <string>
-#include <thread>
 
+#if __cplusplus >= 201103L
+	#include <chrono>
+	#include <thread>
+#elif defined(_WIN32)
+	#include "windows.h"
+#else
+	#include <unistd.h>
+#endif
+
 #include <GLFW/glfw3.h>
 
 #include "../Rendering.h"
@@ -319,6 +326,12 @@
 
 void Backend_Delay(unsigned int ticks)
 {
+#if __cplusplus >= 201103L
 	// GLFW3 doesn't have a delay function, so here's some butt-ugly C++11
 	std::this_thread::sleep_for(std::chrono::milliseconds(ticks));
+#elif defined(_WIN32)
+	Sleep(ticks);
+#else
+	usleep(ticks * 1000);
+#endif
 }