Add plotLines (#158)

This commit is contained in:
Tristan de Cacqueray 2022-11-20 15:57:15 +00:00 committed by GitHub
parent 9dac0f9fbe
commit 051a17a1c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -237,6 +237,7 @@ module DearImGui
, listBox , listBox
-- ** Data Plotting -- ** Data Plotting
, plotLines
, plotHistogram , plotHistogram
-- ** Menus -- ** Menus
@ -1590,6 +1591,12 @@ listBox label selectedIndex items = liftIO $ Managed.with m return
return changed 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()@. -- | Wraps @ImGui::PlotHistogram()@.
plotHistogram :: MonadIO m => Text -> [CFloat] -> m () plotHistogram :: MonadIO m => Text -> [CFloat] -> m ()

View File

@ -193,6 +193,7 @@ module DearImGui.Raw
, listBox , listBox
-- * Data Plotting -- * Data Plotting
, plotLines
, plotHistogram , plotHistogram
-- ** Menus -- ** Menus
@ -1250,6 +1251,10 @@ listBox :: (MonadIO m) => CString -> Ptr CInt -> Ptr CString -> CInt -> m Bool
listBox labelPtr iPtr itemsPtr itemsLen = liftIO do listBox labelPtr iPtr itemsPtr itemsLen = liftIO do
(0 /=) <$> [C.exp| bool { ListBox($(char* labelPtr), $(int* iPtr), $(char** itemsPtr), $(int itemsLen)) }|] (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()@. -- | Wraps @ImGui::PlotHistogram()@.
plotHistogram :: (MonadIO m) => CString -> Ptr CFloat -> CInt -> m () plotHistogram :: (MonadIO m) => CString -> Ptr CFloat -> CInt -> m ()