summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2021-03-02 12:44:53 +0100
committerRay <[email protected]>2021-03-02 12:44:53 +0100
commit2a5ce960474d5aafa1787b9c7d780f833bc4be4e (patch)
treec0419975eb55f4c9d29b0125b5d8b43a79c9d0ae /src
parent01b3c97c42d366522a7e82fab2b0ac47e350ee77 (diff)
downloadraylib-2a5ce960474d5aafa1787b9c7d780f833bc4be4e.tar.gz
raylib-2a5ce960474d5aafa1787b9c7d780f833bc4be4e.zip
REVIEWED: Wait() to support FreeBSD #1618
Diffstat (limited to 'src')
-rw-r--r--src/core.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core.c b/src/core.c
index 8ac725e2..40962138 100644
--- a/src/core.c
+++ b/src/core.c
@@ -202,15 +202,16 @@
unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
#endif
-
- #elif defined(__linux__)
+ #endif
+ #if defined(__linux__) || defined(__FreeBSD__)
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
//#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type
//#define GLFW_EXPOSE_NATIVE_WAYLAND
//#define GLFW_EXPOSE_NATIVE_MIR
#include "GLFW/glfw3native.h" // Required for: glfwGetX11Window()
- #elif defined(__APPLE__)
+ #endif
+ #if defined(__APPLE__)
#include <unistd.h> // Required for: usleep()
//#define GLFW_EXPOSE_NATIVE_COCOA // WARNING: Fails due to type redefinition
@@ -4234,7 +4235,8 @@ static void Wait(float ms)
#if defined(_WIN32)
Sleep((unsigned int)ms);
- #elif defined(__linux__) || defined(PLATFORM_WEB)
+ #endif
+ #if defined(__linux__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__)
struct timespec req = { 0 };
time_t sec = (int)(ms/1000.0f);
ms -= (sec*1000);
@@ -4243,7 +4245,8 @@ static void Wait(float ms)
// NOTE: Use nanosleep() on Unix platforms... usleep() it's deprecated.
while (nanosleep(&req, &req) == -1) continue;
- #elif defined(__APPLE__)
+ #endif
+ #if defined(__APPLE__)
usleep(ms*1000.0f);
#endif