{-# OPTIONS -Wall #-}
{-# LANGUAGE TemplateHaskell #-}
module Raylib.Util.GUI
(
guiEnable,
guiDisable,
guiLock,
guiUnlock,
guiIsLocked,
guiSetAlpha,
guiSetState,
guiGetState,
guiSetFont,
guiGetFont,
guiSetStyle,
guiSetStyleC,
guiSetStyleE,
guiSetStyleBorderColorNormal,
guiSetStyleBaseColorNormal,
guiSetStyleTextColorNormal,
guiSetStyleBorderColorFocused,
guiSetStyleBaseColorFocused,
guiSetStyleTextColorFocused,
guiSetStyleBorderColorPressed,
guiSetStyleBaseColorPressed,
guiSetStyleTextColorPressed,
guiSetStyleBorderColorDisabled,
guiSetStyleBaseColorDisabled,
guiSetStyleTextColorDisabled,
guiSetStyleBorderWidth,
guiSetStyleTextPadding,
guiSetStyleTextAlignment,
guiSetStyleTextSize,
guiSetStyleTextSpacing,
guiSetStyleLineColor,
guiSetStyleBackgroundColor,
guiSetStyleTextLineSpacing,
guiSetStyleTextAlignmentVertical,
guiSetStyleTextWrapMode,
guiGetStyle,
guiGetStyleC,
guiGetStyleE,
guiGetStyleBorderColorNormal,
guiGetStyleBaseColorNormal,
guiGetStyleTextColorNormal,
guiGetStyleBorderColorFocused,
guiGetStyleBaseColorFocused,
guiGetStyleTextColorFocused,
guiGetStyleBorderColorPressed,
guiGetStyleBaseColorPressed,
guiGetStyleTextColorPressed,
guiGetStyleBorderColorDisabled,
guiGetStyleBaseColorDisabled,
guiGetStyleTextColorDisabled,
guiGetStyleBorderWidth,
guiGetStyleTextPadding,
guiGetStyleTextAlignment,
guiGetStyleTextSize,
guiGetStyleTextSpacing,
guiGetStyleLineColor,
guiGetStyleBackgroundColor,
guiGetStyleTextLineSpacing,
guiGetStyleTextAlignmentVertical,
guiGetStyleTextWrapMode,
guiLoadStyle,
guiLoadStyleDefault,
guiEnableTooltip,
guiDisableTooltip,
guiSetTooltip,
guiIconText,
guiSetIconScale,
guiGetIcons,
guiLoadIcons,
guiDrawIcon,
guiWindowBox,
guiGroupBox,
guiLine,
guiPanel,
guiTabBar,
guiScrollPanel,
guiLabel,
guiButton,
guiLabelButton,
guiToggle,
guiToggleGroup,
guiToggleSlider,
guiCheckBox,
guiComboBox,
guiDropdownBox,
guiSpinner,
guiValueBox,
guiTextBox,
guiSlider,
guiSliderBar,
guiProgressBar,
guiStatusBar,
guiDummyRec,
guiGrid,
guiListView,
guiListViewEx,
guiMessageBox,
guiTextInputBox,
guiColorPicker,
guiColorPanel,
guiColorBarAlpha,
guiColorBarHue,
guiColorPickerHSV,
guiColorPanelHSV,
c'guiEnable,
c'guiDisable,
c'guiLock,
c'guiUnlock,
c'guiIsLocked,
c'guiSetAlpha,
c'guiSetState,
c'guiGetState,
c'guiSetFont,
c'guiGetFont,
c'guiSetStyle,
c'guiGetStyle,
c'guiLoadStyle,
c'guiLoadStyleDefault,
c'guiEnableTooltip,
c'guiDisableTooltip,
c'guiSetTooltip,
c'guiIconText,
c'guiSetIconScale,
c'guiGetIcons,
c'guiLoadIcons,
c'guiDrawIcon,
c'guiWindowBox,
c'guiGroupBox,
c'guiLine,
c'guiPanel,
c'guiTabBar,
c'guiScrollPanel,
c'guiLabel,
c'guiButton,
c'guiLabelButton,
c'guiToggle,
c'guiToggleGroup,
c'guiToggleSlider,
c'guiCheckBox,
c'guiComboBox,
c'guiDropdownBox,
c'guiSpinner,
c'guiValueBox,
c'guiTextBox,
c'guiSlider,
c'guiSliderBar,
c'guiProgressBar,
c'guiStatusBar,
c'guiDummyRec,
c'guiGrid,
c'guiListView,
c'guiListViewEx,
c'guiMessageBox,
c'guiTextInputBox,
c'guiColorPicker,
c'guiColorPanel,
c'guiColorBarAlpha,
c'guiColorBarHue,
c'guiColorPickerHSV,
c'guiColorPanelHSV
)
where
import Control.Monad (void, (>=>))
import Data.Maybe (fromMaybe)
import Foreign (Ptr, Storable (peek), fromBool, nullPtr, toBool)
import Foreign.C
( CBool (..),
CFloat (..),
CInt (..),
CString,
CUInt (..),
newCString,
peekCString,
withCString,
)
import Raylib.Core.Textures (colorToInt, getColor)
import Raylib.Internal.Foreign (pop, popCArray, popCString, withCStringBuffer, withFreeable, withFreeableArrayLen, withMaybe, withMaybeCString)
import Raylib.Internal.TH (genNative)
import Raylib.Types (Color (Color), Font, GuiControl (Default), GuiControlProperty (..), GuiDefaultProperty (..), GuiIconName, GuiState, GuiTextAlignment, GuiTextAlignmentVertical, GuiTextWrapMode, Rectangle (Rectangle), Vector2 (Vector2), Vector3 (Vector3))
$( genNative
[ ("c'guiEnable", "GuiEnable_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiDisable", "GuiDisable_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiLock", "GuiLock_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiUnlock", "GuiUnlock_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiIsLocked", "GuiIsLocked_", "rgui_bindings.h", [t|IO CBool|], False),
("c'guiSetAlpha", "GuiSetAlpha_", "rgui_bindings.h", [t|CFloat -> IO ()|], False),
("c'guiSetState", "GuiSetState_", "rgui_bindings.h", [t|CInt -> IO ()|], False),
("c'guiGetState", "GuiGetState_", "rgui_bindings.h", [t|IO CInt|], False),
("c'guiSetFont", "GuiSetFont_", "rgui_bindings.h", [t|Ptr Font -> IO ()|], False),
("c'guiGetFont", "GuiGetFont_", "rgui_bindings.h", [t|IO (Ptr Font)|], False),
("c'guiSetStyle", "GuiSetStyle_", "rgui_bindings.h", [t|CInt -> CInt -> CInt -> IO ()|], False),
("c'guiGetStyle", "GuiGetStyle_", "rgui_bindings.h", [t|CInt -> CInt -> IO CInt|], False),
("c'guiLoadStyle", "GuiLoadStyle_", "rgui_bindings.h", [t|CString -> IO ()|], False),
("c'guiLoadStyleDefault", "GuiLoadStyleDefault_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiEnableTooltip", "GuiEnableTooltip_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiDisableTooltip", "GuiDisableTooltip_", "rgui_bindings.h", [t|IO ()|], False),
("c'guiSetTooltip", "GuiSetTooltip_", "rgui_bindings.h", [t|CString -> IO ()|], False),
("c'guiIconText", "GuiIconText_", "rgui_bindings.h", [t|CInt -> CString -> IO CString|], False),
("c'guiSetIconScale", "GuiSetIconScale_", "rgui_bindings.h", [t|CInt -> IO ()|], False),
("c'guiGetIcons", "GuiGetIcons_", "rgui_bindings.h", [t|IO (Ptr CUInt)|], False),
("c'guiLoadIcons", "GuiLoadIcons_", "rgui_bindings.h", [t|CString -> CBool -> IO (Ptr CString)|], False),
("c'guiDrawIcon", "GuiDrawIcon_", "rgui_bindings.h", [t|CInt -> CInt -> CInt -> CInt -> Ptr Color -> IO ()|], False),
("c'guiWindowBox", "GuiWindowBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiGroupBox", "GuiGroupBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiLine", "GuiLine_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiPanel", "GuiPanel_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiTabBar", "GuiTabBar_", "rgui_bindings.h", [t|Ptr Rectangle -> Ptr CString -> CInt -> Ptr CInt -> IO CInt|], False),
("c'guiScrollPanel", "GuiScrollPanel_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr Rectangle -> Ptr Vector2 -> Ptr Rectangle -> IO CInt|], False),
("c'guiLabel", "GuiLabel_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiButton", "GuiButton_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiLabelButton", "GuiLabelButton_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiToggle", "GuiToggle_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CBool -> IO CInt|], False),
("c'guiToggleGroup", "GuiToggleGroup_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> IO CInt|], False),
("c'guiToggleSlider", "GuiToggleSlider_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> IO CInt|], False),
("c'guiCheckBox", "GuiCheckBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CBool -> IO CInt|], False),
("c'guiComboBox", "GuiComboBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> IO CInt|], False),
("c'guiDropdownBox", "GuiDropdownBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> CBool -> IO CInt|], False),
("c'guiSpinner", "GuiSpinner_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> CInt -> CInt -> CBool -> IO CInt|], False),
("c'guiValueBox", "GuiValueBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> CInt -> CInt -> CBool -> IO CInt|], False),
("c'guiTextBox", "GuiTextBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CInt -> CBool -> IO CInt|], False),
("c'guiSlider", "GuiSlider_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CString -> Ptr CFloat -> CFloat -> CFloat -> IO CInt|], False),
("c'guiSliderBar", "GuiSliderBar_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CString -> Ptr CFloat -> CFloat -> CFloat -> IO CInt|], False),
("c'guiProgressBar", "GuiProgressBar_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CString -> Ptr CFloat -> CFloat -> CFloat -> IO CInt|], False),
("c'guiStatusBar", "GuiStatusBar_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiDummyRec", "GuiDummyRec_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> IO CInt|], False),
("c'guiGrid", "GuiGrid_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CFloat -> CInt -> Ptr Vector2 -> IO CInt|], False),
("c'guiListView", "GuiListView_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CInt -> Ptr CInt -> IO CInt|], False),
("c'guiListViewEx", "GuiListViewEx_", "rgui_bindings.h", [t|Ptr Rectangle -> Ptr CString -> CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO CInt|], False),
("c'guiMessageBox", "GuiMessageBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CString -> CString -> IO CInt|], False),
("c'guiTextInputBox", "GuiTextInputBox_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> CString -> CString -> CString -> CInt -> Ptr CBool -> IO CInt|], False),
("c'guiColorPicker", "GuiColorPicker_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr Color -> IO CInt|], False),
("c'guiColorPanel", "GuiColorPanel_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr Color -> IO CInt|], False),
("c'guiColorBarAlpha", "GuiColorBarAlpha_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CFloat -> IO CInt|], False),
("c'guiColorBarHue", "GuiColorBarHue_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr CFloat -> IO CInt|], False),
("c'guiColorPickerHSV", "GuiColorPickerHSV_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr Vector3 -> IO CInt|], False),
("c'guiColorPanelHSV", "GuiColorPanelHSV_", "rgui_bindings.h", [t|Ptr Rectangle -> CString -> Ptr Vector3 -> IO CInt|], False)
]
)
guiEnable :: IO ()
guiEnable :: IO ()
guiEnable = IO ()
c'guiEnable
guiDisable :: IO ()
guiDisable :: IO ()
guiDisable = IO ()
c'guiDisable
guiLock :: IO ()
guiLock :: IO ()
guiLock = IO ()
c'guiLock
guiUnlock :: IO ()
guiUnlock :: IO ()
guiUnlock = IO ()
c'guiUnlock
guiIsLocked :: IO Bool
guiIsLocked :: IO Bool
guiIsLocked = CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO CBool
c'guiIsLocked
guiSetAlpha :: Float -> IO ()
guiSetAlpha :: Float -> IO ()
guiSetAlpha = CFloat -> IO ()
c'guiSetAlpha (CFloat -> IO ()) -> (Float -> CFloat) -> Float -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac
guiSetState :: GuiState -> IO ()
guiSetState :: GuiState -> IO ()
guiSetState = CInt -> IO ()
c'guiSetState (CInt -> IO ()) -> (GuiState -> CInt) -> GuiState -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (GuiState -> Int) -> GuiState -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GuiState -> Int
forall a. Enum a => a -> Int
fromEnum
guiGetState :: IO GuiState
guiGetState :: IO GuiState
guiGetState = Int -> GuiState
forall a. Enum a => Int -> a
toEnum (Int -> GuiState) -> (CInt -> Int) -> CInt -> GuiState
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> GuiState) -> IO CInt -> IO GuiState
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO CInt
c'guiGetState
guiSetFont :: Font -> IO ()
guiSetFont :: Font -> IO ()
guiSetFont Font
font = Font -> (Ptr Font -> IO ()) -> IO ()
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Font
font Ptr Font -> IO ()
c'guiSetFont
guiGetFont :: IO Font
guiGetFont :: IO Font
guiGetFont = IO (Ptr Font)
c'guiGetFont IO (Ptr Font) -> (Ptr Font -> IO Font) -> IO Font
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr Font -> IO Font
forall a. (Freeable a, Storable a) => Ptr a -> IO a
pop
guiSetStyle :: (Enum e) => GuiControl -> e -> Int -> IO ()
guiSetStyle :: forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
control e
property Int
value = CInt -> CInt -> CInt -> IO ()
c'guiSetStyle (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (GuiControl -> Int
forall a. Enum a => a -> Int
fromEnum GuiControl
control)) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (e -> Int
forall a. Enum a => a -> Int
fromEnum e
property)) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
value)
guiSetStyleC :: (Enum e) => GuiControl -> e -> Color -> IO ()
guiSetStyleC :: forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control e
property Color
color = GuiControl -> e -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
control e
property (Color -> Int
colorToInt Color
color)
guiSetStyleE :: (Enum e, Enum v) => GuiControl -> e -> v -> IO ()
guiSetStyleE :: forall e v. (Enum e, Enum v) => GuiControl -> e -> v -> IO ()
guiSetStyleE GuiControl
control e
property v
value = GuiControl -> e -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
control e
property (v -> Int
forall a. Enum a => a -> Int
fromEnum v
value)
guiSetStyleBorderColorNormal :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorNormal :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorNormal GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BorderColorNormal
guiSetStyleBaseColorNormal :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorNormal :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorNormal GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BaseColorNormal
guiSetStyleTextColorNormal :: GuiControl -> Color -> IO ()
guiSetStyleTextColorNormal :: GuiControl -> Color -> IO ()
guiSetStyleTextColorNormal GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
TextColorNormal
guiSetStyleBorderColorFocused :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorFocused :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorFocused GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BorderColorFocused
guiSetStyleBaseColorFocused :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorFocused :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorFocused GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BaseColorFocused
guiSetStyleTextColorFocused :: GuiControl -> Color -> IO ()
guiSetStyleTextColorFocused :: GuiControl -> Color -> IO ()
guiSetStyleTextColorFocused GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
TextColorFocused
guiSetStyleBorderColorPressed :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorPressed :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorPressed GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BorderColorPressed
guiSetStyleBaseColorPressed :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorPressed :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorPressed GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BaseColorPressed
guiSetStyleTextColorPressed :: GuiControl -> Color -> IO ()
guiSetStyleTextColorPressed :: GuiControl -> Color -> IO ()
guiSetStyleTextColorPressed GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
TextColorPressed
guiSetStyleBorderColorDisabled :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorDisabled :: GuiControl -> Color -> IO ()
guiSetStyleBorderColorDisabled GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BorderColorDisabled
guiSetStyleBaseColorDisabled :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorDisabled :: GuiControl -> Color -> IO ()
guiSetStyleBaseColorDisabled GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
BaseColorDisabled
guiSetStyleTextColorDisabled :: GuiControl -> Color -> IO ()
guiSetStyleTextColorDisabled :: GuiControl -> Color -> IO ()
guiSetStyleTextColorDisabled GuiControl
control = GuiControl -> GuiControlProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
control GuiControlProperty
TextColorDisabled
guiSetStyleBorderWidth :: GuiControl -> Int -> IO ()
guiSetStyleBorderWidth :: GuiControl -> Int -> IO ()
guiSetStyleBorderWidth GuiControl
control = GuiControl -> GuiControlProperty -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
control GuiControlProperty
BorderWidth
guiSetStyleTextPadding :: GuiControl -> Int -> IO ()
guiSetStyleTextPadding :: GuiControl -> Int -> IO ()
guiSetStyleTextPadding GuiControl
control = GuiControl -> GuiControlProperty -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
control GuiControlProperty
TextPadding
guiSetStyleTextAlignment :: GuiControl -> GuiTextAlignment -> IO ()
guiSetStyleTextAlignment :: GuiControl -> GuiTextAlignment -> IO ()
guiSetStyleTextAlignment GuiControl
control = GuiControl -> GuiControlProperty -> GuiTextAlignment -> IO ()
forall e v. (Enum e, Enum v) => GuiControl -> e -> v -> IO ()
guiSetStyleE GuiControl
control GuiControlProperty
TextAlignment
guiSetStyleTextSize :: Int -> IO ()
guiSetStyleTextSize :: Int -> IO ()
guiSetStyleTextSize = GuiControl -> GuiDefaultProperty -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
Default GuiDefaultProperty
TextSize
guiSetStyleTextSpacing :: Int -> IO ()
guiSetStyleTextSpacing :: Int -> IO ()
guiSetStyleTextSpacing = GuiControl -> GuiDefaultProperty -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
Default GuiDefaultProperty
TextSpacing
guiSetStyleLineColor :: Color -> IO ()
guiSetStyleLineColor :: Color -> IO ()
guiSetStyleLineColor = GuiControl -> GuiDefaultProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
Default GuiDefaultProperty
LineColor
guiSetStyleBackgroundColor :: Color -> IO ()
guiSetStyleBackgroundColor :: Color -> IO ()
guiSetStyleBackgroundColor = GuiControl -> GuiDefaultProperty -> Color -> IO ()
forall e. Enum e => GuiControl -> e -> Color -> IO ()
guiSetStyleC GuiControl
Default GuiDefaultProperty
BackgroundColor
guiSetStyleTextLineSpacing :: Int -> IO ()
guiSetStyleTextLineSpacing :: Int -> IO ()
guiSetStyleTextLineSpacing = GuiControl -> GuiDefaultProperty -> Int -> IO ()
forall e. Enum e => GuiControl -> e -> Int -> IO ()
guiSetStyle GuiControl
Default GuiDefaultProperty
TextLineSpacing
guiSetStyleTextAlignmentVertical :: GuiTextAlignmentVertical -> IO ()
guiSetStyleTextAlignmentVertical :: GuiTextAlignmentVertical -> IO ()
guiSetStyleTextAlignmentVertical = GuiControl
-> GuiDefaultProperty -> GuiTextAlignmentVertical -> IO ()
forall e v. (Enum e, Enum v) => GuiControl -> e -> v -> IO ()
guiSetStyleE GuiControl
Default GuiDefaultProperty
TextAlignmentVertical
guiSetStyleTextWrapMode :: GuiTextWrapMode -> IO ()
guiSetStyleTextWrapMode :: GuiTextWrapMode -> IO ()
guiSetStyleTextWrapMode = GuiControl -> GuiDefaultProperty -> GuiTextWrapMode -> IO ()
forall e v. (Enum e, Enum v) => GuiControl -> e -> v -> IO ()
guiSetStyleE GuiControl
Default GuiDefaultProperty
TextWrapMode
guiGetStyle :: (Enum e) => GuiControl -> e -> IO Int
guiGetStyle :: forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
control e
property = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> CInt -> CInt -> IO CInt
c'guiGetStyle (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (GuiControl -> Int
forall a. Enum a => a -> Int
fromEnum GuiControl
control)) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (e -> Int
forall a. Enum a => a -> Int
fromEnum e
property))
guiGetStyleC :: (Enum e) => GuiControl -> e -> IO Color
guiGetStyleC :: forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control e
property = Integer -> Color
getColor (Integer -> Color) -> (Int -> Integer) -> Int -> Color
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Color) -> IO Int -> IO Color
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GuiControl -> e -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
control e
property
guiGetStyleE :: (Enum e, Enum v) => GuiControl -> e -> IO v
guiGetStyleE :: forall e v. (Enum e, Enum v) => GuiControl -> e -> IO v
guiGetStyleE GuiControl
control e
property = Int -> v
forall a. Enum a => Int -> a
toEnum (Int -> v) -> IO Int -> IO v
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GuiControl -> e -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
control e
property
guiGetStyleBorderColorNormal :: GuiControl -> IO Color
guiGetStyleBorderColorNormal :: GuiControl -> IO Color
guiGetStyleBorderColorNormal GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BorderColorNormal
guiGetStyleBaseColorNormal :: GuiControl -> IO Color
guiGetStyleBaseColorNormal :: GuiControl -> IO Color
guiGetStyleBaseColorNormal GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BaseColorNormal
guiGetStyleTextColorNormal :: GuiControl -> IO Color
guiGetStyleTextColorNormal :: GuiControl -> IO Color
guiGetStyleTextColorNormal GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
TextColorNormal
guiGetStyleBorderColorFocused :: GuiControl -> IO Color
guiGetStyleBorderColorFocused :: GuiControl -> IO Color
guiGetStyleBorderColorFocused GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BorderColorFocused
guiGetStyleBaseColorFocused :: GuiControl -> IO Color
guiGetStyleBaseColorFocused :: GuiControl -> IO Color
guiGetStyleBaseColorFocused GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BaseColorFocused
guiGetStyleTextColorFocused :: GuiControl -> IO Color
guiGetStyleTextColorFocused :: GuiControl -> IO Color
guiGetStyleTextColorFocused GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
TextColorFocused
guiGetStyleBorderColorPressed :: GuiControl -> IO Color
guiGetStyleBorderColorPressed :: GuiControl -> IO Color
guiGetStyleBorderColorPressed GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BorderColorPressed
guiGetStyleBaseColorPressed :: GuiControl -> IO Color
guiGetStyleBaseColorPressed :: GuiControl -> IO Color
guiGetStyleBaseColorPressed GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BaseColorPressed
guiGetStyleTextColorPressed :: GuiControl -> IO Color
guiGetStyleTextColorPressed :: GuiControl -> IO Color
guiGetStyleTextColorPressed GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
TextColorPressed
guiGetStyleBorderColorDisabled :: GuiControl -> IO Color
guiGetStyleBorderColorDisabled :: GuiControl -> IO Color
guiGetStyleBorderColorDisabled GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BorderColorDisabled
guiGetStyleBaseColorDisabled :: GuiControl -> IO Color
guiGetStyleBaseColorDisabled :: GuiControl -> IO Color
guiGetStyleBaseColorDisabled GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
BaseColorDisabled
guiGetStyleTextColorDisabled :: GuiControl -> IO Color
guiGetStyleTextColorDisabled :: GuiControl -> IO Color
guiGetStyleTextColorDisabled GuiControl
control = GuiControl -> GuiControlProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
control GuiControlProperty
TextColorDisabled
guiGetStyleBorderWidth :: GuiControl -> IO Int
guiGetStyleBorderWidth :: GuiControl -> IO Int
guiGetStyleBorderWidth GuiControl
control = GuiControl -> GuiControlProperty -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
control GuiControlProperty
BorderWidth
guiGetStyleTextPadding :: GuiControl -> IO Int
guiGetStyleTextPadding :: GuiControl -> IO Int
guiGetStyleTextPadding GuiControl
control = GuiControl -> GuiControlProperty -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
control GuiControlProperty
TextPadding
guiGetStyleTextAlignment :: GuiControl -> IO GuiTextAlignment
guiGetStyleTextAlignment :: GuiControl -> IO GuiTextAlignment
guiGetStyleTextAlignment GuiControl
control = GuiControl -> GuiControlProperty -> IO GuiTextAlignment
forall e v. (Enum e, Enum v) => GuiControl -> e -> IO v
guiGetStyleE GuiControl
control GuiControlProperty
TextAlignment
guiGetStyleTextSize :: IO Int
guiGetStyleTextSize :: IO Int
guiGetStyleTextSize = GuiControl -> GuiDefaultProperty -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
Default GuiDefaultProperty
TextSize
guiGetStyleTextSpacing :: IO Int
guiGetStyleTextSpacing :: IO Int
guiGetStyleTextSpacing = GuiControl -> GuiDefaultProperty -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
Default GuiDefaultProperty
TextSpacing
guiGetStyleLineColor :: IO Color
guiGetStyleLineColor :: IO Color
guiGetStyleLineColor = GuiControl -> GuiDefaultProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
Default GuiDefaultProperty
LineColor
guiGetStyleBackgroundColor :: IO Color
guiGetStyleBackgroundColor :: IO Color
guiGetStyleBackgroundColor = GuiControl -> GuiDefaultProperty -> IO Color
forall e. Enum e => GuiControl -> e -> IO Color
guiGetStyleC GuiControl
Default GuiDefaultProperty
BackgroundColor
guiGetStyleTextLineSpacing :: IO Int
guiGetStyleTextLineSpacing :: IO Int
guiGetStyleTextLineSpacing = GuiControl -> GuiDefaultProperty -> IO Int
forall e. Enum e => GuiControl -> e -> IO Int
guiGetStyle GuiControl
Default GuiDefaultProperty
TextLineSpacing
guiGetStyleTextAlignmentVertical :: IO GuiTextAlignmentVertical
guiGetStyleTextAlignmentVertical :: IO GuiTextAlignmentVertical
guiGetStyleTextAlignmentVertical = GuiControl -> GuiDefaultProperty -> IO GuiTextAlignmentVertical
forall e v. (Enum e, Enum v) => GuiControl -> e -> IO v
guiGetStyleE GuiControl
Default GuiDefaultProperty
TextAlignmentVertical
guiGetStyleTextWrapMode :: IO GuiTextWrapMode
guiGetStyleTextWrapMode :: IO GuiTextWrapMode
guiGetStyleTextWrapMode = GuiControl -> GuiDefaultProperty -> IO GuiTextWrapMode
forall e v. (Enum e, Enum v) => GuiControl -> e -> IO v
guiGetStyleE GuiControl
Default GuiDefaultProperty
TextWrapMode
guiLoadStyle :: String -> IO ()
guiLoadStyle :: String -> IO ()
guiLoadStyle String
fileName = String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
fileName CString -> IO ()
c'guiLoadStyle
guiLoadStyleDefault :: IO ()
guiLoadStyleDefault :: IO ()
guiLoadStyleDefault = IO ()
c'guiLoadStyleDefault
guiEnableTooltip :: IO ()
guiEnableTooltip :: IO ()
guiEnableTooltip = IO ()
c'guiEnableTooltip
guiDisableTooltip :: IO ()
guiDisableTooltip :: IO ()
guiDisableTooltip = IO ()
c'guiDisableTooltip
guiSetTooltip :: String -> IO ()
guiSetTooltip :: String -> IO ()
guiSetTooltip String
tooltip = String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
tooltip CString -> IO ()
c'guiSetTooltip
guiIconText :: GuiIconName -> String -> IO String
guiIconText :: GuiIconName -> String -> IO String
guiIconText GuiIconName
icon String
text = String -> (CString -> IO String) -> IO String
forall a. String -> (CString -> IO a) -> IO a
withCString String
text (CInt -> CString -> IO CString
c'guiIconText (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (GuiIconName -> Int
forall a. Enum a => a -> Int
fromEnum GuiIconName
icon)) (CString -> IO CString)
-> (CString -> IO String) -> CString -> IO String
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> CString -> IO String
peekCString)
guiSetIconScale :: Int -> IO ()
guiSetIconScale :: Int -> IO ()
guiSetIconScale = CInt -> IO ()
c'guiSetIconScale (CInt -> IO ()) -> (Int -> CInt) -> Int -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral
guiGetIcons :: IO (Ptr CUInt)
guiGetIcons :: IO (Ptr CUInt)
guiGetIcons = IO (Ptr CUInt)
c'guiGetIcons
guiLoadIcons ::
String ->
Bool ->
Int ->
IO [String]
guiLoadIcons :: String -> Bool -> Int -> IO [String]
guiLoadIcons String
fileName Bool
loadIconsName Int
count = do
Ptr CString
raw <- String -> (CString -> IO (Ptr CString)) -> IO (Ptr CString)
forall a. String -> (CString -> IO a) -> IO a
withCString String
fileName (\CString
f -> CString -> CBool -> IO (Ptr CString)
c'guiLoadIcons CString
f (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
loadIconsName))
[CString]
cStrings <- Int -> Ptr CString -> IO [CString]
forall a. (Freeable a, Storable a) => Int -> Ptr a -> IO [a]
popCArray Int
count Ptr CString
raw
(CString -> IO String) -> [CString] -> IO [String]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM CString -> IO String
popCString [CString]
cStrings
guiDrawIcon :: GuiIconName -> Int -> Int -> Int -> Color -> IO ()
guiDrawIcon :: GuiIconName -> Int -> Int -> Int -> Color -> IO ()
guiDrawIcon GuiIconName
icon Int
posX Int
posY Int
pixelSize Color
color = Color -> (Ptr Color -> IO ()) -> IO ()
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Color
color (CInt -> CInt -> CInt -> CInt -> Ptr Color -> IO ()
c'guiDrawIcon (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (GuiIconName -> Int
forall a. Enum a => a -> Int
fromEnum GuiIconName
icon)) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
posX) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
posY) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
pixelSize))
guiWindowBox ::
Rectangle ->
Maybe String ->
IO Bool
guiWindowBox :: Rectangle -> Maybe String -> IO Bool
guiWindowBox Rectangle
bounds Maybe String
title = CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CInt -> Bool) -> IO CInt -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (Maybe String -> (CString -> IO CInt) -> IO CInt
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
title ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiWindowBox)
guiGroupBox :: Rectangle -> Maybe String -> IO ()
guiGroupBox :: Rectangle -> Maybe String -> IO ()
guiGroupBox Rectangle
bounds Maybe String
text = IO CInt -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (Maybe String -> (CString -> IO CInt) -> IO CInt
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiGroupBox))
guiLine :: Rectangle -> Maybe String -> IO ()
guiLine :: Rectangle -> Maybe String -> IO ()
guiLine Rectangle
bounds Maybe String
text = IO CInt -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (Maybe String -> (CString -> IO CInt) -> IO CInt
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiLine))
guiPanel :: Rectangle -> Maybe String -> IO ()
guiPanel :: Rectangle -> Maybe String -> IO ()
guiPanel Rectangle
bounds Maybe String
text = IO CInt -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (Maybe String -> (CString -> IO CInt) -> IO CInt
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiPanel))
guiTabBar ::
Rectangle ->
[String] ->
Maybe Int ->
IO (Int, Maybe Int)
guiTabBar :: Rectangle -> [String] -> Maybe Int -> IO (Int, Maybe Int)
guiTabBar Rectangle
bounds [String]
tabNames Maybe Int
active = do
[CString]
cStrings <- (String -> IO CString) -> [String] -> IO [CString]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM String -> IO CString
newCString [String]
tabNames
Rectangle
-> (Ptr Rectangle -> IO (Int, Maybe Int)) -> IO (Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
[CString]
-> (Int -> Ptr CString -> IO (Int, Maybe Int))
-> IO (Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
[a] -> (Int -> Ptr a -> IO b) -> IO b
withFreeableArrayLen
[CString]
cStrings
( \Int
l Ptr CString
t ->
CInt -> (Ptr CInt -> IO (Int, Maybe Int)) -> IO (Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe Int
0 Maybe Int
active))
( \Ptr CInt
a -> do
CInt
close <- Ptr Rectangle -> Ptr CString -> CInt -> Ptr CInt -> IO CInt
c'guiTabBar Ptr Rectangle
b Ptr CString
t (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
l) Ptr CInt
a
CInt
active' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a
(Int, Maybe Int) -> IO (Int, Maybe Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
active', if CInt
close CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== (-CInt
1) then Maybe Int
forall a. Maybe a
Nothing else Int -> Maybe Int
forall a. a -> Maybe a
Just (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
close))
)
)
)
guiScrollPanel ::
Rectangle ->
Maybe String ->
Rectangle ->
Maybe Vector2 ->
Maybe Rectangle ->
IO (Vector2, Rectangle)
guiScrollPanel :: Rectangle
-> Maybe String
-> Rectangle
-> Maybe Vector2
-> Maybe Rectangle
-> IO (Vector2, Rectangle)
guiScrollPanel Rectangle
bounds Maybe String
text Rectangle
content Maybe Vector2
scroll Maybe Rectangle
view =
Rectangle
-> (Ptr Rectangle -> IO (Vector2, Rectangle))
-> IO (Vector2, Rectangle)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String
-> (CString -> IO (Vector2, Rectangle)) -> IO (Vector2, Rectangle)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
text
( \CString
t ->
Rectangle
-> (Ptr Rectangle -> IO (Vector2, Rectangle))
-> IO (Vector2, Rectangle)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
content
( \Ptr Rectangle
c ->
Vector2
-> (Ptr Vector2 -> IO (Vector2, Rectangle))
-> IO (Vector2, Rectangle)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Vector2 -> Maybe Vector2 -> Vector2
forall a. a -> Maybe a -> a
fromMaybe (Float -> Float -> Vector2
Vector2 Float
0 Float
0) Maybe Vector2
scroll)
( \Ptr Vector2
s ->
Rectangle
-> (Ptr Rectangle -> IO (Vector2, Rectangle))
-> IO (Vector2, Rectangle)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Rectangle -> Maybe Rectangle -> Rectangle
forall a. a -> Maybe a -> a
fromMaybe (Float -> Float -> Float -> Float -> Rectangle
Rectangle Float
0 Float
0 Float
0 Float
0) Maybe Rectangle
view)
( \Ptr Rectangle
v -> do
CInt
_ <- Ptr Rectangle
-> CString
-> Ptr Rectangle
-> Ptr Vector2
-> Ptr Rectangle
-> IO CInt
c'guiScrollPanel Ptr Rectangle
b CString
t Ptr Rectangle
c Ptr Vector2
s Ptr Rectangle
v
Vector2
scroll' <- Ptr Vector2 -> IO Vector2
forall a. Storable a => Ptr a -> IO a
peek Ptr Vector2
s
Rectangle
view' <- Ptr Rectangle -> IO Rectangle
forall a. Storable a => Ptr a -> IO a
peek Ptr Rectangle
v
(Vector2, Rectangle) -> IO (Vector2, Rectangle)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Vector2
scroll', Rectangle
view')
)
)
)
)
)
guiLabel :: Rectangle -> String -> IO ()
guiLabel :: Rectangle -> String -> IO ()
guiLabel Rectangle
bounds String
text = IO CInt -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (String -> (CString -> IO CInt) -> IO CInt
forall a. String -> (CString -> IO a) -> IO a
withCString String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiLabel))
guiButton :: Rectangle -> Maybe String -> IO Bool
guiButton :: Rectangle -> Maybe String -> IO Bool
guiButton Rectangle
bounds Maybe String
text = CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CInt -> Bool) -> IO CInt -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (Maybe String -> (CString -> IO CInt) -> IO CInt
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiButton)
guiLabelButton :: Rectangle -> Maybe String -> IO Bool
guiLabelButton :: Rectangle -> Maybe String -> IO Bool
guiLabelButton Rectangle
bounds Maybe String
text = CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CInt -> Bool) -> IO CInt -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (Maybe String -> (CString -> IO CInt) -> IO CInt
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiLabelButton)
guiToggle :: Rectangle -> Maybe String -> Bool -> IO Bool
guiToggle :: Rectangle -> Maybe String -> Bool -> IO Bool
guiToggle Rectangle
bounds Maybe String
text Bool
active = CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CBool) -> IO CBool
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (\Ptr Rectangle
b -> Maybe String -> (CString -> IO CBool) -> IO CBool
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text (\CString
t -> CBool -> (Ptr CBool -> IO CBool) -> IO CBool
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
active :: CBool) (\Ptr CBool
a -> Ptr Rectangle -> CString -> Ptr CBool -> IO CInt
c'guiToggle Ptr Rectangle
b CString
t Ptr CBool
a IO CInt -> IO CBool -> IO CBool
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CBool -> IO CBool
forall a. Storable a => Ptr a -> IO a
peek Ptr CBool
a)))
guiToggleGroup ::
Rectangle ->
String ->
Maybe Int ->
IO Int
guiToggleGroup :: Rectangle -> String -> Maybe Int -> IO Int
guiToggleGroup Rectangle
bounds String
text Maybe Int
active = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (\Ptr Rectangle
b -> String -> (CString -> IO CInt) -> IO CInt
forall a. String -> (CString -> IO a) -> IO a
withCString String
text (\CString
t -> CInt -> (Ptr CInt -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe Int
0 Maybe Int
active)) (\Ptr CInt
a -> Ptr Rectangle -> CString -> Ptr CInt -> IO CInt
c'guiToggleGroup Ptr Rectangle
b CString
t Ptr CInt
a IO CInt -> IO CInt -> IO CInt
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a)))
guiToggleSlider ::
Rectangle ->
String ->
Maybe Int ->
IO (Bool, Int)
guiToggleSlider :: Rectangle -> String -> Maybe Int -> IO (Bool, Int)
guiToggleSlider Rectangle
bounds String
text Maybe Int
active =
Rectangle -> (Ptr Rectangle -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
String -> (CString -> IO (Bool, Int)) -> IO (Bool, Int)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
text
( \CString
t ->
CInt -> (Ptr CInt -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe Int
0 Maybe Int
active))
( \Ptr CInt
a -> do
CInt
clicked <- Ptr Rectangle -> CString -> Ptr CInt -> IO CInt
c'guiToggleSlider Ptr Rectangle
b CString
t Ptr CInt
a
CInt
active' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a
(Bool, Int) -> IO (Bool, Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool CInt
clicked, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
active')
)
)
)
guiCheckBox ::
Rectangle ->
Maybe String ->
Bool ->
IO Bool
guiCheckBox :: Rectangle -> Maybe String -> Bool -> IO Bool
guiCheckBox Rectangle
bounds Maybe String
text Bool
checked = CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CBool) -> IO CBool
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (\Ptr Rectangle
b -> Maybe String -> (CString -> IO CBool) -> IO CBool
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString Maybe String
text (\CString
t -> CBool -> (Ptr CBool -> IO CBool) -> IO CBool
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
checked :: CBool) (\Ptr CBool
c -> Ptr Rectangle -> CString -> Ptr CBool -> IO CInt
c'guiCheckBox Ptr Rectangle
b CString
t Ptr CBool
c IO CInt -> IO CBool -> IO CBool
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CBool -> IO CBool
forall a. Storable a => Ptr a -> IO a
peek Ptr CBool
c)))
guiComboBox ::
Rectangle ->
String ->
Maybe Int ->
IO Int
guiComboBox :: Rectangle -> String -> Maybe Int -> IO Int
guiComboBox Rectangle
bounds String
text Maybe Int
active = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> IO CInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (\Ptr Rectangle
b -> String -> (CString -> IO CInt) -> IO CInt
forall a. String -> (CString -> IO a) -> IO a
withCString String
text (\CString
t -> CInt -> (Ptr CInt -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe Int
0 Maybe Int
active)) (\Ptr CInt
a -> Ptr Rectangle -> CString -> Ptr CInt -> IO CInt
c'guiComboBox Ptr Rectangle
b CString
t Ptr CInt
a IO CInt -> IO CInt -> IO CInt
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a)))
guiDropdownBox ::
Rectangle ->
String ->
Maybe Int ->
Bool ->
IO (Bool, Int)
guiDropdownBox :: Rectangle -> String -> Maybe Int -> Bool -> IO (Bool, Int)
guiDropdownBox Rectangle
bounds String
text Maybe Int
active Bool
editMode =
Rectangle -> (Ptr Rectangle -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
String -> (CString -> IO (Bool, Int)) -> IO (Bool, Int)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
text
( \CString
t ->
CInt -> (Ptr CInt -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe Int
0 Maybe Int
active))
( \Ptr CInt
a -> do
CInt
toggle <- Ptr Rectangle -> CString -> Ptr CInt -> CBool -> IO CInt
c'guiDropdownBox Ptr Rectangle
b CString
t Ptr CInt
a (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
editMode)
CInt
active' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a
(Bool, Int) -> IO (Bool, Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool CInt
toggle, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
active')
)
)
)
guiSpinner ::
Rectangle ->
Maybe String ->
Int ->
Int ->
Int ->
Bool ->
IO (Bool, Int)
guiSpinner :: Rectangle
-> Maybe String -> Int -> Int -> Int -> Bool -> IO (Bool, Int)
guiSpinner Rectangle
bounds Maybe String
text Int
value Int
minValue Int
maxValue Bool
editMode =
Rectangle -> (Ptr Rectangle -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String -> (CString -> IO (Bool, Int)) -> IO (Bool, Int)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
text
( \CString
t ->
CInt -> (Ptr CInt -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
value)
( \Ptr CInt
v -> do
CInt
changed <- Ptr Rectangle
-> CString -> Ptr CInt -> CInt -> CInt -> CBool -> IO CInt
c'guiSpinner Ptr Rectangle
b CString
t Ptr CInt
v (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue) (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
editMode)
CInt
value' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
v
(Bool, Int) -> IO (Bool, Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool CInt
changed, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
value')
)
)
)
guiValueBox ::
Rectangle ->
Maybe String ->
Int ->
Int ->
Int ->
Bool ->
IO (Bool, Int)
guiValueBox :: Rectangle
-> Maybe String -> Int -> Int -> Int -> Bool -> IO (Bool, Int)
guiValueBox Rectangle
bounds Maybe String
text Int
value Int
minValue Int
maxValue Bool
editMode =
Rectangle -> (Ptr Rectangle -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String -> (CString -> IO (Bool, Int)) -> IO (Bool, Int)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
text
( \CString
t ->
CInt -> (Ptr CInt -> IO (Bool, Int)) -> IO (Bool, Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
value)
( \Ptr CInt
v -> do
CInt
changed <- Ptr Rectangle
-> CString -> Ptr CInt -> CInt -> CInt -> CBool -> IO CInt
c'guiValueBox Ptr Rectangle
b CString
t Ptr CInt
v (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue) (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
editMode)
CInt
value' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
v
(Bool, Int) -> IO (Bool, Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool CInt
changed, CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
value')
)
)
)
guiTextBox ::
Rectangle ->
String ->
Maybe Int ->
Bool ->
IO (Bool, String)
guiTextBox :: Rectangle -> String -> Maybe Int -> Bool -> IO (Bool, String)
guiTextBox Rectangle
bounds String
text Maybe Int
bufferSize Bool
editMode =
Rectangle
-> (Ptr Rectangle -> IO (Bool, String)) -> IO (Bool, String)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
String
-> Maybe Int -> (Int -> CString -> IO Bool) -> IO (Bool, String)
forall b.
String -> Maybe Int -> (Int -> CString -> IO b) -> IO (b, String)
withCStringBuffer
String
text
Maybe Int
bufferSize
( \Int
s CString
t -> CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CInt -> Bool) -> IO CInt -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr Rectangle -> CString -> CInt -> CBool -> IO CInt
c'guiTextBox Ptr Rectangle
b CString
t (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
s) (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
editMode)
)
)
guiSlider ::
Rectangle ->
Maybe String ->
Maybe String ->
Float ->
Float ->
Float ->
IO (Bool, Float)
guiSlider :: Rectangle
-> Maybe String
-> Maybe String
-> Float
-> Float
-> Float
-> IO (Bool, Float)
guiSlider Rectangle
bounds Maybe String
textLeft Maybe String
textRight Float
value Float
minValue Float
maxValue =
Rectangle
-> (Ptr Rectangle -> IO (Bool, Float)) -> IO (Bool, Float)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String -> (CString -> IO (Bool, Float)) -> IO (Bool, Float)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
textLeft
( \CString
l ->
Maybe String -> (CString -> IO (Bool, Float)) -> IO (Bool, Float)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
textRight
( \CString
r ->
CFloat -> (Ptr CFloat -> IO (Bool, Float)) -> IO (Bool, Float)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
value)
( \Ptr CFloat
v -> do
CInt
edited <- Ptr Rectangle
-> CString -> CString -> Ptr CFloat -> CFloat -> CFloat -> IO CInt
c'guiSlider Ptr Rectangle
b CString
l CString
r Ptr CFloat
v (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
minValue) (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
maxValue)
CFloat
value' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
v
(Bool, Float) -> IO (Bool, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool CInt
edited, CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
value')
)
)
)
)
guiSliderBar ::
Rectangle ->
Maybe String ->
Maybe String ->
Float ->
Float ->
Float ->
IO (Bool, Float)
guiSliderBar :: Rectangle
-> Maybe String
-> Maybe String
-> Float
-> Float
-> Float
-> IO (Bool, Float)
guiSliderBar Rectangle
bounds Maybe String
textLeft Maybe String
textRight Float
value Float
minValue Float
maxValue =
Rectangle
-> (Ptr Rectangle -> IO (Bool, Float)) -> IO (Bool, Float)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String -> (CString -> IO (Bool, Float)) -> IO (Bool, Float)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
textLeft
( \CString
l ->
Maybe String -> (CString -> IO (Bool, Float)) -> IO (Bool, Float)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
textRight
( \CString
r ->
CFloat -> (Ptr CFloat -> IO (Bool, Float)) -> IO (Bool, Float)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
value)
( \Ptr CFloat
v -> do
CInt
edited <- Ptr Rectangle
-> CString -> CString -> Ptr CFloat -> CFloat -> CFloat -> IO CInt
c'guiSliderBar Ptr Rectangle
b CString
l CString
r Ptr CFloat
v (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
minValue) (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
maxValue)
CFloat
value' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
v
(Bool, Float) -> IO (Bool, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool CInt
edited, CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
value')
)
)
)
)
guiProgressBar ::
Rectangle ->
Maybe String ->
Maybe String ->
Float ->
Float ->
Float ->
IO Float
guiProgressBar :: Rectangle
-> Maybe String
-> Maybe String
-> Float
-> Float
-> Float
-> IO Float
guiProgressBar Rectangle
bounds Maybe String
textLeft Maybe String
textRight Float
value Float
minValue Float
maxValue =
CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac
(CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CFloat) -> IO CFloat
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String -> (CString -> IO CFloat) -> IO CFloat
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
textLeft
( \CString
l ->
Maybe String -> (CString -> IO CFloat) -> IO CFloat
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
textRight
( \CString
r ->
CFloat -> (Ptr CFloat -> IO CFloat) -> IO CFloat
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
value)
( \Ptr CFloat
v -> do
Ptr Rectangle
-> CString -> CString -> Ptr CFloat -> CFloat -> CFloat -> IO CInt
c'guiProgressBar Ptr Rectangle
b CString
l CString
r Ptr CFloat
v (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
minValue) (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
maxValue) IO CInt -> IO CFloat -> IO CFloat
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
v
)
)
)
)
guiStatusBar :: Rectangle -> String -> IO ()
guiStatusBar :: Rectangle -> String -> IO ()
guiStatusBar Rectangle
bounds String
text = IO CInt -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (String -> (CString -> IO CInt) -> IO CInt
forall a. String -> (CString -> IO a) -> IO a
withCString String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiStatusBar))
guiDummyRec :: Rectangle -> String -> IO ()
guiDummyRec :: Rectangle -> String -> IO ()
guiDummyRec Rectangle
bounds String
text = IO CInt -> IO ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (Rectangle -> (Ptr Rectangle -> IO CInt) -> IO CInt
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable Rectangle
bounds (String -> (CString -> IO CInt) -> IO CInt
forall a. String -> (CString -> IO a) -> IO a
withCString String
text ((CString -> IO CInt) -> IO CInt)
-> (Ptr Rectangle -> CString -> IO CInt)
-> Ptr Rectangle
-> IO CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Rectangle -> CString -> IO CInt
c'guiDummyRec))
guiGrid ::
Rectangle ->
Float ->
Int ->
IO (Maybe Vector2)
guiGrid :: Rectangle -> Float -> Int -> IO (Maybe Vector2)
guiGrid Rectangle
bounds Float
spacing Int
subdivs =
Rectangle
-> (Ptr Rectangle -> IO (Maybe Vector2)) -> IO (Maybe Vector2)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Vector2
-> (Ptr Vector2 -> IO (Maybe Vector2)) -> IO (Maybe Vector2)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Float -> Float -> Vector2
Vector2 (-Float
1) (-Float
1))
( \Ptr Vector2
v ->
( \Vector2
cell -> if Vector2
cell Vector2 -> Vector2 -> Bool
forall a. Eq a => a -> a -> Bool
== Float -> Float -> Vector2
Vector2 (-Float
1) (-Float
1) then Maybe Vector2
forall a. Maybe a
Nothing else Vector2 -> Maybe Vector2
forall a. a -> Maybe a
Just Vector2
cell
)
(Vector2 -> Maybe Vector2) -> IO Vector2 -> IO (Maybe Vector2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ( Ptr Rectangle
-> CString -> CFloat -> CInt -> Ptr Vector2 -> IO CInt
c'guiGrid Ptr Rectangle
b CString
forall a. Ptr a
nullPtr (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
spacing) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
subdivs) Ptr Vector2
v
IO CInt -> IO Vector2 -> IO Vector2
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Vector2 -> IO Vector2
forall a. Storable a => Ptr a -> IO a
peek Ptr Vector2
v
)
)
)
guiListView ::
Rectangle ->
String ->
Int ->
Maybe Int ->
IO (Int, Maybe Int)
guiListView :: Rectangle -> String -> Int -> Maybe Int -> IO (Int, Maybe Int)
guiListView Rectangle
bounds String
text Int
scrollIndex Maybe Int
active =
Rectangle
-> (Ptr Rectangle -> IO (Int, Maybe Int)) -> IO (Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
String -> (CString -> IO (Int, Maybe Int)) -> IO (Int, Maybe Int)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
text
( \CString
t ->
CInt -> (Ptr CInt -> IO (Int, Maybe Int)) -> IO (Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
scrollIndex)
( \Ptr CInt
s ->
CInt -> (Ptr CInt -> IO (Int, Maybe Int)) -> IO (Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe (-Int
1) Maybe Int
active))
( \Ptr CInt
a -> do
CInt
_ <- Ptr Rectangle -> CString -> Ptr CInt -> Ptr CInt -> IO CInt
c'guiListView Ptr Rectangle
b CString
t Ptr CInt
s Ptr CInt
a
CInt
scrollIndex' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
s
CInt
active' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a
(Int, Maybe Int) -> IO (Int, Maybe Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
scrollIndex', if CInt
active' CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== (-CInt
1) then Maybe Int
forall a. Maybe a
Nothing else Int -> Maybe Int
forall a. a -> Maybe a
Just (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
active'))
)
)
)
)
guiListViewEx ::
Rectangle ->
[String] ->
Int ->
Maybe Int ->
Maybe Int ->
IO (Int, Maybe Int, Maybe Int)
guiListViewEx :: Rectangle
-> [String]
-> Int
-> Maybe Int
-> Maybe Int
-> IO (Int, Maybe Int, Maybe Int)
guiListViewEx Rectangle
bounds [String]
text Int
scrollIndex Maybe Int
active Maybe Int
focus = do
[CString]
cStrings <- (String -> IO CString) -> [String] -> IO [CString]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM String -> IO CString
newCString [String]
text
Rectangle
-> (Ptr Rectangle -> IO (Int, Maybe Int, Maybe Int))
-> IO (Int, Maybe Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
[CString]
-> (Int -> Ptr CString -> IO (Int, Maybe Int, Maybe Int))
-> IO (Int, Maybe Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
[a] -> (Int -> Ptr a -> IO b) -> IO b
withFreeableArrayLen
[CString]
cStrings
( \Int
c Ptr CString
t ->
CInt
-> (Ptr CInt -> IO (Int, Maybe Int, Maybe Int))
-> IO (Int, Maybe Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
scrollIndex)
( \Ptr CInt
s ->
CInt
-> (Ptr CInt -> IO (Int, Maybe Int, Maybe Int))
-> IO (Int, Maybe Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe (-Int
1) Maybe Int
active))
( \Ptr CInt
a ->
CInt
-> (Ptr CInt -> IO (Int, Maybe Int, Maybe Int))
-> IO (Int, Maybe Int, Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Maybe Int -> Int
forall a. a -> Maybe a -> a
fromMaybe (-Int
1) Maybe Int
focus))
( \Ptr CInt
f -> do
CInt
_ <- Ptr Rectangle
-> Ptr CString
-> CInt
-> Ptr CInt
-> Ptr CInt
-> Ptr CInt
-> IO CInt
c'guiListViewEx Ptr Rectangle
b Ptr CString
t (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
c) Ptr CInt
s Ptr CInt
a Ptr CInt
f
CInt
scrollIndex' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
s
CInt
active' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
a
CInt
focus' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
f
(Int, Maybe Int, Maybe Int) -> IO (Int, Maybe Int, Maybe Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
scrollIndex', if CInt
active' CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== (-CInt
1) then Maybe Int
forall a. Maybe a
Nothing else Int -> Maybe Int
forall a. a -> Maybe a
Just (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
active'), if CInt
focus' CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== (-CInt
1) then Maybe Int
forall a. Maybe a
Nothing else Int -> Maybe Int
forall a. a -> Maybe a
Just (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
focus'))
)
)
)
)
)
guiMessageBox ::
Rectangle ->
Maybe String ->
String ->
String ->
IO (Maybe Int)
guiMessageBox :: Rectangle -> Maybe String -> String -> String -> IO (Maybe Int)
guiMessageBox Rectangle
bounds Maybe String
title String
message String
buttons =
Rectangle -> (Ptr Rectangle -> IO (Maybe Int)) -> IO (Maybe Int)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String -> (CString -> IO (Maybe Int)) -> IO (Maybe Int)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
title
( \CString
t ->
String -> (CString -> IO (Maybe Int)) -> IO (Maybe Int)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
message
( \CString
m ->
String -> (CString -> IO (Maybe Int)) -> IO (Maybe Int)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
buttons
( \CString
bu -> do
CInt
res <- Ptr Rectangle -> CString -> CString -> CString -> IO CInt
c'guiMessageBox Ptr Rectangle
b CString
t CString
m CString
bu
if CInt
res CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== (-CInt
1) then Maybe Int -> IO (Maybe Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Int
forall a. Maybe a
Nothing else Maybe Int -> IO (Maybe Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Maybe Int
forall a. a -> Maybe a
Just (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
res))
)
)
)
)
guiTextInputBox ::
Rectangle ->
Maybe String ->
String ->
String ->
String ->
Maybe Int ->
Maybe Bool ->
IO (Maybe Bool, String, Maybe Int)
guiTextInputBox :: Rectangle
-> Maybe String
-> String
-> String
-> String
-> Maybe Int
-> Maybe Bool
-> IO (Maybe Bool, String, Maybe Int)
guiTextInputBox Rectangle
bounds Maybe String
title String
message String
buttons String
value Maybe Int
bufferSize Maybe Bool
secret = do
((Maybe Int
clicked, Maybe Bool
secret'), String
value') <-
Rectangle
-> (Ptr Rectangle -> IO ((Maybe Int, Maybe Bool), String))
-> IO ((Maybe Int, Maybe Bool), String)
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Maybe String
-> (CString -> IO ((Maybe Int, Maybe Bool), String))
-> IO ((Maybe Int, Maybe Bool), String)
forall b. Maybe String -> (CString -> IO b) -> IO b
withMaybeCString
Maybe String
title
( \CString
t ->
String
-> (CString -> IO ((Maybe Int, Maybe Bool), String))
-> IO ((Maybe Int, Maybe Bool), String)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
message
( \CString
m ->
String
-> (CString -> IO ((Maybe Int, Maybe Bool), String))
-> IO ((Maybe Int, Maybe Bool), String)
forall a. String -> (CString -> IO a) -> IO a
withCString
String
buttons
( \CString
bu ->
String
-> Maybe Int
-> (Int -> CString -> IO (Maybe Int, Maybe Bool))
-> IO ((Maybe Int, Maybe Bool), String)
forall b.
String -> Maybe Int -> (Int -> CString -> IO b) -> IO (b, String)
withCStringBuffer
String
value
Maybe Int
bufferSize
( \Int
s CString
te ->
Maybe CBool
-> (Ptr CBool -> IO (Maybe Int, Maybe Bool))
-> IO (Maybe Int, Maybe Bool)
forall a b. Storable a => Maybe a -> (Ptr a -> IO b) -> IO b
withMaybe
(Bool -> CBool
forall a. Num a => Bool -> a
fromBool (Bool -> CBool) -> Maybe Bool -> Maybe CBool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
secret)
( \Ptr CBool
sec -> do
CInt
clicked <- Ptr Rectangle
-> CString
-> CString
-> CString
-> CString
-> CInt
-> Ptr CBool
-> IO CInt
c'guiTextInputBox Ptr Rectangle
b CString
t CString
m CString
bu CString
te (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
s) Ptr CBool
sec
Maybe Bool
secret' <- if Ptr CBool
sec Ptr CBool -> Ptr CBool -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr CBool
forall a. Ptr a
nullPtr then Maybe Bool -> IO (Maybe Bool)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Bool
forall a. Maybe a
Nothing else Bool -> Maybe Bool
forall a. a -> Maybe a
Just (Bool -> Maybe Bool) -> (CBool -> Bool) -> CBool -> Maybe Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Maybe Bool) -> IO CBool -> IO (Maybe Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CBool -> IO CBool
forall a. Storable a => Ptr a -> IO a
peek Ptr CBool
sec
(Maybe Int, Maybe Bool) -> IO (Maybe Int, Maybe Bool)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (if CInt
clicked CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== (-CInt
1) then Maybe Int
forall a. Maybe a
Nothing else Int -> Maybe Int
forall a. a -> Maybe a
Just (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
clicked), Maybe Bool
secret')
)
)
)
)
)
)
(Maybe Bool, String, Maybe Int)
-> IO (Maybe Bool, String, Maybe Int)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Bool
secret', String
value', Maybe Int
clicked)
guiColorPicker ::
Rectangle ->
Maybe Color ->
IO Color
guiColorPicker :: Rectangle -> Maybe Color -> IO Color
guiColorPicker Rectangle
bounds Maybe Color
color =
Rectangle -> (Ptr Rectangle -> IO Color) -> IO Color
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Color -> (Ptr Color -> IO Color) -> IO Color
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Color -> Maybe Color -> Color
forall a. a -> Maybe a -> a
fromMaybe (Word8 -> Word8 -> Word8 -> Word8 -> Color
Color Word8
200 Word8
0 Word8
0 Word8
255) Maybe Color
color)
( \Ptr Color
c -> Ptr Rectangle -> CString -> Ptr Color -> IO CInt
c'guiColorPicker Ptr Rectangle
b CString
forall a. Ptr a
nullPtr Ptr Color
c IO CInt -> IO Color -> IO Color
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Color -> IO Color
forall a. Storable a => Ptr a -> IO a
peek Ptr Color
c
)
)
guiColorPanel ::
Rectangle ->
Maybe Color ->
IO Color
guiColorPanel :: Rectangle -> Maybe Color -> IO Color
guiColorPanel Rectangle
bounds Maybe Color
color =
Rectangle -> (Ptr Rectangle -> IO Color) -> IO Color
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Color -> (Ptr Color -> IO Color) -> IO Color
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Color -> Maybe Color -> Color
forall a. a -> Maybe a -> a
fromMaybe (Word8 -> Word8 -> Word8 -> Word8 -> Color
Color Word8
200 Word8
0 Word8
0 Word8
255) Maybe Color
color)
( \Ptr Color
c -> Ptr Rectangle -> CString -> Ptr Color -> IO CInt
c'guiColorPanel Ptr Rectangle
b CString
forall a. Ptr a
nullPtr Ptr Color
c IO CInt -> IO Color -> IO Color
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Color -> IO Color
forall a. Storable a => Ptr a -> IO a
peek Ptr Color
c
)
)
guiColorBarAlpha ::
Rectangle ->
Float ->
IO Float
guiColorBarAlpha :: Rectangle -> Float -> IO Float
guiColorBarAlpha Rectangle
bounds Float
alpha =
CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac
(CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CFloat) -> IO CFloat
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
CFloat -> (Ptr CFloat -> IO CFloat) -> IO CFloat
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
alpha)
( \Ptr CFloat
a -> Ptr Rectangle -> CString -> Ptr CFloat -> IO CInt
c'guiColorBarAlpha Ptr Rectangle
b CString
forall a. Ptr a
nullPtr Ptr CFloat
a IO CInt -> IO CFloat -> IO CFloat
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
a
)
)
guiColorBarHue ::
Rectangle ->
Float ->
IO Float
guiColorBarHue :: Rectangle -> Float -> IO Float
guiColorBarHue Rectangle
bounds Float
hue =
CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac
(CFloat -> Float) -> IO CFloat -> IO Float
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Rectangle -> (Ptr Rectangle -> IO CFloat) -> IO CFloat
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
CFloat -> (Ptr CFloat -> IO CFloat) -> IO CFloat
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
hue)
( \Ptr CFloat
h -> Ptr Rectangle -> CString -> Ptr CFloat -> IO CInt
c'guiColorBarHue Ptr Rectangle
b CString
forall a. Ptr a
nullPtr Ptr CFloat
h IO CInt -> IO CFloat -> IO CFloat
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
h
)
)
guiColorPickerHSV ::
Rectangle ->
Maybe Vector3 ->
IO Vector3
guiColorPickerHSV :: Rectangle -> Maybe Vector3 -> IO Vector3
guiColorPickerHSV Rectangle
bounds Maybe Vector3
color =
Rectangle -> (Ptr Rectangle -> IO Vector3) -> IO Vector3
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Vector3 -> (Ptr Vector3 -> IO Vector3) -> IO Vector3
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Vector3 -> Maybe Vector3 -> Vector3
forall a. a -> Maybe a -> a
fromMaybe (Float -> Float -> Float -> Vector3
Vector3 (Float
200.0 Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
255.0) Float
0 Float
0) Maybe Vector3
color)
( \Ptr Vector3
c -> Ptr Rectangle -> CString -> Ptr Vector3 -> IO CInt
c'guiColorPickerHSV Ptr Rectangle
b CString
forall a. Ptr a
nullPtr Ptr Vector3
c IO CInt -> IO Vector3 -> IO Vector3
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Vector3 -> IO Vector3
forall a. Storable a => Ptr a -> IO a
peek Ptr Vector3
c
)
)
guiColorPanelHSV ::
Rectangle ->
Maybe Vector3 ->
IO Vector3
guiColorPanelHSV :: Rectangle -> Maybe Vector3 -> IO Vector3
guiColorPanelHSV Rectangle
bounds Maybe Vector3
color =
Rectangle -> (Ptr Rectangle -> IO Vector3) -> IO Vector3
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
Rectangle
bounds
( \Ptr Rectangle
b ->
Vector3 -> (Ptr Vector3 -> IO Vector3) -> IO Vector3
forall a b.
(Freeable a, Storable a) =>
a -> (Ptr a -> IO b) -> IO b
withFreeable
(Vector3 -> Maybe Vector3 -> Vector3
forall a. a -> Maybe a -> a
fromMaybe (Float -> Float -> Float -> Vector3
Vector3 (Float
200.0 Float -> Float -> Float
forall a. Fractional a => a -> a -> a
/ Float
255.0) Float
0 Float
0) Maybe Vector3
color)
( \Ptr Vector3
c -> Ptr Rectangle -> CString -> Ptr Vector3 -> IO CInt
c'guiColorPanelHSV Ptr Rectangle
b CString
forall a. Ptr a
nullPtr Ptr Vector3
c IO CInt -> IO Vector3 -> IO Vector3
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Ptr Vector3 -> IO Vector3
forall a. Storable a => Ptr a -> IO a
peek Ptr Vector3
c
)
)