diff --git a/src/DearImGui.hs b/src/DearImGui.hs index 6ac731f..f608843 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -237,6 +237,7 @@ module DearImGui , listBox -- ** Data Plotting + , plotLines , plotHistogram -- ** Menus @@ -1590,6 +1591,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 () diff --git a/src/DearImGui/Raw.hs b/src/DearImGui/Raw.hs index 72e2cd1..89ed760 100644 --- a/src/DearImGui/Raw.hs +++ b/src/DearImGui/Raw.hs @@ -193,6 +193,7 @@ module DearImGui.Raw , listBox -- * Data Plotting + , plotLines , plotHistogram -- ** Menus @@ -1250,6 +1251,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 ()