From 52142bbf7e54503cad9647c2ff46c9bbcffcaffc Mon Sep 17 00:00:00 2001 From: Tristan de Cacqueray Date: Mon, 5 Dec 2022 14:47:21 +0000 Subject: [PATCH] Add formatPtr to Raw.dragFloat* and Raw.sliderFloat* (#165) --- src/DearImGui.hs | 16 +++++++-------- src/DearImGui/Raw.hs | 48 ++++++++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/DearImGui.hs b/src/DearImGui.hs index d54e069..82dcd0f 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -646,7 +646,7 @@ dragFloat desc ref speed minValue maxValue = liftIO do currentValue <- get ref with (realToFrac currentValue) \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.dragFloat descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) + Raw.dragFloat descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) nullPtr when changed do newValue <- peek floatPtr @@ -661,7 +661,7 @@ dragFloat2 desc ref speed minValue maxValue = liftIO do (x, y) <- get ref withArray [ realToFrac x, realToFrac y ] \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.dragFloat2 descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) + Raw.dragFloat2 descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) nullPtr when changed do [x', y'] <- peekArray 2 floatPtr @@ -675,7 +675,7 @@ dragFloat3 desc ref speed minValue maxValue = liftIO do (x, y, z) <- get ref withArray [ realToFrac x, realToFrac y, realToFrac z ] \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.dragFloat3 descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) + Raw.dragFloat3 descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) nullPtr when changed do [x', y', z'] <- peekArray 3 floatPtr @@ -690,7 +690,7 @@ dragFloat4 desc ref speed minValue maxValue = liftIO do (x, y, z, u) <- get ref withArray [ realToFrac x, realToFrac y, realToFrac z, realToFrac u ] \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.dragFloat4 descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) + Raw.dragFloat4 descPtr floatPtr (CFloat speed) (CFloat minValue) (CFloat maxValue) nullPtr when changed do [x', y', z', u'] <- peekArray 4 floatPtr @@ -969,7 +969,7 @@ sliderFloat desc ref minValue maxValue = liftIO do currentValue <- get ref with (realToFrac currentValue) \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.sliderFloat descPtr floatPtr (CFloat minValue) (CFloat maxValue) + Raw.sliderFloat descPtr floatPtr (CFloat minValue) (CFloat maxValue) nullPtr when changed do newValue <- peek floatPtr @@ -983,7 +983,7 @@ sliderFloat2 desc ref minValue maxValue = liftIO do (x, y) <- get ref withArray [ realToFrac x, realToFrac y ] \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.sliderFloat2 descPtr floatPtr (CFloat minValue) (CFloat maxValue) + Raw.sliderFloat2 descPtr floatPtr (CFloat minValue) (CFloat maxValue) nullPtr when changed do [x', y'] <- peekArray 2 floatPtr @@ -997,7 +997,7 @@ sliderFloat3 desc ref minValue maxValue = liftIO do (x, y, z) <- get ref withArray [ realToFrac x, realToFrac y, realToFrac z ] \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.sliderFloat3 descPtr floatPtr (CFloat minValue) (CFloat maxValue) + Raw.sliderFloat3 descPtr floatPtr (CFloat minValue) (CFloat maxValue) nullPtr when changed do [x', y', z'] <- peekArray 3 floatPtr @@ -1011,7 +1011,7 @@ sliderFloat4 desc ref minValue maxValue = liftIO do (x, y, z, u) <- get ref withArray [ realToFrac x, realToFrac y, realToFrac z, realToFrac u ] \floatPtr -> do changed <- Text.withCString desc \descPtr -> - Raw.sliderFloat4 descPtr floatPtr (CFloat minValue) (CFloat maxValue) + Raw.sliderFloat4 descPtr floatPtr (CFloat minValue) (CFloat maxValue) nullPtr when changed do [x', y', z', u'] <- peekArray 4 floatPtr diff --git a/src/DearImGui/Raw.hs b/src/DearImGui/Raw.hs index 24b00c7..aecd642 100644 --- a/src/DearImGui/Raw.hs +++ b/src/DearImGui/Raw.hs @@ -693,27 +693,27 @@ combo labelPtr iPtr itemsPtr itemsLen = liftIO do -- | Wraps @ImGui::DragFloat()@ -dragFloat :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> m Bool -dragFloat descPtr floatPtr speed minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { DragFloat( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue)) } |] +dragFloat :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool +dragFloat descPtr floatPtr speed minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { DragFloat( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::DragFloat2()@ -dragFloat2 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> m Bool -dragFloat2 descPtr floatPtr speed minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { DragFloat2( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue)) } |] +dragFloat2 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool +dragFloat2 descPtr floatPtr speed minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { DragFloat2( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::DragFloat3()@ -dragFloat3 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> m Bool -dragFloat3 descPtr floatPtr speed minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { DragFloat3( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue)) } |] +dragFloat3 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool +dragFloat3 descPtr floatPtr speed minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { DragFloat3( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::DragFloat4()@ -dragFloat4 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> m Bool -dragFloat4 descPtr floatPtr speed minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { DragFloat4( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue)) } |] +dragFloat4 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool +dragFloat4 descPtr floatPtr speed minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { DragFloat4( $(char* descPtr), $(float* floatPtr), $(float speed), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::DragFloatRange2()@ @@ -853,27 +853,27 @@ dragScalarN labelPtr dataType dataPtr components vSpeed minPtr maxPtr formatPtr maxPtr_ = castPtr maxPtr -- | Wraps @ImGui::SliderFloat()@ -sliderFloat :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> m Bool -sliderFloat descPtr floatPtr minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { SliderFloat( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue)) } |] +sliderFloat :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool +sliderFloat descPtr floatPtr minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { SliderFloat( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::SliderFloat2()@ -sliderFloat2 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> m Bool -sliderFloat2 descPtr floatPtr minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { SliderFloat2( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue)) } |] +sliderFloat2 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool +sliderFloat2 descPtr floatPtr minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { SliderFloat2( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::SliderFloat3()@ -sliderFloat3 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> m Bool -sliderFloat3 descPtr floatPtr minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { SliderFloat3( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue)) } |] +sliderFloat3 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool +sliderFloat3 descPtr floatPtr minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { SliderFloat3( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::SliderFloat4()@ -sliderFloat4 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> m Bool -sliderFloat4 descPtr floatPtr minValue maxValue = liftIO do - (0 /=) <$> [C.exp| bool { SliderFloat4( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue)) } |] +sliderFloat4 :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool +sliderFloat4 descPtr floatPtr minValue maxValue formatPtr = liftIO do + (0 /=) <$> [C.exp| bool { SliderFloat4( $(char* descPtr), $(float* floatPtr), $(float minValue), $(float maxValue), $(char* formatPtr)) } |] -- | Wraps @ImGui::SliderAngle()@ sliderAngle :: (MonadIO m) => CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> ImGuiSliderFlags -> m Bool