From 5cdce50c3ab579252a72e91fbb540fcac445ce21 Mon Sep 17 00:00:00 2001 From: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com> Date: Mon, 3 May 2021 12:57:23 +0300 Subject: [PATCH] Add wantCaptureMouse, wantCaptureKeyboard (#54) --- src/DearImGui.hs | 2 ++ src/DearImGui/Raw.hs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/DearImGui.hs b/src/DearImGui.hs index a002ace..650b872 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -187,6 +187,8 @@ module DearImGui -- * Item/Widgets Utilities , Raw.isItemHovered + , Raw.wantCaptureMouse + , Raw.wantCaptureKeyboard -- * Types , module DearImGui.Enums diff --git a/src/DearImGui/Raw.hs b/src/DearImGui/Raw.hs index 9badd48..18c5113 100644 --- a/src/DearImGui/Raw.hs +++ b/src/DearImGui/Raw.hs @@ -156,6 +156,8 @@ module DearImGui.Raw -- * Item/Widgets Utilities , isItemHovered + , wantCaptureMouse + , wantCaptureKeyboard -- * Types , module DearImGui.Enums @@ -873,3 +875,11 @@ pushStyleVar style valPtr = liftIO do popStyleVar :: (MonadIO m) => CInt -> m () popStyleVar n = liftIO do [C.exp| void { PopStyleVar($(int n)) } |] + +wantCaptureMouse :: MonadIO m => m Bool +wantCaptureMouse = liftIO do + (0 /=) <$> [C.exp| bool { GetIO().WantCaptureMouse } |] + +wantCaptureKeyboard :: MonadIO m => m Bool +wantCaptureKeyboard = liftIO do + (0 /=) <$> [C.exp| bool { GetIO().WantCaptureKeyboard } |]