Skip to content

Loading…

Interface to enable/disable autopoll #20

Merged
merged 1 commit into from

2 participants

@christiaanb

GLFW implicitly calls 'pollEvents' after a 'swapBuffers' call by default. You need to be able to disable this auto-polling if you want to implement the more CPU-friendly "passive" main-loop.

@bsl
Owner
@bsl bsl merged commit 65d2d49 into bsl:master
@bsl
Owner

Hi, I finally took care of this. 0.1.0.2 is up on Hackage. I'm very sorry for taking so long. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2012
  1. @christiaanb
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/Graphics/UI/GLFW.hsc
View
11 src/Graphics/UI/GLFW.hsc
@@ -56,6 +56,8 @@ module Graphics.UI.GLFW
-- * Input
, pollEvents
, waitEvents
+ , enableAutoPoll
+ , disableAutoPoll
-- ** Keyboard
, keyIsPressed
, setCharCallback
@@ -554,6 +556,15 @@ waitEvents :: IO ()
waitEvents =
glfwWaitEvents
+
+-- Make 'swapBuffers' implicitly call 'pollEvents' (Default)
+enableAutoPoll :: IO ()
+enableAutoPoll = glfwEnable (#const GLFW_AUTO_POLL_EVENTS)
+
+-- Disable 'swapBuffers' implicitly calling 'pollEvents'
+disableAutoPoll :: IO ()
+disableAutoPoll = glfwDisable (#const GLFW_AUTO_POLL_EVENTS)
+
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Keyboard
Something went wrong with that request. Please try again.