Basic wrapper for plotHistogram

This commit is contained in:
Oliver Charles
2021-01-24 20:23:58 +00:00
parent ff989ba403
commit ecab9d37a2
2 changed files with 14 additions and 0 deletions

View File

@ -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).
--