diff --git a/src/DearImGui.hs b/src/DearImGui.hs index c71d5ef..9de17e7 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -49,6 +49,15 @@ module DearImGui , begin , Raw.end + + -- ** Utilities + + , Raw.getWindowPos + , Raw.getWindowSize + , Raw.getWindowWidth + , Raw.getWindowHeight + + -- ** Manipulation , setNextWindowPos , setNextWindowSize , Raw.setNextWindowFullscreen @@ -57,7 +66,7 @@ module DearImGui , setNextWindowCollapsed , setNextWindowBgAlpha - -- * Child Windows + -- ** Child Windows , withChild , withChildOpen , beginChild diff --git a/src/DearImGui/Raw.hs b/src/DearImGui/Raw.hs index 3a1caa9..da06d53 100644 --- a/src/DearImGui/Raw.hs +++ b/src/DearImGui/Raw.hs @@ -43,6 +43,16 @@ module DearImGui.Raw -- * Windows , begin , end + + -- ** Utilities + + , getWindowPos + , getWindowSize + , getWindowWidth + , getWindowHeight + + -- ** Manipulation + , setNextWindowPos , setNextWindowSize , setNextWindowFullscreen @@ -51,7 +61,7 @@ module DearImGui.Raw , setNextWindowCollapsed , setNextWindowBgAlpha - -- * Child Windows + -- ** Child Windows , beginChild , endChild @@ -1088,6 +1098,31 @@ isItemHovered :: (MonadIO m) => m Bool isItemHovered = liftIO do (0 /=) <$> [C.exp| bool { IsItemHovered() } |] +getWindowPos :: (MonadIO m) => m ImVec2 +getWindowPos = liftIO do + C.withPtr_ \ptr -> + [C.block| + void { + *$(ImVec2 * ptr) = GetWindowPos(); + } + |] + +getWindowSize :: (MonadIO m) => m ImVec2 +getWindowSize = liftIO do + C.withPtr_ \ptr -> + [C.block| + void { + *$(ImVec2 * ptr) = GetWindowSize(); + } + |] + +getWindowWidth :: (MonadIO m) => m CFloat +getWindowWidth = liftIO do + [C.exp| float { GetWindowWidth() } |] + +getWindowHeight :: (MonadIO m) => m CFloat +getWindowHeight = liftIO do + [C.exp| float { GetWindowHeight() } |] -- | Set next window position. Call before `begin` Use pivot=(0.5,0.5) to center on given point, etc. --