From ae3fdb8bc3603b4592ddb3a5b0d02a897812a4f1 Mon Sep 17 00:00:00 2001 From: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com> Date: Sun, 13 Feb 2022 19:12:15 +0300 Subject: [PATCH] Add new GLFW callback from 1.87 (#128) --- src/DearImGui/GLFW.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/DearImGui/GLFW.hs b/src/DearImGui/GLFW.hs index a476144..6f8fcc6 100644 --- a/src/DearImGui/GLFW.hs +++ b/src/DearImGui/GLFW.hs @@ -23,6 +23,7 @@ module DearImGui.GLFW ( -- $callbacks , glfwWindowFocusCallback , glfwCursorEnterCallback + , glfwCursorPosCallback , glfwMouseButtonCallback , glfwScrollCallback , glfwKeyCallback @@ -108,6 +109,20 @@ glfwCursorEnterCallback window entered = liftIO do where windowPtr = castPtr $ unWindow window +glfwCursorPosCallback :: MonadIO m => Window -> CDouble -> CDouble -> m () +glfwCursorPosCallback window x y = liftIO do + [C.exp| void { + ImGui_ImplGlfw_CursorPosCallback( + static_cast( + $(void * windowPtr) + ), + $(double x), + $(double y) + ); + } |] + where + windowPtr = castPtr $ unWindow window + glfwMouseButtonCallback :: MonadIO m => Window -> CInt -> CInt -> CInt -> m () glfwMouseButtonCallback window button action mods = liftIO do [C.exp| void {