mirror of
				https://github.com/Drezil/dear-imgui.hs.git
				synced 2025-11-03 22:51:07 +01:00 
			
		
		
		
	Merge branch 'main' into sharedLib
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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 ()
 | 
			
		||||
 
 | 
			
		||||
@@ -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 ()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user