mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-26 10:37:00 +00:00
Basic wrapper for plotHistogram
This commit is contained in:
parent
ff989ba403
commit
ecab9d37a2
2
Main.hs
2
Main.hs
@ -78,6 +78,8 @@ loop w checked = do
|
|||||||
selectable "Testing 2"
|
selectable "Testing 2"
|
||||||
endCombo
|
endCombo
|
||||||
|
|
||||||
|
plotHistogram "A histogram" [ 10, 10, 20, 30, 90 ]
|
||||||
|
|
||||||
beginMainMenuBar >>= whenTrue do
|
beginMainMenuBar >>= whenTrue do
|
||||||
beginMenu "Hello" >>= whenTrue do
|
beginMenu "Hello" >>= whenTrue do
|
||||||
menuItem "Hello"
|
menuItem "Hello"
|
||||||
|
@ -65,6 +65,9 @@ module DearImGui
|
|||||||
-- ** Selectables
|
-- ** Selectables
|
||||||
, selectable
|
, selectable
|
||||||
|
|
||||||
|
-- * Data Plotting
|
||||||
|
, plotHistogram
|
||||||
|
|
||||||
-- ** Menus
|
-- ** Menus
|
||||||
, beginMenuBar
|
, beginMenuBar
|
||||||
, endMenuBar
|
, endMenuBar
|
||||||
@ -371,6 +374,15 @@ selectable label = liftIO do
|
|||||||
(1 == ) <$> [C.exp| bool { Selectable($(char* labelPtr)) } |]
|
(1 == ) <$> [C.exp| bool { Selectable($(char* labelPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
-- | Wraps @ImGui::PlotHistogram()@.
|
||||||
|
plotHistogram :: MonadIO m => String -> [CFloat] -> m ()
|
||||||
|
plotHistogram label values = liftIO $
|
||||||
|
withArrayLen values \len valuesPtr ->
|
||||||
|
withCString label \labelPtr -> do
|
||||||
|
let c'len = fromIntegral len
|
||||||
|
[C.exp| void { PlotHistogram($(char* labelPtr), $(float* valuesPtr), $(int c'len)) } |]
|
||||||
|
|
||||||
|
|
||||||
-- | Append to menu-bar of current window (requires 'ImGuiWindowFlagsMenuBar'
|
-- | Append to menu-bar of current window (requires 'ImGuiWindowFlagsMenuBar'
|
||||||
-- flag set on parent window).
|
-- flag set on parent window).
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user