From 49539fc1ba04c590af0718066ce7a9aead8ff336 Mon Sep 17 00:00:00 2001 From: Stefan Dresselhaus Date: Thu, 21 Jul 2022 00:42:39 +0200 Subject: [PATCH] added withPlot --- src/DearImGui/Plot.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/DearImGui/Plot.hs b/src/DearImGui/Plot.hs index f4e90f3..f4a1436 100644 --- a/src/DearImGui/Plot.hs +++ b/src/DearImGui/Plot.hs @@ -27,6 +27,9 @@ module DearImGui.Plot -- * Demo so you can play with all features , Raw.Plot.showPlotDemoWindow + -- * Plot Creation + , withPlot + -- * TEST , plotLine ) @@ -80,6 +83,11 @@ plotLine label xs ys = liftIO $ do withArray (map realToFrac ys) \ysPtr -> do Raw.Plot.plotLine labelPtr xsPtr ysPtr size +withPlot :: (MonadIO m) => String -> m () -> m () +withPlot p a = Raw.Plot.beginPlot p >>= \case + False -> return () + True -> a >> Raw.Plot.endPlot + -- setNextPlotLimits :: MonadIO m => (Double, Double) -> (Double, Double) -> m () -- setNextPlotLimits (minX, maxX) (minY, maxY) = liftIO $ do -- Raw.Plot.setNextPlotLimits (minX', maxX') (minY', maxY')