mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57: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"
|
||||
endCombo
|
||||
|
||||
plotHistogram "A histogram" [ 10, 10, 20, 30, 90 ]
|
||||
|
||||
beginMainMenuBar >>= whenTrue do
|
||||
beginMenu "Hello" >>= whenTrue do
|
||||
menuItem "Hello"
|
||||
|
@ -65,6 +65,9 @@ module DearImGui
|
||||
-- ** Selectables
|
||||
, selectable
|
||||
|
||||
-- * Data Plotting
|
||||
, plotHistogram
|
||||
|
||||
-- ** Menus
|
||||
, beginMenuBar
|
||||
, endMenuBar
|
||||
@ -371,6 +374,15 @@ selectable label = liftIO do
|
||||
(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'
|
||||
-- flag set on parent window).
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user