dear-imgui-raw-1.0.0: src/DearImGui/Raw/ImTextureRect.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.ImTextureRect
( ImTextureRect (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
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" "ImTextureRect" #-} ImTextureRect = ImTextureRect
{ x :: CUShort
, y :: CUShort
, w :: CUShort
, h :: CUShort
}
deriving (Eq, Show)
instance Storable ImTextureRect where
sizeOf _ = #{size ImTextureRect}
alignment _ = #{alignment ImTextureRect}
peek p = ImTextureRect <$> #{peek ImTextureRect, x} p <*> #{peek ImTextureRect, y} p <*> #{peek ImTextureRect, w} p <*> #{peek ImTextureRect, h} p
poke p v = do
#{poke ImTextureRect, x} p v.x
#{poke ImTextureRect, y} p v.y
#{poke ImTextureRect, w} p v.w
#{poke ImTextureRect, h} p v.h
instance HasField "x" (Ptr ImTextureRect) (Ptr CUShort) where
getField = #{ptr ImTextureRect, x}
instance HasField "y" (Ptr ImTextureRect) (Ptr CUShort) where
getField = #{ptr ImTextureRect, y}
instance HasField "w" (Ptr ImTextureRect) (Ptr CUShort) where
getField = #{ptr ImTextureRect, w}
instance HasField "h" (Ptr ImTextureRect) (Ptr CUShort) where
getField = #{ptr ImTextureRect, h}
foreign import capi unsafe "DearImGuiWrappers.h ImTextureRect_Init_wrap"
init
:: Ptr ImTextureRect
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImTextureRect_Destroy_wrap"
destroy
:: Ptr ImTextureRect
-> IO ()
withDefault :: (Ptr ImTextureRect -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)