dear-imgui-raw-1.0.0: src/DearImGui/Raw/ImDrawCmdHeader.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.ImDrawCmdHeader
( ImDrawCmdHeader (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import DearImGui.Raw.ImTextureRef (ImTextureRef)
import DearImGui.Raw.ImVec4 (ImVec4)
import Foreign.C.Types
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.h"
-- structs (opaque)
data {-# CTYPE "dcimgui_nodefaultargfunctions.h" "ImDrawCmdHeader" #-} ImDrawCmdHeader = ImDrawCmdHeader
{ clipRect :: ImVec4
, texRef :: ImTextureRef
, vtxOffset :: CUInt
}
deriving (Eq, Show)
instance Storable ImDrawCmdHeader where
sizeOf _ = #{size ImDrawCmdHeader}
alignment _ = #{alignment ImDrawCmdHeader}
peek p = ImDrawCmdHeader <$> #{peek ImDrawCmdHeader, ClipRect} p <*> #{peek ImDrawCmdHeader, TexRef} p <*> #{peek ImDrawCmdHeader, VtxOffset} p
poke p v = do
#{poke ImDrawCmdHeader, ClipRect} p v.clipRect
#{poke ImDrawCmdHeader, TexRef} p v.texRef
#{poke ImDrawCmdHeader, VtxOffset} p v.vtxOffset
instance HasField "clipRect" (Ptr ImDrawCmdHeader) (Ptr ImVec4) where
getField = #{ptr ImDrawCmdHeader, ClipRect}
instance HasField "texRef" (Ptr ImDrawCmdHeader) (Ptr ImTextureRef) where
getField = #{ptr ImDrawCmdHeader, TexRef}
instance HasField "vtxOffset" (Ptr ImDrawCmdHeader) (Ptr CUInt) where
getField = #{ptr ImDrawCmdHeader, VtxOffset}
foreign import capi unsafe "DearImGuiWrappers.h ImDrawCmdHeader_Init_wrap"
init
:: Ptr ImDrawCmdHeader
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImDrawCmdHeader_Destroy_wrap"
destroy
:: Ptr ImDrawCmdHeader
-> IO ()
withDefault :: (Ptr ImDrawCmdHeader -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)