module SFML.Window.ContextSettings
(
ContextSettings(..)
)
where
import Foreign.C.Types
import Foreign.Storable
sizeInt = (4)
data ContextSettings = ContextSettings
{ depthBits :: Int
, stencilBits :: Int
, antialiasingLevel :: Int
, majorVersion :: Int
, minorVersion :: Int
}
deriving (Show)
instance Storable ContextSettings where
sizeOf _ = 5*sizeInt
alignment _ = alignment (undefined :: CUInt)
peek ptr = do
db <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr :: IO CInt
sb <- (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr :: IO CInt
al <- (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr :: IO CInt
ma <- (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr :: IO CInt
mi <- (\hsc_ptr -> peekByteOff hsc_ptr 16) ptr :: IO CInt
return $ ContextSettings (fromIntegral db) (fromIntegral sb) (fromIntegral al)
(fromIntegral ma) (fromIntegral mi)
poke ptr (ContextSettings db sb al ma mi) = do
(\hsc_ptr -> pokeByteOff hsc_ptr 0) ptr (fromIntegral db :: CInt)
(\hsc_ptr -> pokeByteOff hsc_ptr 4) ptr (fromIntegral sb :: CInt)
(\hsc_ptr -> pokeByteOff hsc_ptr 8) ptr (fromIntegral al :: CInt)
(\hsc_ptr -> pokeByteOff hsc_ptr 12) ptr (fromIntegral ma :: CInt)
(\hsc_ptr -> pokeByteOff hsc_ptr 16) ptr (fromIntegral mi :: CInt)