diff --git a/ChangeLog.md b/ChangeLog.md index 46ac282..1680671 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Changelog for dear-imgui +## [2.1.1] + +- Build flag fix for MacOS. + ## [2.1.0] - `imgui` updated to [1.88]. @@ -87,6 +91,8 @@ Initial Hackage release based on [1.83]. [1.4.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v1.4.0 [1.5.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v1.5.0 [2.0.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.0.0 +[2.1.0]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.0 +[2.1.1]: https://github.com/haskell-game/dear-imgui.hs/tree/v2.1.1 [1.87]: https://github.com/ocornut/imgui/releases/tag/v1.87 [1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86 diff --git a/dear-imgui.cabal b/dear-imgui.cabal index 1de69f0..816c968 100644 --- a/dear-imgui.cabal +++ b/dear-imgui.cabal @@ -1,7 +1,7 @@ cabal-version: 3.0 name: dear-imgui -version: 2.1.0 +version: 2.1.1 author: Oliver Charles maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com license: BSD-3-Clause @@ -219,6 +219,10 @@ library , unordered-containers >= 0.2.11 && < 0.3 + if os(darwin) + ghc-options: + -optcxx-std=c++11 + if flag(disable-obsolete) cxx-options: -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS @@ -325,7 +329,7 @@ executable glfw main-is: Main.hs hs-source-dirs: examples/glfw default-language: Haskell2010 - if (!flag(examples) || !flag(glfw) || !flag(opengl3)) + if (!flag(examples) || !flag(glfw) || !flag(opengl2)) buildable: False else build-depends: base, GLFW-b, gl, dear-imgui, managed, text diff --git a/src/DearImGui.hs b/src/DearImGui.hs index 6ac731f..3f3e8d3 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -226,6 +226,7 @@ module DearImGui , treeNode , treePush , Raw.treePop + , setNextItemOpen -- ** Selectables , selectable @@ -237,6 +238,7 @@ module DearImGui , listBox -- ** Data Plotting + , plotLines , plotHistogram -- ** Menus @@ -1545,6 +1547,9 @@ treePush :: MonadIO m => Text -> m () treePush label = liftIO do Text.withCString label Raw.treePush +-- | Wraps @ImGui::SetNextItemOpen()@. +setNextItemOpen :: MonadIO m => Bool -> m () +setNextItemOpen is_open = Raw.setNextItemOpen (bool 0 1 is_open) -- | Wraps @ImGui::Selectable()@ with default options. selectable :: MonadIO m => Text -> m Bool @@ -1590,6 +1595,12 @@ listBox label selectedIndex items = liftIO $ Managed.with m return return changed +-- | Wraps @ImGui::PlotLines()@. +plotLines :: MonadIO m => Text -> [CFloat] -> m () +plotLines label values = liftIO $ + withArrayLen values \len valuesPtr -> + Text.withCString label \labelPtr -> + Raw.plotLines labelPtr valuesPtr (fromIntegral len) -- | Wraps @ImGui::PlotHistogram()@. plotHistogram :: MonadIO m => Text -> [CFloat] -> m () diff --git a/src/DearImGui/Raw.hs b/src/DearImGui/Raw.hs index 72e2cd1..24b00c7 100644 --- a/src/DearImGui/Raw.hs +++ b/src/DearImGui/Raw.hs @@ -185,6 +185,7 @@ module DearImGui.Raw , treeNode , treePush , treePop + , setNextItemOpen -- ** Selectables , selectable @@ -193,6 +194,7 @@ module DearImGui.Raw , listBox -- * Data Plotting + , plotLines , plotHistogram -- ** Menus @@ -1232,6 +1234,11 @@ treePop = liftIO do [C.exp| void { TreePop() } |] +-- | Wraps @ImGui::SetNextItemOpen()@. +setNextItemOpen :: (MonadIO m) => CBool -> m () +setNextItemOpen is_open = liftIO do + [C.exp| void { SetNextItemOpen($(bool is_open)) } |] + -- -- | Wraps @ImGui::Selectable()@. -- selectable :: (MonadIO m) => CString -> m Bool -- selectable labelPtr = liftIO do @@ -1250,6 +1257,10 @@ listBox :: (MonadIO m) => CString -> Ptr CInt -> Ptr CString -> CInt -> m Bool listBox labelPtr iPtr itemsPtr itemsLen = liftIO do (0 /=) <$> [C.exp| bool { ListBox($(char* labelPtr), $(int* iPtr), $(char** itemsPtr), $(int itemsLen)) }|] +-- | Wraps @ImGui::PlotLines()@. +plotLines :: (MonadIO m) => CString -> Ptr CFloat -> CInt -> m () +plotLines labelPtr valuesPtr valuesLen = liftIO do + [C.exp| void { PlotLines($(char* labelPtr), $(float* valuesPtr), $(int valuesLen)) } |] -- | Wraps @ImGui::PlotHistogram()@. plotHistogram :: (MonadIO m) => CString -> Ptr CFloat -> CInt -> m ()