mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2025-07-07 13:35:50 +02:00
Basic wrapper for plotHistogram
This commit is contained in:
@ -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).
|
||||
--
|
||||
|
Reference in New Issue
Block a user