dear-imgui-raw-1.0.0: src/DearImGui/Raw/ImGuiPlatformMonitor.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.ImGuiPlatformMonitor
( ImGuiPlatformMonitor (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import DearImGui.Raw.ImVec2 (ImVec2)
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" "ImGuiPlatformMonitor" #-} ImGuiPlatformMonitor = ImGuiPlatformMonitor
{ mainPos :: ImVec2
, mainSize :: ImVec2
, workPos :: ImVec2
, workSize :: ImVec2
, dpiScale :: Float
, platformHandle :: Ptr ()
}
deriving (Eq, Show)
instance Storable ImGuiPlatformMonitor where
sizeOf _ = #{size ImGuiPlatformMonitor}
alignment _ = #{alignment ImGuiPlatformMonitor}
peek p = ImGuiPlatformMonitor <$> #{peek ImGuiPlatformMonitor, MainPos} p <*> #{peek ImGuiPlatformMonitor, MainSize} p <*> #{peek ImGuiPlatformMonitor, WorkPos} p <*> #{peek ImGuiPlatformMonitor, WorkSize} p <*> #{peek ImGuiPlatformMonitor, DpiScale} p <*> #{peek ImGuiPlatformMonitor, PlatformHandle} p
poke p v = do
#{poke ImGuiPlatformMonitor, MainPos} p v.mainPos
#{poke ImGuiPlatformMonitor, MainSize} p v.mainSize
#{poke ImGuiPlatformMonitor, WorkPos} p v.workPos
#{poke ImGuiPlatformMonitor, WorkSize} p v.workSize
#{poke ImGuiPlatformMonitor, DpiScale} p v.dpiScale
#{poke ImGuiPlatformMonitor, PlatformHandle} p v.platformHandle
instance HasField "mainPos" (Ptr ImGuiPlatformMonitor) (Ptr ImVec2) where
getField = #{ptr ImGuiPlatformMonitor, MainPos}
instance HasField "mainSize" (Ptr ImGuiPlatformMonitor) (Ptr ImVec2) where
getField = #{ptr ImGuiPlatformMonitor, MainSize}
instance HasField "workPos" (Ptr ImGuiPlatformMonitor) (Ptr ImVec2) where
getField = #{ptr ImGuiPlatformMonitor, WorkPos}
instance HasField "workSize" (Ptr ImGuiPlatformMonitor) (Ptr ImVec2) where
getField = #{ptr ImGuiPlatformMonitor, WorkSize}
instance HasField "dpiScale" (Ptr ImGuiPlatformMonitor) (Ptr Float) where
getField = #{ptr ImGuiPlatformMonitor, DpiScale}
instance HasField "platformHandle" (Ptr ImGuiPlatformMonitor) (Ptr (Ptr ())) where
getField = #{ptr ImGuiPlatformMonitor, PlatformHandle}
foreign import capi unsafe "DearImGuiWrappers.h ImGuiPlatformMonitor_Init_wrap"
init
:: Ptr ImGuiPlatformMonitor
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImGuiPlatformMonitor_Destroy_wrap"
destroy
:: Ptr ImGuiPlatformMonitor
-> IO ()
withDefault :: (Ptr ImGuiPlatformMonitor -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)