dear-imgui-raw-internal-1.0.0: src/DearImGui/Raw/Internal/ImGuiColorMod.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.Internal.ImGuiColorMod
( ImGuiColorMod (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import DearImGui.Raw.Enums.ImGuiCol (ImGuiCol)
import DearImGui.Raw.ImVec4 (ImVec4)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr, plusPtr)
import Foreign.Storable (Storable (..))
import GHC.Records (HasField (..))
import Prelude hiding (init)
#include "dcimgui_nodefaultargfunctions_internal.h"
-- structs (opaque)
data {-# CTYPE "dcimgui_nodefaultargfunctions_internal.h" "ImGuiColorMod" #-} ImGuiColorMod = ImGuiColorMod
{ col :: ImGuiCol
, backupValue :: ImVec4
}
deriving (Eq, Show)
instance Storable ImGuiColorMod where
sizeOf _ = #{size ImGuiColorMod}
alignment _ = #{alignment ImGuiColorMod}
peek p = ImGuiColorMod <$> #{peek ImGuiColorMod, Col} p <*> #{peek ImGuiColorMod, BackupValue} p
poke p v = do
#{poke ImGuiColorMod, Col} p v.col
#{poke ImGuiColorMod, BackupValue} p v.backupValue
instance HasField "col" (Ptr ImGuiColorMod) (Ptr ImGuiCol) where
getField = #{ptr ImGuiColorMod, Col}
instance HasField "backupValue" (Ptr ImGuiColorMod) (Ptr ImVec4) where
getField = #{ptr ImGuiColorMod, BackupValue}
foreign import capi unsafe "DearImGuiWrappers.h ImGuiColorMod_Init_wrap"
init
:: Ptr ImGuiColorMod
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImGuiColorMod_Destroy_wrap"
destroy
:: Ptr ImGuiColorMod
-> IO ()
withDefault :: (Ptr ImGuiColorMod -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)