module Graphics.UI.SDL.Types (
AudioCallback,
AudioDeviceID,
AudioFormat,
Cond,
Cursor,
EventFilter,
FingerID,
GameController,
GestureID,
GLContext,
Haptic,
HintCallback,
Joystick,
JoystickID,
LogOutputFunction,
Mutex,
Renderer,
Sem,
SpinLock,
SysWMinfo,
SysWMmsg,
Texture,
Thread,
ThreadFunction,
ThreadID,
TimerCallback,
TimerID,
TLSID,
TouchID,
Window,
Atomic(..),
AudioCVT(..),
AudioSpec(..),
Color(..),
DisplayMode(..),
Event(..),
Finger(..),
GameControllerButtonBind(..),
HapticDirection(..),
HapticEffect(..),
JoystickGUID(..),
Keysym(..),
MessageBoxButtonData(..),
MessageBoxColor(..),
MessageBoxColorScheme(..),
MessageBoxData(..),
Palette(..),
PixelFormat(..),
Point(..),
Rect(..),
RendererInfo(..),
RWops(..),
Surface(..),
Version(..)
) where
import Data.Int
import Data.Word
import Foreign.C.String
import Foreign.C.Types
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable
import Graphics.UI.SDL.Enum
type AudioCallback = FunPtr (Ptr () -> Ptr Word8 -> CInt -> IO ())
type AudioDeviceID = Word32
type AudioFormat = Word16
type Cond = Ptr ()
type Cursor = Ptr ()
type EventFilter = FunPtr (Ptr () -> Ptr Event -> IO CInt)
type FingerID = Int64
type GameController = Ptr ()
type GestureID = Int64
type GLContext = Ptr ()
type Haptic = Ptr ()
type HintCallback = FunPtr (Ptr () -> CString -> CString -> CString -> IO ())
type Joystick = Ptr ()
type JoystickID = Int32
type LogOutputFunction = FunPtr (Ptr () -> CInt -> LogPriority -> CString -> IO ())
type Mutex = Ptr ()
type Renderer = Ptr ()
type Sem = Ptr ()
type SpinLock = CInt
type SysWMinfo = Ptr ()
type SysWMmsg = Ptr ()
type Texture = Ptr ()
type Thread = Ptr ()
type ThreadFunction = FunPtr (Ptr () -> IO CInt)
type ThreadID = CULong
type TimerCallback = FunPtr (Word32 -> Ptr () -> IO Word32)
type TimerID = CInt
type TLSID = CUInt
type TouchID = Int64
type Window = Ptr ()
data Atomic = Atomic {
atomicValue :: CInt
} deriving (Eq, Show)
instance Storable Atomic where
sizeOf _ = ((4))
alignment = sizeOf
peek ptr = do
value <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
return $! Atomic value
poke ptr (Atomic value) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr value
data AudioCVT = AudioCVT {
audioCVTNeeded :: CInt
, audioCVTSrcFormat :: AudioFormat
, audioCVTDstFormat :: AudioFormat
, audioCVTRateIncr :: CDouble
, audioCVTBuf :: Ptr Word8
, audioCVTLen :: CInt
, audioCVTLenCvt :: CInt
, audioCVTLenMult :: CInt
, audioCVTLenRatio :: CDouble
} deriving (Eq, Show)
instance Storable AudioCVT where
sizeOf _ = ((128))
alignment = sizeOf
peek ptr = do
needed <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
src_format <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
dst_format <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
rate_incr <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
buf <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
len_cvt <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
len_mult <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
len_ratio <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
return $! AudioCVT needed src_format dst_format rate_incr buf len len_cvt len_mult len_ratio
poke ptr (AudioCVT needed src_format dst_format rate_incr buf len len_cvt len_mult len_ratio) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr needed
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr src_format
((\hsc_ptr -> pokeByteOff hsc_ptr 6)) ptr dst_format
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr rate_incr
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr buf
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr len_cvt
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr len_mult
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr len_ratio
data AudioSpec = AudioSpec {
audioSpecFreq :: CInt
, audioSpecFormat :: AudioFormat
, audioSpecChannels :: Word8
, audioSpecSilence :: Word8
, audioSpecSamples :: Word16
, audioSpecSize :: Word32
, audioSpecCallback :: AudioCallback
, audioSpecUserdata :: Ptr ()
} deriving (Eq, Show)
instance Storable AudioSpec where
sizeOf _ = ((32))
alignment = sizeOf
peek ptr = do
freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
format <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
channels <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
silence <- ((\hsc_ptr -> peekByteOff hsc_ptr 7)) ptr
samples <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
size <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
callback <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
userdata <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
return $! AudioSpec freq format channels silence samples size callback userdata
poke ptr (AudioSpec freq format channels silence samples size callback userdata) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr freq
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr format
((\hsc_ptr -> pokeByteOff hsc_ptr 6)) ptr channels
((\hsc_ptr -> pokeByteOff hsc_ptr 7)) ptr silence
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr samples
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr size
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr callback
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr userdata
data Color = Color {
colorR :: Word8
, colorG :: Word8
, colorB :: Word8
, colorA :: Word8
} deriving (Eq, Show)
instance Storable Color where
sizeOf _ = ((4))
alignment = sizeOf
peek ptr = do
r <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
g <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
b <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
a <- ((\hsc_ptr -> peekByteOff hsc_ptr 3)) ptr
return $! Color r g b a
poke ptr (Color r g b a) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr r
((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr g
((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr b
((\hsc_ptr -> pokeByteOff hsc_ptr 3)) ptr a
data DisplayMode = DisplayMode {
displayModeFormat :: Word32
, displayModeW :: CInt
, displayModeH :: CInt
, displayModeRefreshRate :: CInt
, displayModeDriverData :: Ptr ()
} deriving (Eq, Show)
instance Storable DisplayMode where
sizeOf _ = ((24))
alignment = sizeOf
peek ptr = do
format <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
w <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
h <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
refresh_rate <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
driverdata <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
return $! DisplayMode format w h refresh_rate driverdata
poke ptr (DisplayMode format w h refresh_rate driverdata) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr format
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr w
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr h
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr refresh_rate
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr driverdata
data Event = WindowEvent {
eventType :: Word32
, eventTimestamp :: Word32
, windowEventWindowID :: Word32
, windowEventEvent :: Word8
, windowEventData1 :: Int32
, windowEventData2 :: Int32
}
| KeyboardEvent {
eventType :: Word32
, eventTimestamp :: Word32
, keyboardEventWindowID :: Word32
, keyboardEventState :: Word8
, keyboardEventRepeat :: Word8
, keyboardEventKeysym :: Keysym
}
| TextEditingEvent {
eventType :: Word32
, eventTimestamp :: Word32
, textEditingEventWindowID :: Word32
, textEditingEventText :: [CChar]
, textEditingEventStart :: Int32
, textEditingEventLength :: Int32
}
| TextInputEvent {
eventType :: Word32
, eventTimestamp :: Word32
, textInputEventWindowID :: Word32
, textInputEventText :: [CChar]
}
| MouseMotionEvent {
eventType :: Word32
, eventTimestamp :: Word32
, mouseMotionEventWindowID :: Word32
, mouseMotionEventWhich :: Word32
, mouseMotionEventState :: Word32
, mouseMotionEventX :: Int32
, mouseMotionEventY :: Int32
, mouseMotionEventXRel :: Int32
, mouseMotionEventYRel :: Int32
}
| MouseButtonEvent {
eventType :: Word32
, eventTimestamp :: Word32
, mouseButtonEventWindowID :: Word32
, mouseButtonEventWhich :: Word32
, mouseButtonEventButton :: Word8
, mouseButtonEventState :: Word8
, mouseButtonEventClicks :: Word8
, mouseButtonEventX :: Int32
, mouseButtonEventY :: Int32
}
| MouseWheelEvent {
eventType :: Word32
, eventTimestamp :: Word32
, mouseWheelEventWindowID :: Word32
, mouseWheelEventWhich :: Word32
, mouseWheelEventX :: Int32
, mouseWheelEventY :: Int32
}
| JoyAxisEvent {
eventType :: Word32
, eventTimestamp :: Word32
, joyAxisEventWhich :: JoystickID
, joyAxisEventAxis :: Word8
, joyAxisEventValue :: Int16
}
| JoyBallEvent {
eventType :: Word32
, eventTimestamp :: Word32
, joyBallEventWhich :: JoystickID
, joyBallEventBall :: Word8
, joyBallEventXRel :: Int16
, joyBallEventYRel :: Int16
}
| JoyHatEvent {
eventType :: Word32
, eventTimestamp :: Word32
, joyHatEventWhich :: JoystickID
, joyHatEventHat :: Word8
, joyHatEventValue :: Word8
}
| JoyButtonEvent {
eventType :: Word32
, eventTimestamp :: Word32
, joyButtonEventWhich :: JoystickID
, joyButtonEventButton :: Word8
, joyButtonEventState :: Word8
}
| JoyDeviceEvent{
eventType :: Word32
, eventTimestamp :: Word32
, joyDeviceEventWhich :: Int32
}
| ControllerAxisEvent {
eventType :: Word32
, eventTimestamp :: Word32
, controllerAxisEventWhich :: JoystickID
, controllerAxisEventAxis :: Word8
, controllerAxisEventValue :: Int16
}
| ControllerButtonEvent {
eventType :: Word32
, eventTimestamp :: Word32
, controllerButtonEventWhich :: JoystickID
, controllerButtonEventButton :: Word8
, controllerButtonEventState :: Word8
}
| ControllerDeviceEvent {
eventType :: Word32
, eventTimestamp :: Word32
, controllerDeviceEventWhich :: Int32
}
| QuitEvent {
eventType :: Word32
, eventTimestamp :: Word32
}
| UserEvent {
eventType :: Word32
, eventTimestamp :: Word32
, userEventWindowID :: Word32
, userEventCode :: Int32
, userEventData1 :: Ptr ()
, userEventData2 :: Ptr ()
}
| SysWMEvent {
eventType :: Word32
, eventTimestamp :: Word32
, sysWMEventMsg :: SysWMmsg
}
| TouchFingerEvent {
eventType :: Word32
, eventTimestamp :: Word32
, touchFingerEventTouchID :: TouchID
, touchFingerEventFingerID :: FingerID
, touchFingerEventX :: CFloat
, touchFingerEventY :: CFloat
, touchFingerEventDX :: CFloat
, touchFingerEventDY :: CFloat
, touchFingerEventPressure :: CFloat
}
| MultiGestureEvent {
eventType :: Word32
, eventTimestamp :: Word32
, multiGestureEventTouchID :: TouchID
, multiGestureEventDTheta :: CFloat
, multiGestureEventDDist :: CFloat
, multiGestureEventX :: CFloat
, multiGestureEventY :: CFloat
, multiGestureEventNumFingers :: Word16
}
| DollarGestureEvent {
eventType :: Word32
, eventTimestamp :: Word32
, dollarGestureEventTouchID :: TouchID
, dollarGestureEventGestureID :: GestureID
, dollarGestureEventNumFingers :: Word32
, dollarGestureEventError :: CFloat
, dollarGestureEventX :: CFloat
, dollarGestureEventY :: CFloat
}
| DropEvent {
eventType :: Word32
, eventTimestamp :: Word32
, dropEventFile :: CString
}
| ClipboardUpdateEvent {
eventType :: Word32
, eventTimestamp :: Word32
}
| UnknownEvent {
eventType :: Word32
, eventTimestamp :: Word32
}
deriving (Eq, Show)
instance Storable Event where
sizeOf _ = ((56))
alignment = sizeOf
peek ptr = do
typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
timestamp <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
case typ of
(256) ->
return $! QuitEvent typ timestamp
(512) -> do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
event <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
data1 <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
data2 <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
return $! WindowEvent typ timestamp wid event data1 data2
(513) -> do
msg <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! SysWMEvent typ timestamp msg
(768) -> key $ KeyboardEvent typ timestamp
(769) -> key $ KeyboardEvent typ timestamp
(770) -> do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
text <- peekArray (32) $ ((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr
start <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) ptr
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
return $! TextEditingEvent typ timestamp wid text start len
(771) -> do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
text <- peekArray (32) $ ((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr
return $! TextInputEvent typ timestamp wid text
(1024) -> do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
state <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
xrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
yrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
return $! MouseMotionEvent typ timestamp wid which state x y xrel yrel
(1025) -> mouse $ MouseButtonEvent typ timestamp
(1026) -> mouse $ MouseButtonEvent typ timestamp
(1027) -> do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
return $! MouseWheelEvent typ timestamp wid which x y
(1536) -> do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
axis <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
value <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
return $! JoyAxisEvent typ timestamp which axis value
(1537) -> do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
ball <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
xrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
yrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 18)) ptr
return $! JoyBallEvent typ timestamp which ball xrel yrel
(1538) -> do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
hat <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
value <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
return $! JoyHatEvent typ timestamp which hat value
(1539) -> joybutton $ JoyButtonEvent typ timestamp
(1540) -> joybutton $ JoyButtonEvent typ timestamp
(1541) -> joydevice $ JoyDeviceEvent typ timestamp
(1542) -> joydevice $ JoyDeviceEvent typ timestamp
(1616) -> do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
axis <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
value <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
return $! ControllerButtonEvent typ timestamp which axis value
(1617) -> controllerbutton $ ControllerButtonEvent typ timestamp
(1618) -> controllerbutton $ ControllerButtonEvent typ timestamp
(1619) -> controllerdevice $ ControllerDeviceEvent typ timestamp
(1620) -> controllerdevice $ ControllerDeviceEvent typ timestamp
(1621) -> controllerdevice $ ControllerDeviceEvent typ timestamp
(1792) -> finger $ TouchFingerEvent typ timestamp
(1793) -> finger $ TouchFingerEvent typ timestamp
(1794) -> finger $ TouchFingerEvent typ timestamp
(2048) -> dollargesture $ DollarGestureEvent typ timestamp
(2049) -> dollargesture $ DollarGestureEvent typ timestamp
(2050) -> do
touchId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
dTheta <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
dDist <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
numFingers <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
return $! MultiGestureEvent typ timestamp touchId dTheta dDist x y numFingers
(2304) ->
return $! ClipboardUpdateEvent typ timestamp
(4096) -> do
file <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! DropEvent typ timestamp file
x | x >= (32768) -> do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
code <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
data1 <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
data2 <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
return $! UserEvent typ timestamp wid code data1 data2
_ -> return $! UnknownEvent typ timestamp
where
key f = do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
state <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
repeat' <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
keysym <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
return $! f wid state repeat' keysym
mouse f = do
wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
state <- ((\hsc_ptr -> peekByteOff hsc_ptr 17)) ptr
clicks <- ((\hsc_ptr -> peekByteOff hsc_ptr 18)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
return $! f wid which button state clicks x y
joybutton f = do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
state <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
return $! f which button state
joydevice f = do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! f which
controllerbutton f = do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
state <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
return $! f which button state
controllerdevice f = do
which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! f which
finger f = do
touchId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
fingerId <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
dx <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
dy <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
pressure <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
return $! f touchId fingerId x y dx dy pressure
dollargesture f = do
touchId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
gestureId <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
numFingers <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
err <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
return $! f touchId gestureId numFingers err x y
poke ptr ev = case ev of
WindowEvent typ timestamp wid event data1 data2 -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr event
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr data1
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr data2
KeyboardEvent typ timestamp wid state repeat' keysym -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr state
((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr repeat'
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr keysym
TextEditingEvent typ timestamp wid text start len -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr) text
((\hsc_ptr -> pokeByteOff hsc_ptr 44)) ptr start
((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr len
TextInputEvent typ timestamp wid text -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr) text
MouseMotionEvent typ timestamp wid which state x y xrel yrel -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr state
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr y
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr xrel
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr yrel
MouseButtonEvent typ timestamp wid which button state clicks x y -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 17)) ptr state
((\hsc_ptr -> pokeByteOff hsc_ptr 18)) ptr clicks
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr y
MouseWheelEvent typ timestamp wid which x y -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr y
JoyAxisEvent typ timestamp which axis value -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr axis
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr value
JoyBallEvent typ timestamp which ball xrel yrel -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr ball
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr xrel
((\hsc_ptr -> pokeByteOff hsc_ptr 18)) ptr yrel
JoyHatEvent typ timestamp which hat value -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr hat
((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr value
JoyButtonEvent typ timestamp which button state -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr state
JoyDeviceEvent typ timestamp which -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
ControllerAxisEvent typ timestamp which axis value -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr axis
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr value
ControllerButtonEvent typ timestamp which button state -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr state
ControllerDeviceEvent typ timestamp which -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
QuitEvent typ timestamp -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
UserEvent typ timestamp wid code data1 data2 -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr code
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr data1
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr data2
SysWMEvent typ timestamp msg -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr msg
TouchFingerEvent typ timestamp touchid fingerid x y dx dy pressure -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr touchid
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr fingerid
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr y
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr dx
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr dy
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr pressure
MultiGestureEvent typ timestamp touchid dtheta ddist x y numfingers -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr touchid
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr dtheta
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr ddist
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr y
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr numfingers
DollarGestureEvent typ timestamp touchid gestureid numfingers err x y -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr touchid
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr gestureid
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr numfingers
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr err
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr y
ClipboardUpdateEvent typ timestamp -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
DropEvent typ timestamp file -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr file
UnknownEvent typ timestamp -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
data Finger = Finger {
fingerID :: FingerID
, fingerX :: CFloat
, fingerY :: CFloat
, fingerPressure :: CFloat
} deriving (Eq, Show)
instance Storable Finger where
sizeOf _ = ((24))
alignment = sizeOf
peek ptr = do
fingerId <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
pressure <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
return $! Finger fingerId x y pressure
poke ptr (Finger fingerId x y pressure) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr fingerId
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr y
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr pressure
data GameControllerButtonBind = GameControllerButtonBindNone
| GameControllerButtonBindButton {
gameControllerButtonBindButton :: CInt
}
| GameControllerButtonBindAxis {
gameControllerButtonBindAxis :: CInt
}
| GameControllerButtonBindHat {
gameControllerButtonBindHat :: CInt
, gameControllerButtonBindHatMask :: CInt
} deriving (Eq, Show)
instance Storable GameControllerButtonBind where
sizeOf _ = ((12))
alignment = sizeOf
peek ptr = do
bind_type <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
case bind_type :: (Word32) of
(0) -> do
return $! GameControllerButtonBindNone
(1) -> do
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
return $! GameControllerButtonBindButton button
(2) -> do
axis <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
return $! GameControllerButtonBindAxis axis
(3) -> do
hat <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
hat_mask <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! GameControllerButtonBindHat hat hat_mask
_ -> error $ "Unknown type " ++ show bind_type ++ " for SDL_GameControllerButtonBind"
poke ptr bind = case bind of
GameControllerButtonBindNone -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((0) :: (Word32))
GameControllerButtonBindButton button -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((1) :: (Word32))
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr button
GameControllerButtonBindAxis axis -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((2) :: (Word32))
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr axis
GameControllerButtonBindHat hat hat_mask -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((3) :: (Word32))
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr hat
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr hat_mask
data HapticDirection = HapticDirection {
hapticDirectionType :: Word8
, hapticDirectionX :: Int32
, hapticDirectionY :: Int32
, hapticDirectionZ :: Int32
} deriving (Eq, Show)
instance Storable HapticDirection where
sizeOf _ = ((16))
alignment = sizeOf
peek ptr = do
typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
z <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
return $! HapticDirection typ x y z
poke ptr (HapticDirection typ x y z) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr y
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr z
data HapticEffect = HapticConstant {
hapticEffectType :: Word16
, hapticConstantDirection :: HapticDirection
, hapticConstantLength :: Word32
, hapticConstantDelay :: Word16
, hapticConstantButton :: Word16
, hapticConstantInterval :: Word16
, hapticConstantLevel :: Int16
, hapticConstantAttackLength :: Word16
, hapticConstantAttackLevel :: Word16
, hapticConstantFadeLength :: Word16
, hapticConstantFadeLevel :: Word16
}
| HapticPeriodic {
hapticEffectType :: Word16
, hapticPeriodicDirection :: HapticDirection
, hapticPeriodicLength :: Word32
, hapticPeriodicDelay :: Word16
, hapticPeriodicButton :: Word16
, hapticPeriodicInterval :: Word16
, hapticPeriodicPeriod :: Word16
, hapticPeriodicMagnitude :: Int16
, hapticPeriodicOffset :: Int16
, hapticPeriodicPhase :: Word16
, hapticPeriodicAttackLength :: Word16
, hapticPeriodicAttackLevel :: Word16
, hapticPeriodicFadeLength :: Word16
, hapticPeriodicFadeLevel :: Word16
}
| HapticCondition {
hapticEffectType :: Word16
, hapticConditionLength :: Word32
, hapticConditionDelay :: Word16
, hapticConditionButton :: Word16
, hapticConditionInterval :: Word16
, hapticConditionRightSat :: [Word16]
, hapticConditionLeftSat :: [Word16]
, hapticConditionRightCoeff :: [Int16]
, hapticConditionLeftCoeff :: [Int16]
, hapticConditionDeadband :: [Word16]
, hapticConditionCenter :: [Int16]
}
| HapticRamp {
hapticEffectType :: Word16
, hapticRampDirection :: HapticDirection
, hapticRampLength :: Word32
, hapticRampDelay :: Word16
, hapticRampButton :: Word16
, hapticRampInterval :: Word16
, hapticRampStart :: Int16
, hapticRampEnd :: Int16
, hapticRampAttackLength :: Word16
, hapticRampAttackLevel :: Word16
, hapticRampFadeLength :: Word16
, hapticRampFadeLevel :: Word16
}
| HapticLeftRight {
hapticEffectType :: Word16
, hapticLeftRightLength :: Word32
, hapticLeftRightLargeMagnitude :: Word16
, hapticLeftRightSmallMagnitude :: Word16
}
| HapticCustom {
hapticEffectType :: Word16
, hapticCustomDirection :: HapticDirection
, hapticCustomLength :: Word32
, hapticCustomDelay :: Word16
, hapticCustomButton :: Word16
, hapticCustomInterval :: Word16
, hapticCustomChannels :: Word8
, hapticCustomPeriod :: Word16
, hapticCustomSamples :: Word16
, hapticCustomData :: Ptr Word16
, hapticCustomAttackLength :: Word16
, hapticCustomAttackLevel :: Word16
, hapticCustomFadeLength :: Word16
, hapticCustomFadeLevel :: Word16
} deriving (Eq, Show)
instance Storable HapticEffect where
sizeOf _ = ((72))
alignment = sizeOf
peek ptr = do
typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
case typ of
(1) -> do
direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
level <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 38)) ptr
return $! HapticConstant typ direction len delay button interval level attack_length attack_level fade_length fade_level
(2) -> hapticperiodic $ HapticPeriodic typ
(8) -> hapticperiodic $ HapticPeriodic typ
(16) -> hapticperiodic $ HapticPeriodic typ
(32) -> hapticperiodic $ HapticPeriodic typ
(64) -> do
direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
start <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
end <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 38)) ptr
fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
return $! HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level
(128) -> hapticcondition $ HapticCondition typ
(256) -> hapticcondition $ HapticCondition typ
(512) -> hapticcondition $ HapticCondition typ
(1024) -> hapticcondition $ HapticCondition typ
(4) -> do
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
large_magnitude <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
small_magnitude <- ((\hsc_ptr -> peekByteOff hsc_ptr 10)) ptr
return $! HapticLeftRight typ len large_magnitude small_magnitude
(2048) -> do
direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
channels <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
period <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
samples <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
datum <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 50)) ptr
fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 52)) ptr
fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 54)) ptr
return $! HapticCustom typ direction len delay button interval channels period samples datum attack_length attack_level fade_length fade_level
_ -> error $ "Unknown type " ++ show typ ++ " for SDL_HapticEffect"
where
hapticperiodic f = do
direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
period <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
magnitude <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
offset <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
phase <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 38)) ptr
attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 42)) ptr
fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) ptr
return $! f direction len delay button interval period magnitude offset phase attack_length attack_level fade_length fade_level
hapticcondition f = do
len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
right_sat <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 30)) ptr
left_sat <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 36)) ptr
right_coeff <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 42)) ptr
left_coeff <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 48)) ptr
deadband <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 54)) ptr
center <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 60)) ptr
return $! f len delay button interval right_sat left_sat right_coeff left_coeff deadband center
poke ptr event = case event of
HapticConstant typ direction len delay button interval level attack_length attack_level fade_length fade_level -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr level
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr attack_length
((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr attack_level
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr fade_length
((\hsc_ptr -> pokeByteOff hsc_ptr 38)) ptr fade_level
HapticPeriodic typ direction len delay button interval period magnitude offset phase attack_length attack_level fade_length fade_level -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr period
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr magnitude
((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr offset
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr phase
((\hsc_ptr -> pokeByteOff hsc_ptr 38)) ptr attack_length
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr attack_level
((\hsc_ptr -> pokeByteOff hsc_ptr 42)) ptr fade_length
((\hsc_ptr -> pokeByteOff hsc_ptr 44)) ptr fade_level
HapticCondition typ len delay button interval right_sat left_sat right_coeff left_coeff deadband center -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 30)) ptr) right_sat
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 36)) ptr) left_sat
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 42)) ptr) right_coeff
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 48)) ptr) left_coeff
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 54)) ptr) deadband
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 60)) ptr) center
HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr start
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr end
((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr attack_length
((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr attack_level
((\hsc_ptr -> pokeByteOff hsc_ptr 38)) ptr fade_length
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr fade_level
HapticLeftRight typ len large_magnitude small_magnitude -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr large_magnitude
((\hsc_ptr -> pokeByteOff hsc_ptr 10)) ptr small_magnitude
HapticCustom typ direction len delay button interval channels period samples datum attack_length attack_level fade_length fade_level -> do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr channels
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr period
((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr samples
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr datum
((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr attack_length
((\hsc_ptr -> pokeByteOff hsc_ptr 50)) ptr attack_level
((\hsc_ptr -> pokeByteOff hsc_ptr 52)) ptr fade_length
((\hsc_ptr -> pokeByteOff hsc_ptr 54)) ptr fade_level
data JoystickGUID = JoystickGUID {
joystickGUID :: [Word8]
} deriving (Eq, Show)
instance Storable JoystickGUID where
sizeOf _ = ((16))
alignment = sizeOf
peek ptr = do
guid <- peekArray 16 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 0)) ptr
return $! JoystickGUID guid
poke ptr (JoystickGUID guid) =
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 0)) ptr) guid
data Keysym = Keysym {
keysymScancode :: Scancode
, keysymKeycode :: Keycode
, keysymMod :: Word16
} deriving (Eq, Show)
instance Storable Keysym where
sizeOf _ = ((16))
alignment = sizeOf
peek ptr = do
scancode <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
sym <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
mod' <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! Keysym scancode sym mod'
poke ptr (Keysym scancode sym mod') = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr scancode
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr sym
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr mod'
data MessageBoxButtonData = MessageBoxButtonData {
messageBoxButtonDataFlags :: Word32
, messageBoxButtonButtonID :: CInt
, messageBoxButtonText :: CString
} deriving (Eq, Show)
instance Storable MessageBoxButtonData where
sizeOf _ = ((16))
alignment = sizeOf
peek ptr = do
flags <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
buttonid <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
text <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! MessageBoxButtonData flags buttonid text
poke ptr (MessageBoxButtonData flags buttonid text) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr flags
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr buttonid
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr text
data MessageBoxColor = MessageBoxColor {
messageBoxColorR :: Word8
, messageBoxColorG :: Word8
, messageBoxColorB :: Word8
} deriving (Eq, Show)
instance Storable MessageBoxColor where
sizeOf _ = ((3))
alignment = sizeOf
peek ptr = do
r <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
g <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
b <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
return $! MessageBoxColor r g b
poke ptr (MessageBoxColor r g b) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr r
((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr g
((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr b
data MessageBoxColorScheme = MessageBoxColorScheme {
messageBoxColorSchemeColorBackground :: MessageBoxColor
, messageBoxColorSchemeColorText :: MessageBoxColor
, messageBoxColorSchemeColorButtonBorder :: MessageBoxColor
, messageBoxColorSchemeColorButtonBackground :: MessageBoxColor
, messageBoxColorSchemeColorButtonSelected :: MessageBoxColor
} deriving (Eq, Show)
instance Storable MessageBoxColorScheme where
sizeOf _ = ((15))
alignment = sizeOf
peek ptr = do
background <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
text <- ((\hsc_ptr -> peekByteOff hsc_ptr 3)) ptr
button_border <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
button_background <- ((\hsc_ptr -> peekByteOff hsc_ptr 9)) ptr
button_selected <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
return $! MessageBoxColorScheme background text button_border button_background button_selected
poke ptr (MessageBoxColorScheme background text button_border button_background button_selected) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr background
((\hsc_ptr -> pokeByteOff hsc_ptr 3)) ptr text
((\hsc_ptr -> pokeByteOff hsc_ptr 6)) ptr button_border
((\hsc_ptr -> pokeByteOff hsc_ptr 9)) ptr button_background
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr button_selected
data MessageBoxData = MessageBoxData {
messageBoxDataFlags :: Word32
, messageBoxDataWindow :: Window
, messageBoxDataTitle :: CString
, messageBoxDataMessage :: CString
, messageBoxDataNumButtons :: CInt
, messageBoxDataButtons :: Ptr MessageBoxButtonData
, messageBoxDataColorScheme :: Ptr MessageBoxColorScheme
} deriving (Eq, Show)
instance Storable MessageBoxData where
sizeOf _ = ((56))
alignment = sizeOf
peek ptr = do
flags <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
window <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
title <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
message <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
numbuttons <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
buttons <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
color_scheme <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
return $! MessageBoxData flags window title message numbuttons buttons color_scheme
poke ptr (MessageBoxData flags window title message numbuttons buttons color_scheme) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr flags
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr window
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr title
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr message
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr numbuttons
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr buttons
((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr color_scheme
data Palette = Palette {
paletteNColors :: CInt
, paletteColors :: Ptr Color
} deriving (Eq, Show)
instance Storable Palette where
sizeOf _ = ((24))
alignment = sizeOf
peek ptr = do
ncolors <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
colors <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
return $! Palette ncolors colors
poke ptr (Palette ncolors colors) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ncolors
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr colors
data PixelFormat = PixelFormat {
pixelFormatFormat :: Word32
, pixelFormatPalette :: Ptr Palette
, pixelFormatBitsPerPixel :: Word8
, pixelFormatBytesPerPixel :: Word8
, pixelFormatRMask :: Word32
, pixelFormatGMask :: Word32
, pixelFormatBMask :: Word32
, pixelFormatAMask :: Word32
} deriving (Eq, Show)
instance Storable PixelFormat where
sizeOf _ = ((56))
alignment = sizeOf
peek ptr = do
format <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
palette <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
bits_per_pixel <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
bytes_per_pixel <- ((\hsc_ptr -> peekByteOff hsc_ptr 17)) ptr
rmask <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
gmask <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
bmask <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
amask <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
return $! PixelFormat format palette bits_per_pixel bytes_per_pixel rmask gmask bmask amask
poke ptr (PixelFormat format palette bits_per_pixel bytes_per_pixel rmask gmask bmask amask) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr format
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr palette
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr bits_per_pixel
((\hsc_ptr -> pokeByteOff hsc_ptr 17)) ptr bytes_per_pixel
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr rmask
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr gmask
((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr bmask
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr amask
data Point = Point {
pointX :: CInt
, pointY :: CInt
} deriving (Eq, Show)
instance Storable Point where
sizeOf _ = ((8))
alignment = sizeOf
peek ptr = do
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
return $! Point x y
poke ptr (Point x y) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr y
data Rect = Rect {
rectX :: CInt
, rectY :: CInt
, rectW :: CInt
, rectH :: CInt
} deriving (Eq, Show)
instance Storable Rect where
sizeOf _ = ((16))
alignment = sizeOf
peek ptr = do
x <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
y <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
w <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
h <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
return $! Rect x y w h
poke ptr (Rect x y w h) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr x
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr y
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr w
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr h
data RendererInfo = RendererInfo {
rendererInfoName :: CString
, rendererInfoFlags :: Word32
, rendererInfoNumTextureFormats :: Word32
, rendererInfoTextureFormats :: [Word32]
, rendererInfoMaxTextureWidth :: CInt
, rendererInfoMaxTextureHeight :: CInt
} deriving (Eq, Show)
instance Storable RendererInfo where
sizeOf _ = ((88))
alignment = sizeOf
peek ptr = do
name <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
flags <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
num_texture_formats <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
texture_formats <- peekArray 16 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) ptr
max_texture_width <- ((\hsc_ptr -> peekByteOff hsc_ptr 80)) ptr
max_texture_height <- ((\hsc_ptr -> peekByteOff hsc_ptr 84)) ptr
return $! RendererInfo name flags num_texture_formats texture_formats max_texture_width max_texture_height
poke ptr (RendererInfo name flags num_texture_formats texture_formats max_texture_width max_texture_height) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr name
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr flags
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr num_texture_formats
pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 16)) ptr) texture_formats
((\hsc_ptr -> pokeByteOff hsc_ptr 80)) ptr max_texture_width
((\hsc_ptr -> pokeByteOff hsc_ptr 84)) ptr max_texture_height
data RWops = RWops {
rwopsSize :: FunPtr (Ptr RWops -> IO Int64)
, rwopsSeek :: FunPtr (Ptr RWops -> Int64 -> CInt -> IO Int64)
, rwopsRead :: FunPtr (Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize)
, rwopsWrite :: FunPtr (Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize)
, rwopsClose :: FunPtr (Ptr RWops -> IO CInt)
, rwopsType :: Word32
} deriving (Eq, Show)
instance Storable RWops where
sizeOf _ = ((72))
alignment = sizeOf
peek ptr = do
size <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
seek <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
read' <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
write <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
close <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
return $! RWops size seek read' write close typ
poke ptr (RWops size seek read' write close typ) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr size
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr seek
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr read'
((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr write
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr close
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr typ
data Surface = Surface {
surfaceFormat :: Ptr PixelFormat
, surfaceW :: CInt
, surfaceH :: CInt
, surfacePixels :: Ptr ()
, surfaceUserdata :: Ptr ()
, surfaceClipRect :: Rect
, surfaceRefcount :: CInt
} deriving (Eq, Show)
instance Storable Surface where
sizeOf _ = ((96))
alignment = sizeOf
peek ptr = do
format <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
w <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
h <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
pixels <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
userdata <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
cliprect <- ((\hsc_ptr -> peekByteOff hsc_ptr 64)) ptr
refcount <- ((\hsc_ptr -> peekByteOff hsc_ptr 88)) ptr
return $! Surface format w h pixels userdata cliprect refcount
poke ptr (Surface format w h pixels userdata cliprect refcount) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr format
((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr w
((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr h
((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr pixels
((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr userdata
((\hsc_ptr -> pokeByteOff hsc_ptr 64)) ptr cliprect
((\hsc_ptr -> pokeByteOff hsc_ptr 88)) ptr refcount
data Version = Version {
versionMajor :: Word8
, versionMinor :: Word8
, versionPatch :: Word8
} deriving (Eq, Show)
instance Storable Version where
sizeOf _ = ((3))
alignment = sizeOf
peek ptr = do
major <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
minor <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
patch <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
return $! Version major minor patch
poke ptr (Version major minor patch) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr major
((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr minor
((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr patch