summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorRay <[email protected]>2018-10-31 23:19:29 +0100
committerRay <[email protected]>2018-10-31 23:19:29 +0100
commit0f6f326a868f6c970de066e71d74e81f54347085 (patch)
treec417cbdec868d903463210979d9b9c6be27046e6 /src/core.c
parentf7667aad8dd03c1cdaa2033f7a37815b7dd1f9b4 (diff)
downloadraylib-0f6f326a868f6c970de066e71d74e81f54347085.tar.gz
raylib-0f6f326a868f6c970de066e71d74e81f54347085.zip
Add flag: SUPPORT_EVENTS_WAITING
Wait for input events passively (sleep) instead of polling events actively every frame
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index 2038e274..b2cb1813 100644
--- a/src/core.c
+++ b/src/core.c
@@ -50,6 +50,9 @@
* #define SUPPORT_BUSY_WAIT_LOOP
* Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used
*
+* #define SUPPORT_EVENTS_WAITING
+* Wait for events passively (sleeping while no events) instead of polling them actively every frame
+*
* #define SUPPORT_SCREEN_CAPTURE
* Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
*
@@ -2933,7 +2936,6 @@ static void PollInputEvents(void)
previousMouseState[i] = currentMouseState[i];
currentMouseState[i] = currentMouseStateEvdev[i];
}
-
#endif
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
@@ -3007,8 +3009,12 @@ static void PollInputEvents(void)
}
}
+#if defined(SUPPORT_EVENTS_WAITING)
+ glfwWaitEvents();
+#else
glfwPollEvents(); // Register keyboard/mouse events (callbacks)... and window events!
#endif
+#endif //defined(PLATFORM_DESKTOP)
// Gamepad support using emscripten API
// NOTE: GLFW3 joystick functionality not available in web