Remove C++11 from GLFW3 platform backend

This commit is contained in:
Clownacy 2020-09-08 03:56:52 +01:00
parent 84d6b50bc2
commit 7d51a80007

View file

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