From 85c6f34054700943751b594ed1bb52c7e01c8e57 Mon Sep 17 00:00:00 2001 From: Ollie Charles Date: Sun, 24 Jan 2021 16:58:52 +0000 Subject: [PATCH] Wrap ImGui::SameLine() --- Main.hs | 6 +++--- src/DearImGui.hs | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Main.hs b/Main.hs index 987618e..11a2b28 100644 --- a/Main.hs +++ b/Main.hs @@ -48,13 +48,13 @@ loop w checked = do True -> putStrLn "Oh hi Mark" False -> return () - smallButton "Click me" >>= \case + sameLine >> smallButton "Click me" >>= \case True -> putStrLn "Oh hi Mark" False -> return () - arrowButton "Arrow" ImGuiDirUp + sameLine >> arrowButton "Arrow" ImGuiDirUp - checkbox "Check!" checked >>= \case + sameLine >> checkbox "Check!" checked >>= \case True -> readIORef checked >>= print False -> return () diff --git a/src/DearImGui.hs b/src/DearImGui.hs index 6984425..a24164a 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -48,6 +48,9 @@ module DearImGui , begin , end + -- * Cursor/Layout + , sameLine + -- * Widgets -- ** Text , text @@ -308,6 +311,14 @@ end = liftIO do [C.exp| void { ImGui::End(); } |] +-- | Call between widgets or groups to layout them horizontally. +-- +-- Wraps @ImGui::SameLine@. +sameLine :: MonadIO m => m () +sameLine = liftIO do + [C.exp| void { SameLine(); } |] + + -- | Formatted text. -- -- Wraps @ImGui::Text()@.