Merge branch 'main' into sharedLib

This commit is contained in:
Alexander Bondarenko 2022-11-30 19:27:08 +03:00 committed by GitHub
commit 0b87bd8519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# Changelog for dear-imgui # Changelog for dear-imgui
## [2.1.1]
- Build flag fix for MacOS.
## [2.1.0] ## [2.1.0]
- `imgui` updated to [1.88]. - `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.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 [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.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.87]: https://github.com/ocornut/imgui/releases/tag/v1.87
[1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86 [1.86]: https://github.com/ocornut/imgui/releases/tag/v1.86

View File

@ -1,7 +1,7 @@
cabal-version: 3.0 cabal-version: 3.0
name: dear-imgui name: dear-imgui
version: 2.1.0 version: 2.1.1
author: Oliver Charles author: Oliver Charles
maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com
license: BSD-3-Clause license: BSD-3-Clause
@ -219,6 +219,10 @@ library
, unordered-containers , unordered-containers
>= 0.2.11 && < 0.3 >= 0.2.11 && < 0.3
if os(darwin)
ghc-options:
-optcxx-std=c++11
if flag(disable-obsolete) if flag(disable-obsolete)
cxx-options: -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS cxx-options: -DIMGUI_DISABLE_OBSOLETE_FUNCTIONS
@ -325,7 +329,7 @@ executable glfw
main-is: Main.hs main-is: Main.hs
hs-source-dirs: examples/glfw hs-source-dirs: examples/glfw
default-language: Haskell2010 default-language: Haskell2010
if (!flag(examples) || !flag(glfw) || !flag(opengl3)) if (!flag(examples) || !flag(glfw) || !flag(opengl2))
buildable: False buildable: False
else else
build-depends: base, GLFW-b, gl, dear-imgui, managed, text build-depends: base, GLFW-b, gl, dear-imgui, managed, text

View File

@ -226,6 +226,7 @@ module DearImGui
, treeNode , treeNode
, treePush , treePush
, Raw.treePop , Raw.treePop
, setNextItemOpen
-- ** Selectables -- ** Selectables
, selectable , selectable
@ -237,6 +238,7 @@ module DearImGui
, listBox , listBox
-- ** Data Plotting -- ** Data Plotting
, plotLines
, plotHistogram , plotHistogram
-- ** Menus -- ** Menus
@ -1545,6 +1547,9 @@ treePush :: MonadIO m => Text -> m ()
treePush label = liftIO do treePush label = liftIO do
Text.withCString label Raw.treePush 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. -- | Wraps @ImGui::Selectable()@ with default options.
selectable :: MonadIO m => Text -> m Bool selectable :: MonadIO m => Text -> m Bool
@ -1590,6 +1595,12 @@ listBox label selectedIndex items = liftIO $ Managed.with m return
return changed 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()@. -- | Wraps @ImGui::PlotHistogram()@.
plotHistogram :: MonadIO m => Text -> [CFloat] -> m () plotHistogram :: MonadIO m => Text -> [CFloat] -> m ()

View File

@ -185,6 +185,7 @@ module DearImGui.Raw
, treeNode , treeNode
, treePush , treePush
, treePop , treePop
, setNextItemOpen
-- ** Selectables -- ** Selectables
, selectable , selectable
@ -193,6 +194,7 @@ module DearImGui.Raw
, listBox , listBox
-- * Data Plotting -- * Data Plotting
, plotLines
, plotHistogram , plotHistogram
-- ** Menus -- ** Menus
@ -1232,6 +1234,11 @@ treePop = liftIO do
[C.exp| void { TreePop() } |] [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()@. -- -- | Wraps @ImGui::Selectable()@.
-- selectable :: (MonadIO m) => CString -> m Bool -- selectable :: (MonadIO m) => CString -> m Bool
-- selectable labelPtr = liftIO do -- 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 listBox labelPtr iPtr itemsPtr itemsLen = liftIO do
(0 /=) <$> [C.exp| bool { ListBox($(char* labelPtr), $(int* iPtr), $(char** itemsPtr), $(int itemsLen)) }|] (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()@. -- | Wraps @ImGui::PlotHistogram()@.
plotHistogram :: (MonadIO m) => CString -> Ptr CFloat -> CInt -> m () plotHistogram :: (MonadIO m) => CString -> Ptr CFloat -> CInt -> m ()