{-# LINE 1 "src/SDL/Raw/Types.hsc" #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LINE 2 "src/SDL/Raw/Types.hsc" #-}
module SDL.Raw.Types (
  -- * Type Aliases
  -- ** Function Types
  AudioCallback,
  EventFilter,
  HintCallback,
  LogOutputFunction,
  ThreadFunction,
  TimerCallback,

  mkAudioCallback,
  mkEventFilter,
  mkHintCallback,
  mkLogOutputFunction,
  mkThreadFunction,
  mkTimerCallback,

  -- ** Common Types
  AudioDeviceID,
  AudioFormat,
  Cond,
  Cursor,
  FingerID,
  GameController,
  GestureID,
  GLContext,
  Haptic,
  Joystick,
  JoystickID,
  Mutex,
  Renderer,
  Sem,
  SpinLock,
  SysWMinfo,
  SysWMmsg,
  Texture,
  Thread,
  ThreadID,
  TimerID,
  TLSID,
  TouchID,
  Window,

  -- * Data Structures
  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


{-# LINE 73 "src/SDL/Raw/Types.hsc" #-}

import Data.Int
import Data.Typeable
import Data.Word
import Foreign.C.String
import Foreign.C.Types
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable
import SDL.Raw.Enum

type AudioCallback = FunPtr (Ptr () -> Ptr Word8 -> CInt -> IO ())
type EventFilter = FunPtr (Ptr () -> Ptr Event -> IO CInt)
type HintCallback = FunPtr (Ptr () -> CString -> CString -> CString -> IO ())
type LogOutputFunction = FunPtr (Ptr () -> CInt -> LogPriority -> CString -> IO ())
type ThreadFunction = FunPtr (Ptr () -> IO CInt)
type TimerCallback = FunPtr (Word32 -> Ptr () -> IO Word32)

-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import ccall "wrapper"
  mkAudioCallback :: (Ptr () -> Ptr Word8 -> CInt -> IO ()) -> IO AudioCallback

-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import ccall "wrapper"
  mkEventFilter :: (Ptr () -> Ptr Event -> IO CInt) -> IO EventFilter

-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import ccall "wrapper"
  mkHintCallback :: (Ptr () -> CString -> CString -> CString -> IO ()) -> IO HintCallback

-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import ccall "wrapper"
  mkLogOutputFunction :: (Ptr () -> CInt -> LogPriority -> CString -> IO ()) -> IO LogOutputFunction

-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import ccall "wrapper"
  mkThreadFunction :: (Ptr () -> IO CInt) -> IO ThreadFunction

-- | The storage associated with the resulting 'FunPtr' has to be released with
-- 'freeHaskellFunPtr' when it is no longer required.
foreign import ccall "wrapper"
  mkTimerCallback :: (Word32 -> Ptr () -> IO Word32) -> IO TimerCallback

type AudioDeviceID = Word32
type Cond = Ptr ()
type Cursor = Ptr ()
type FingerID = Int64
type GameController = Ptr ()
type GestureID = Int64
type GLContext = Ptr ()
type Haptic = Ptr ()
type Joystick = Ptr ()
type JoystickID = Int32
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 ThreadID = CULong
type TimerID = CInt
type TLSID = CUInt
type TouchID = Int64
type Window = Ptr ()

data Atomic = Atomic
  { atomicValue :: !CInt
  } deriving (Eq, Show, Typeable)

instance Storable Atomic where
  sizeOf _ = ((4))
{-# LINE 151 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    value <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 154 "src/SDL/Raw/Types.hsc" #-}
    return $! Atomic value
  poke ptr (Atomic value) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr value
{-# LINE 157 "src/SDL/Raw/Types.hsc" #-}

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, Typeable)

instance Storable AudioCVT where
  sizeOf _ = ((128))
{-# LINE 172 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    needed <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 175 "src/SDL/Raw/Types.hsc" #-}
    src_format <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 176 "src/SDL/Raw/Types.hsc" #-}
    dst_format <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
{-# LINE 177 "src/SDL/Raw/Types.hsc" #-}
    rate_incr <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 178 "src/SDL/Raw/Types.hsc" #-}
    buf <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 179 "src/SDL/Raw/Types.hsc" #-}
    len <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 180 "src/SDL/Raw/Types.hsc" #-}
    len_cvt <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 181 "src/SDL/Raw/Types.hsc" #-}
    len_mult <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 182 "src/SDL/Raw/Types.hsc" #-}
    len_ratio <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 183 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 186 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr src_format
{-# LINE 187 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 6)) ptr dst_format
{-# LINE 188 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr rate_incr
{-# LINE 189 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr buf
{-# LINE 190 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr len
{-# LINE 191 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr len_cvt
{-# LINE 192 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr len_mult
{-# LINE 193 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr len_ratio
{-# LINE 194 "src/SDL/Raw/Types.hsc" #-}

data AudioSpec = AudioSpec
  { audioSpecFreq :: !CInt
  , audioSpecFormat :: !AudioFormat
  , audioSpecChannels :: !Word8
  , audioSpecSilence :: !Word8
  , audioSpecSamples :: !Word16
  , audioSpecSize :: !Word32
  , audioSpecCallback :: !AudioCallback
  , audioSpecUserdata :: !(Ptr ())
  } deriving (Eq, Show, Typeable)

instance Storable AudioSpec where
  sizeOf _ = ((32))
{-# LINE 208 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    freq <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 211 "src/SDL/Raw/Types.hsc" #-}
    format <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 212 "src/SDL/Raw/Types.hsc" #-}
    channels <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
{-# LINE 213 "src/SDL/Raw/Types.hsc" #-}
    silence <- ((\hsc_ptr -> peekByteOff hsc_ptr 7)) ptr
{-# LINE 214 "src/SDL/Raw/Types.hsc" #-}
    samples <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 215 "src/SDL/Raw/Types.hsc" #-}
    size <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 216 "src/SDL/Raw/Types.hsc" #-}
    callback <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 217 "src/SDL/Raw/Types.hsc" #-}
    userdata <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 218 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 221 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr format
{-# LINE 222 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 6)) ptr channels
{-# LINE 223 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 7)) ptr silence
{-# LINE 224 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr samples
{-# LINE 225 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr size
{-# LINE 226 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr callback
{-# LINE 227 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr userdata
{-# LINE 228 "src/SDL/Raw/Types.hsc" #-}

data Color = Color
  { colorR :: !Word8
  , colorG :: !Word8
  , colorB :: !Word8
  , colorA :: !Word8
  } deriving (Eq, Show, Typeable)

instance Storable Color where
  sizeOf _ = ((4))
{-# LINE 238 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    r <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 241 "src/SDL/Raw/Types.hsc" #-}
    g <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
{-# LINE 242 "src/SDL/Raw/Types.hsc" #-}
    b <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
{-# LINE 243 "src/SDL/Raw/Types.hsc" #-}
    a <- ((\hsc_ptr -> peekByteOff hsc_ptr 3)) ptr
{-# LINE 244 "src/SDL/Raw/Types.hsc" #-}
    return $! Color r g b a
  poke ptr (Color r g b a) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr r
{-# LINE 247 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr g
{-# LINE 248 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr b
{-# LINE 249 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 3)) ptr a
{-# LINE 250 "src/SDL/Raw/Types.hsc" #-}

data DisplayMode = DisplayMode
  { displayModeFormat :: !Word32
  , displayModeW :: !CInt
  , displayModeH :: !CInt
  , displayModeRefreshRate :: !CInt
  , displayModeDriverData :: !(Ptr ())
  } deriving (Eq, Show, Typeable)

instance Storable DisplayMode where
  sizeOf _ = ((24))
{-# LINE 261 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    format <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 264 "src/SDL/Raw/Types.hsc" #-}
    w <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 265 "src/SDL/Raw/Types.hsc" #-}
    h <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 266 "src/SDL/Raw/Types.hsc" #-}
    refresh_rate <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 267 "src/SDL/Raw/Types.hsc" #-}
    driverdata <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 268 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 271 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr w
{-# LINE 272 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr h
{-# LINE 273 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr refresh_rate
{-# LINE 274 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr driverdata
{-# LINE 275 "src/SDL/Raw/Types.hsc" #-}

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]
    }
  | KeymapChangedEvent
    { eventType :: !Word32
    , eventTimestamp :: !Word32
    }
  | 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
    , mouseWheelEventDirection :: !Word32
    }
  | 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
    }
  | AudioDeviceEvent
    { eventType :: !Word32
    , eventTimestamp :: !Word32
    , audioDeviceEventWhich :: !Word32
    , audioDeviceEventIsCapture :: !Word8
    }
  | 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, Typeable)

instance Storable Event where
  sizeOf _ = ((56))
{-# LINE 466 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 469 "src/SDL/Raw/Types.hsc" #-}
    timestamp <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 470 "src/SDL/Raw/Types.hsc" #-}
    case typ of
      (256) ->
{-# LINE 472 "src/SDL/Raw/Types.hsc" #-}
        return $! QuitEvent typ timestamp
      (512) -> do
{-# LINE 474 "src/SDL/Raw/Types.hsc" #-}
        wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 475 "src/SDL/Raw/Types.hsc" #-}
        event <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 476 "src/SDL/Raw/Types.hsc" #-}
        data1 <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 477 "src/SDL/Raw/Types.hsc" #-}
        data2 <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 478 "src/SDL/Raw/Types.hsc" #-}
        return $! WindowEvent typ timestamp wid event data1 data2
      (513) -> do
{-# LINE 480 "src/SDL/Raw/Types.hsc" #-}
        msg <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 481 "src/SDL/Raw/Types.hsc" #-}
        return $! SysWMEvent typ timestamp msg
      (768) -> key $ KeyboardEvent typ timestamp
{-# LINE 483 "src/SDL/Raw/Types.hsc" #-}
      (769) -> key $ KeyboardEvent typ timestamp
{-# LINE 484 "src/SDL/Raw/Types.hsc" #-}
      (770) -> do
{-# LINE 485 "src/SDL/Raw/Types.hsc" #-}
        wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 486 "src/SDL/Raw/Types.hsc" #-}
        text <- peekArray (32) $ ((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr
{-# LINE 487 "src/SDL/Raw/Types.hsc" #-}
        start <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) ptr
{-# LINE 488 "src/SDL/Raw/Types.hsc" #-}
        len <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
{-# LINE 489 "src/SDL/Raw/Types.hsc" #-}
        let upToNull = takeWhile (/= 0) text
        return $! TextEditingEvent typ timestamp wid upToNull start len
      (771) -> do
{-# LINE 492 "src/SDL/Raw/Types.hsc" #-}
        wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 493 "src/SDL/Raw/Types.hsc" #-}
        text <- peekArray (32) $ ((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr
{-# LINE 494 "src/SDL/Raw/Types.hsc" #-}
        let upToNull = takeWhile (/= 0) text
        return $! TextInputEvent typ timestamp wid upToNull
      (772) ->
{-# LINE 497 "src/SDL/Raw/Types.hsc" #-}
        return $! KeymapChangedEvent typ timestamp
      (1024) -> do
{-# LINE 499 "src/SDL/Raw/Types.hsc" #-}
        wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 500 "src/SDL/Raw/Types.hsc" #-}
        which <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 501 "src/SDL/Raw/Types.hsc" #-}
        state <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 502 "src/SDL/Raw/Types.hsc" #-}
        x <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 503 "src/SDL/Raw/Types.hsc" #-}
        y <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 504 "src/SDL/Raw/Types.hsc" #-}
        xrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 505 "src/SDL/Raw/Types.hsc" #-}
        yrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 506 "src/SDL/Raw/Types.hsc" #-}
        return $! MouseMotionEvent typ timestamp wid which state x y xrel yrel
      (1025) -> mouse $ MouseButtonEvent typ timestamp
{-# LINE 508 "src/SDL/Raw/Types.hsc" #-}
      (1026) -> mouse $ MouseButtonEvent typ timestamp
{-# LINE 509 "src/SDL/Raw/Types.hsc" #-}
      (1027) -> do
{-# LINE 510 "src/SDL/Raw/Types.hsc" #-}
        wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 511 "src/SDL/Raw/Types.hsc" #-}
        which <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 512 "src/SDL/Raw/Types.hsc" #-}
        x <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 513 "src/SDL/Raw/Types.hsc" #-}
        y <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 514 "src/SDL/Raw/Types.hsc" #-}
        direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 515 "src/SDL/Raw/Types.hsc" #-}
        return $! MouseWheelEvent typ timestamp wid which x y direction
      (1536) -> do
{-# LINE 517 "src/SDL/Raw/Types.hsc" #-}
        which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 518 "src/SDL/Raw/Types.hsc" #-}
        axis <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 519 "src/SDL/Raw/Types.hsc" #-}
        value <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 520 "src/SDL/Raw/Types.hsc" #-}
        return $! JoyAxisEvent typ timestamp which axis value
      (1537) -> do
{-# LINE 522 "src/SDL/Raw/Types.hsc" #-}
        which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 523 "src/SDL/Raw/Types.hsc" #-}
        ball <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 524 "src/SDL/Raw/Types.hsc" #-}
        xrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 525 "src/SDL/Raw/Types.hsc" #-}
        yrel <- ((\hsc_ptr -> peekByteOff hsc_ptr 18)) ptr
{-# LINE 526 "src/SDL/Raw/Types.hsc" #-}
        return $! JoyBallEvent typ timestamp which ball xrel yrel
      (1538) -> do
{-# LINE 528 "src/SDL/Raw/Types.hsc" #-}
        which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 529 "src/SDL/Raw/Types.hsc" #-}
        hat <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 530 "src/SDL/Raw/Types.hsc" #-}
        value <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
{-# LINE 531 "src/SDL/Raw/Types.hsc" #-}
        return $! JoyHatEvent typ timestamp which hat value
      (1539) -> joybutton $ JoyButtonEvent typ timestamp
{-# LINE 533 "src/SDL/Raw/Types.hsc" #-}
      (1540) -> joybutton $ JoyButtonEvent typ timestamp
{-# LINE 534 "src/SDL/Raw/Types.hsc" #-}
      (1541) -> joydevice $ JoyDeviceEvent typ timestamp
{-# LINE 535 "src/SDL/Raw/Types.hsc" #-}
      (1542) -> joydevice $ JoyDeviceEvent typ timestamp
{-# LINE 536 "src/SDL/Raw/Types.hsc" #-}
      (1616) -> do
{-# LINE 537 "src/SDL/Raw/Types.hsc" #-}
        which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 538 "src/SDL/Raw/Types.hsc" #-}
        axis <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 539 "src/SDL/Raw/Types.hsc" #-}
        value <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 540 "src/SDL/Raw/Types.hsc" #-}
        return $! ControllerButtonEvent typ timestamp which axis value
      (1617) -> controllerbutton $ ControllerButtonEvent typ timestamp
{-# LINE 542 "src/SDL/Raw/Types.hsc" #-}
      (1618) -> controllerbutton $ ControllerButtonEvent typ timestamp
{-# LINE 543 "src/SDL/Raw/Types.hsc" #-}
      (1619) -> controllerdevice $ ControllerDeviceEvent typ timestamp
{-# LINE 544 "src/SDL/Raw/Types.hsc" #-}
      (1620) -> controllerdevice $ ControllerDeviceEvent typ timestamp
{-# LINE 545 "src/SDL/Raw/Types.hsc" #-}
      (1621) -> controllerdevice $ ControllerDeviceEvent typ timestamp
{-# LINE 546 "src/SDL/Raw/Types.hsc" #-}
      (4352) -> audiodevice $ AudioDeviceEvent typ timestamp
{-# LINE 547 "src/SDL/Raw/Types.hsc" #-}
      (4353) -> audiodevice $ AudioDeviceEvent typ timestamp
{-# LINE 548 "src/SDL/Raw/Types.hsc" #-}
      (1792) -> finger $ TouchFingerEvent typ timestamp
{-# LINE 549 "src/SDL/Raw/Types.hsc" #-}
      (1793) -> finger $ TouchFingerEvent typ timestamp
{-# LINE 550 "src/SDL/Raw/Types.hsc" #-}
      (1794) -> finger $ TouchFingerEvent typ timestamp
{-# LINE 551 "src/SDL/Raw/Types.hsc" #-}
      (2048) -> dollargesture $ DollarGestureEvent typ timestamp
{-# LINE 552 "src/SDL/Raw/Types.hsc" #-}
      (2049) -> dollargesture $ DollarGestureEvent typ timestamp
{-# LINE 553 "src/SDL/Raw/Types.hsc" #-}
      (2050) -> do
{-# LINE 554 "src/SDL/Raw/Types.hsc" #-}
        touchId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 555 "src/SDL/Raw/Types.hsc" #-}
        dTheta <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 556 "src/SDL/Raw/Types.hsc" #-}
        dDist <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 557 "src/SDL/Raw/Types.hsc" #-}
        x <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 558 "src/SDL/Raw/Types.hsc" #-}
        y <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 559 "src/SDL/Raw/Types.hsc" #-}
        numFingers <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 560 "src/SDL/Raw/Types.hsc" #-}
        return $! MultiGestureEvent typ timestamp touchId dTheta dDist x y numFingers
      (2304) ->
{-# LINE 562 "src/SDL/Raw/Types.hsc" #-}
        return $! ClipboardUpdateEvent typ timestamp
      (4096) -> do
{-# LINE 564 "src/SDL/Raw/Types.hsc" #-}
        file <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 565 "src/SDL/Raw/Types.hsc" #-}
        return $! DropEvent typ timestamp file
      x | x >= (32768) -> do
{-# LINE 567 "src/SDL/Raw/Types.hsc" #-}
        wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 568 "src/SDL/Raw/Types.hsc" #-}
        code <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 569 "src/SDL/Raw/Types.hsc" #-}
        data1 <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 570 "src/SDL/Raw/Types.hsc" #-}
        data2 <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 571 "src/SDL/Raw/Types.hsc" #-}
        return $! UserEvent typ timestamp wid code data1 data2
      _ -> return $! UnknownEvent typ timestamp
    where
    key f = do
      wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 576 "src/SDL/Raw/Types.hsc" #-}
      state <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 577 "src/SDL/Raw/Types.hsc" #-}
      repeat' <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
{-# LINE 578 "src/SDL/Raw/Types.hsc" #-}
      keysym <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 579 "src/SDL/Raw/Types.hsc" #-}
      return $! f wid state repeat' keysym

    mouse f = do
      wid <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 583 "src/SDL/Raw/Types.hsc" #-}
      which <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 584 "src/SDL/Raw/Types.hsc" #-}
      button <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 585 "src/SDL/Raw/Types.hsc" #-}
      state <- ((\hsc_ptr -> peekByteOff hsc_ptr 17)) ptr
{-# LINE 586 "src/SDL/Raw/Types.hsc" #-}
      clicks <- ((\hsc_ptr -> peekByteOff hsc_ptr 18)) ptr
{-# LINE 587 "src/SDL/Raw/Types.hsc" #-}
      x <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 588 "src/SDL/Raw/Types.hsc" #-}
      y <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 589 "src/SDL/Raw/Types.hsc" #-}
      return $! f wid which button state clicks x y

    joybutton f = do
      which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 593 "src/SDL/Raw/Types.hsc" #-}
      button <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 594 "src/SDL/Raw/Types.hsc" #-}
      state <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
{-# LINE 595 "src/SDL/Raw/Types.hsc" #-}
      return $! f which button state

    joydevice f = do
      which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 599 "src/SDL/Raw/Types.hsc" #-}
      return $! f which

    controllerbutton f = do
      which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 603 "src/SDL/Raw/Types.hsc" #-}
      button <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 604 "src/SDL/Raw/Types.hsc" #-}
      state <- ((\hsc_ptr -> peekByteOff hsc_ptr 13)) ptr
{-# LINE 605 "src/SDL/Raw/Types.hsc" #-}
      return $! f which button state

    controllerdevice f = do
      which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 609 "src/SDL/Raw/Types.hsc" #-}
      return $! f which

    audiodevice f = do
      which <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 613 "src/SDL/Raw/Types.hsc" #-}
      iscapture <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 614 "src/SDL/Raw/Types.hsc" #-}
      return $! f which iscapture

    finger f = do
      touchId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 618 "src/SDL/Raw/Types.hsc" #-}
      fingerId <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 619 "src/SDL/Raw/Types.hsc" #-}
      x <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 620 "src/SDL/Raw/Types.hsc" #-}
      y <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 621 "src/SDL/Raw/Types.hsc" #-}
      dx <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 622 "src/SDL/Raw/Types.hsc" #-}
      dy <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 623 "src/SDL/Raw/Types.hsc" #-}
      pressure <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 624 "src/SDL/Raw/Types.hsc" #-}
      return $! f touchId fingerId x y dx dy pressure

    dollargesture f = do
      touchId <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 628 "src/SDL/Raw/Types.hsc" #-}
      gestureId <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 629 "src/SDL/Raw/Types.hsc" #-}
      numFingers <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 630 "src/SDL/Raw/Types.hsc" #-}
      err <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 631 "src/SDL/Raw/Types.hsc" #-}
      x <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 632 "src/SDL/Raw/Types.hsc" #-}
      y <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 633 "src/SDL/Raw/Types.hsc" #-}
      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
{-# LINE 637 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 638 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 639 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr event
{-# LINE 640 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr data1
{-# LINE 641 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr data2
{-# LINE 642 "src/SDL/Raw/Types.hsc" #-}
    KeyboardEvent typ timestamp wid state repeat' keysym -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 644 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 645 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 646 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr state
{-# LINE 647 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr repeat'
{-# LINE 648 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr keysym
{-# LINE 649 "src/SDL/Raw/Types.hsc" #-}
    TextEditingEvent typ timestamp wid text start len -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 651 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 652 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 653 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr) text
{-# LINE 654 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 44)) ptr start
{-# LINE 655 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr len
{-# LINE 656 "src/SDL/Raw/Types.hsc" #-}
    TextInputEvent typ timestamp wid text -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 658 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 659 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 660 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 12)) ptr) text
{-# LINE 661 "src/SDL/Raw/Types.hsc" #-}
    KeymapChangedEvent typ timestamp -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 663 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 664 "src/SDL/Raw/Types.hsc" #-}
    MouseMotionEvent typ timestamp wid which state x y xrel yrel -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 666 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 667 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 668 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr which
{-# LINE 669 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr state
{-# LINE 670 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr x
{-# LINE 671 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr y
{-# LINE 672 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr xrel
{-# LINE 673 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr yrel
{-# LINE 674 "src/SDL/Raw/Types.hsc" #-}
    MouseButtonEvent typ timestamp wid which button state clicks x y -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 676 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 677 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 678 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr which
{-# LINE 679 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr button
{-# LINE 680 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 17)) ptr state
{-# LINE 681 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 18)) ptr clicks
{-# LINE 682 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr x
{-# LINE 683 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr y
{-# LINE 684 "src/SDL/Raw/Types.hsc" #-}
    MouseWheelEvent typ timestamp wid which x y direction -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 686 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 687 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 688 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr which
{-# LINE 689 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr x
{-# LINE 690 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr y
{-# LINE 691 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr direction
{-# LINE 692 "src/SDL/Raw/Types.hsc" #-}
    JoyAxisEvent typ timestamp which axis value -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 694 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 695 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 696 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr axis
{-# LINE 697 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr value
{-# LINE 698 "src/SDL/Raw/Types.hsc" #-}
    JoyBallEvent typ timestamp which ball xrel yrel -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 700 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 701 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 702 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr ball
{-# LINE 703 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr xrel
{-# LINE 704 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 18)) ptr yrel
{-# LINE 705 "src/SDL/Raw/Types.hsc" #-}
    JoyHatEvent typ timestamp which hat value -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 707 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 708 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 709 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr hat
{-# LINE 710 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr value
{-# LINE 711 "src/SDL/Raw/Types.hsc" #-}
    JoyButtonEvent typ timestamp which button state -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 713 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 714 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 715 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr button
{-# LINE 716 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr state
{-# LINE 717 "src/SDL/Raw/Types.hsc" #-}
    JoyDeviceEvent typ timestamp which -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 719 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 720 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 721 "src/SDL/Raw/Types.hsc" #-}
    ControllerAxisEvent typ timestamp which axis value -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 723 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 724 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 725 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr axis
{-# LINE 726 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr value
{-# LINE 727 "src/SDL/Raw/Types.hsc" #-}
    ControllerButtonEvent typ timestamp which button state -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 729 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 730 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 731 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr button
{-# LINE 732 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 13)) ptr state
{-# LINE 733 "src/SDL/Raw/Types.hsc" #-}
    ControllerDeviceEvent typ timestamp which -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 735 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 736 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 737 "src/SDL/Raw/Types.hsc" #-}
    AudioDeviceEvent typ timestamp which iscapture -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 739 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 740 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr which
{-# LINE 741 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr iscapture
{-# LINE 742 "src/SDL/Raw/Types.hsc" #-}
    QuitEvent typ timestamp -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 744 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 745 "src/SDL/Raw/Types.hsc" #-}
    UserEvent typ timestamp wid code data1 data2 -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 747 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 748 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr wid
{-# LINE 749 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr code
{-# LINE 750 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr data1
{-# LINE 751 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr data2
{-# LINE 752 "src/SDL/Raw/Types.hsc" #-}
    SysWMEvent typ timestamp msg -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 754 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 755 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr msg
{-# LINE 756 "src/SDL/Raw/Types.hsc" #-}
    TouchFingerEvent typ timestamp touchid fingerid x y dx dy pressure -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 758 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 759 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr touchid
{-# LINE 760 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr fingerid
{-# LINE 761 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr x
{-# LINE 762 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr y
{-# LINE 763 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr dx
{-# LINE 764 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr dy
{-# LINE 765 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr pressure
{-# LINE 766 "src/SDL/Raw/Types.hsc" #-}
    MultiGestureEvent typ timestamp touchid dtheta ddist x y numfingers -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 768 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 769 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr touchid
{-# LINE 770 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr dtheta
{-# LINE 771 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr ddist
{-# LINE 772 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr x
{-# LINE 773 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr y
{-# LINE 774 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr numfingers
{-# LINE 775 "src/SDL/Raw/Types.hsc" #-}
    DollarGestureEvent typ timestamp touchid gestureid numfingers err x y -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 777 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 778 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr touchid
{-# LINE 779 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr gestureid
{-# LINE 780 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr numfingers
{-# LINE 781 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr err
{-# LINE 782 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr x
{-# LINE 783 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr y
{-# LINE 784 "src/SDL/Raw/Types.hsc" #-}
    ClipboardUpdateEvent typ timestamp -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 786 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 787 "src/SDL/Raw/Types.hsc" #-}
    DropEvent typ timestamp file -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 789 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 790 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr file
{-# LINE 791 "src/SDL/Raw/Types.hsc" #-}
    UnknownEvent typ timestamp -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 793 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr timestamp
{-# LINE 794 "src/SDL/Raw/Types.hsc" #-}

data Finger = Finger
  { fingerID :: !FingerID
  , fingerX :: !CFloat
  , fingerY :: !CFloat
  , fingerPressure :: !CFloat
  } deriving (Eq, Show, Typeable)

instance Storable Finger where
  sizeOf _ = ((24))
{-# LINE 804 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    fingerId <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 807 "src/SDL/Raw/Types.hsc" #-}
    x <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 808 "src/SDL/Raw/Types.hsc" #-}
    y <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 809 "src/SDL/Raw/Types.hsc" #-}
    pressure <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 810 "src/SDL/Raw/Types.hsc" #-}
    return $! Finger fingerId x y pressure
  poke ptr (Finger fingerId x y pressure) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr fingerId
{-# LINE 813 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr x
{-# LINE 814 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr y
{-# LINE 815 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr pressure
{-# LINE 816 "src/SDL/Raw/Types.hsc" #-}

data GameControllerButtonBind
  = GameControllerButtonBindNone
  | GameControllerButtonBindButton
    { gameControllerButtonBindButton :: !CInt
    }
  | GameControllerButtonBindAxis
    { gameControllerButtonBindAxis :: !CInt
    }
  | GameControllerButtonBindHat
    { gameControllerButtonBindHat :: !CInt
    , gameControllerButtonBindHatMask :: !CInt
    }
  deriving (Eq, Show, Typeable)

instance Storable GameControllerButtonBind where
  sizeOf _ = ((12))
{-# LINE 833 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    bind_type <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 836 "src/SDL/Raw/Types.hsc" #-}
    case bind_type :: (Word32) of
{-# LINE 837 "src/SDL/Raw/Types.hsc" #-}
      (0) -> do
{-# LINE 838 "src/SDL/Raw/Types.hsc" #-}
        return $! GameControllerButtonBindNone
      (1) -> do
{-# LINE 840 "src/SDL/Raw/Types.hsc" #-}
        button <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 841 "src/SDL/Raw/Types.hsc" #-}
        return $! GameControllerButtonBindButton button
      (2) -> do
{-# LINE 843 "src/SDL/Raw/Types.hsc" #-}
        axis <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 844 "src/SDL/Raw/Types.hsc" #-}
        return $! GameControllerButtonBindAxis axis
      (3) -> do
{-# LINE 846 "src/SDL/Raw/Types.hsc" #-}
        hat <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 847 "src/SDL/Raw/Types.hsc" #-}
        hat_mask <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 848 "src/SDL/Raw/Types.hsc" #-}
        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))
{-# LINE 853 "src/SDL/Raw/Types.hsc" #-}
    GameControllerButtonBindButton button -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((1) :: (Word32))
{-# LINE 855 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr button
{-# LINE 856 "src/SDL/Raw/Types.hsc" #-}
    GameControllerButtonBindAxis axis -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((2) :: (Word32))
{-# LINE 858 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr axis
{-# LINE 859 "src/SDL/Raw/Types.hsc" #-}
    GameControllerButtonBindHat hat hat_mask -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ((3) :: (Word32))
{-# LINE 861 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr hat
{-# LINE 862 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr hat_mask
{-# LINE 863 "src/SDL/Raw/Types.hsc" #-}

data HapticDirection = HapticDirection
  { hapticDirectionType :: !Word8
  , hapticDirectionX :: !Int32
  , hapticDirectionY :: !Int32
  , hapticDirectionZ :: !Int32
  } deriving (Eq, Show, Typeable)

instance Storable HapticDirection where
  sizeOf _ = ((16))
{-# LINE 873 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 876 "src/SDL/Raw/Types.hsc" #-}
    x <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 877 "src/SDL/Raw/Types.hsc" #-}
    y <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 878 "src/SDL/Raw/Types.hsc" #-}
    z <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 879 "src/SDL/Raw/Types.hsc" #-}
    return $! HapticDirection typ x y z
  poke ptr (HapticDirection typ x y z) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 882 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr x
{-# LINE 883 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr y
{-# LINE 884 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr z
{-# LINE 885 "src/SDL/Raw/Types.hsc" #-}

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, Typeable)

instance Storable HapticEffect where
  sizeOf _ = ((72))
{-# LINE 969 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 972 "src/SDL/Raw/Types.hsc" #-}
    case typ of
      (1) -> do
{-# LINE 974 "src/SDL/Raw/Types.hsc" #-}
        direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 975 "src/SDL/Raw/Types.hsc" #-}
        len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 976 "src/SDL/Raw/Types.hsc" #-}
        delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 977 "src/SDL/Raw/Types.hsc" #-}
        button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
{-# LINE 978 "src/SDL/Raw/Types.hsc" #-}
        interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 979 "src/SDL/Raw/Types.hsc" #-}
        level <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
{-# LINE 980 "src/SDL/Raw/Types.hsc" #-}
        attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 981 "src/SDL/Raw/Types.hsc" #-}
        attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
{-# LINE 982 "src/SDL/Raw/Types.hsc" #-}
        fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 983 "src/SDL/Raw/Types.hsc" #-}
        fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 38)) ptr
{-# LINE 984 "src/SDL/Raw/Types.hsc" #-}
        return $! HapticConstant typ direction len delay button interval level attack_length attack_level fade_length fade_level

      (2) -> hapticperiodic $ HapticPeriodic typ
{-# LINE 987 "src/SDL/Raw/Types.hsc" #-}
      (8) -> hapticperiodic $ HapticPeriodic typ
{-# LINE 988 "src/SDL/Raw/Types.hsc" #-}
      (16) -> hapticperiodic $ HapticPeriodic typ
{-# LINE 989 "src/SDL/Raw/Types.hsc" #-}
      (32) -> hapticperiodic $ HapticPeriodic typ
{-# LINE 990 "src/SDL/Raw/Types.hsc" #-}

      (64) -> do
{-# LINE 992 "src/SDL/Raw/Types.hsc" #-}
        direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 993 "src/SDL/Raw/Types.hsc" #-}
        len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 994 "src/SDL/Raw/Types.hsc" #-}
        delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 995 "src/SDL/Raw/Types.hsc" #-}
        button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
{-# LINE 996 "src/SDL/Raw/Types.hsc" #-}
        interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 997 "src/SDL/Raw/Types.hsc" #-}
        start <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
{-# LINE 998 "src/SDL/Raw/Types.hsc" #-}
        end <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 999 "src/SDL/Raw/Types.hsc" #-}
        attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
{-# LINE 1000 "src/SDL/Raw/Types.hsc" #-}
        attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 1001 "src/SDL/Raw/Types.hsc" #-}
        fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 38)) ptr
{-# LINE 1002 "src/SDL/Raw/Types.hsc" #-}
        fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 1003 "src/SDL/Raw/Types.hsc" #-}
        return $! HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level

      (128) -> hapticcondition $ HapticCondition typ
{-# LINE 1006 "src/SDL/Raw/Types.hsc" #-}
      (256) -> hapticcondition $ HapticCondition typ
{-# LINE 1007 "src/SDL/Raw/Types.hsc" #-}
      (512) -> hapticcondition $ HapticCondition typ
{-# LINE 1008 "src/SDL/Raw/Types.hsc" #-}
      (1024) -> hapticcondition $ HapticCondition typ
{-# LINE 1009 "src/SDL/Raw/Types.hsc" #-}

      (4) -> do
{-# LINE 1011 "src/SDL/Raw/Types.hsc" #-}
        len <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 1012 "src/SDL/Raw/Types.hsc" #-}
        large_magnitude <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1013 "src/SDL/Raw/Types.hsc" #-}
        small_magnitude <- ((\hsc_ptr -> peekByteOff hsc_ptr 10)) ptr
{-# LINE 1014 "src/SDL/Raw/Types.hsc" #-}
        return $! HapticLeftRight typ len large_magnitude small_magnitude

      (2048) -> do
{-# LINE 1017 "src/SDL/Raw/Types.hsc" #-}
        direction <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 1018 "src/SDL/Raw/Types.hsc" #-}
        len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 1019 "src/SDL/Raw/Types.hsc" #-}
        delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 1020 "src/SDL/Raw/Types.hsc" #-}
        button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
{-# LINE 1021 "src/SDL/Raw/Types.hsc" #-}
        interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 1022 "src/SDL/Raw/Types.hsc" #-}
        channels <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
{-# LINE 1023 "src/SDL/Raw/Types.hsc" #-}
        period <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 1024 "src/SDL/Raw/Types.hsc" #-}
        samples <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
{-# LINE 1025 "src/SDL/Raw/Types.hsc" #-}
        datum <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 1026 "src/SDL/Raw/Types.hsc" #-}
        attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
{-# LINE 1027 "src/SDL/Raw/Types.hsc" #-}
        attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 50)) ptr
{-# LINE 1028 "src/SDL/Raw/Types.hsc" #-}
        fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 52)) ptr
{-# LINE 1029 "src/SDL/Raw/Types.hsc" #-}
        fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 54)) ptr
{-# LINE 1030 "src/SDL/Raw/Types.hsc" #-}
        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
{-# LINE 1035 "src/SDL/Raw/Types.hsc" #-}
      len <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 1036 "src/SDL/Raw/Types.hsc" #-}
      delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 1037 "src/SDL/Raw/Types.hsc" #-}
      button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
{-# LINE 1038 "src/SDL/Raw/Types.hsc" #-}
      interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 1039 "src/SDL/Raw/Types.hsc" #-}
      period <- ((\hsc_ptr -> peekByteOff hsc_ptr 30)) ptr
{-# LINE 1040 "src/SDL/Raw/Types.hsc" #-}
      magnitude <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 1041 "src/SDL/Raw/Types.hsc" #-}
      offset <- ((\hsc_ptr -> peekByteOff hsc_ptr 34)) ptr
{-# LINE 1042 "src/SDL/Raw/Types.hsc" #-}
      phase <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 1043 "src/SDL/Raw/Types.hsc" #-}
      attack_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 38)) ptr
{-# LINE 1044 "src/SDL/Raw/Types.hsc" #-}
      attack_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 1045 "src/SDL/Raw/Types.hsc" #-}
      fade_length <- ((\hsc_ptr -> peekByteOff hsc_ptr 42)) ptr
{-# LINE 1046 "src/SDL/Raw/Types.hsc" #-}
      fade_level <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) ptr
{-# LINE 1047 "src/SDL/Raw/Types.hsc" #-}
      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
{-# LINE 1051 "src/SDL/Raw/Types.hsc" #-}
      delay <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 1052 "src/SDL/Raw/Types.hsc" #-}
      button <- ((\hsc_ptr -> peekByteOff hsc_ptr 26)) ptr
{-# LINE 1053 "src/SDL/Raw/Types.hsc" #-}
      interval <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 1054 "src/SDL/Raw/Types.hsc" #-}
      right_sat <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 30)) ptr
{-# LINE 1055 "src/SDL/Raw/Types.hsc" #-}
      left_sat <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 36)) ptr
{-# LINE 1056 "src/SDL/Raw/Types.hsc" #-}
      right_coeff <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 42)) ptr
{-# LINE 1057 "src/SDL/Raw/Types.hsc" #-}
      left_coeff <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 48)) ptr
{-# LINE 1058 "src/SDL/Raw/Types.hsc" #-}
      deadband <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 54)) ptr
{-# LINE 1059 "src/SDL/Raw/Types.hsc" #-}
      center <- peekArray 3 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 60)) ptr
{-# LINE 1060 "src/SDL/Raw/Types.hsc" #-}
      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
{-# LINE 1064 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
{-# LINE 1065 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
{-# LINE 1066 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
{-# LINE 1067 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
{-# LINE 1068 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
{-# LINE 1069 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr level
{-# LINE 1070 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr attack_length
{-# LINE 1071 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr attack_level
{-# LINE 1072 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr fade_length
{-# LINE 1073 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 38)) ptr fade_level
{-# LINE 1074 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1076 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
{-# LINE 1077 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
{-# LINE 1078 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
{-# LINE 1079 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
{-# LINE 1080 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
{-# LINE 1081 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr period
{-# LINE 1082 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr magnitude
{-# LINE 1083 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr offset
{-# LINE 1084 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr phase
{-# LINE 1085 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 38)) ptr attack_length
{-# LINE 1086 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr attack_level
{-# LINE 1087 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 42)) ptr fade_length
{-# LINE 1088 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 44)) ptr fade_level
{-# LINE 1089 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1091 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
{-# LINE 1092 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
{-# LINE 1093 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
{-# LINE 1094 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
{-# LINE 1095 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 30)) ptr) right_sat
{-# LINE 1096 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 36)) ptr) left_sat
{-# LINE 1097 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 42)) ptr) right_coeff
{-# LINE 1098 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 48)) ptr) left_coeff
{-# LINE 1099 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 54)) ptr) deadband
{-# LINE 1100 "src/SDL/Raw/Types.hsc" #-}
      pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 60)) ptr) center
{-# LINE 1101 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1103 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
{-# LINE 1104 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
{-# LINE 1105 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
{-# LINE 1106 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
{-# LINE 1107 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
{-# LINE 1108 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr start
{-# LINE 1109 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr end
{-# LINE 1110 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr attack_length
{-# LINE 1111 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr attack_level
{-# LINE 1112 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 38)) ptr fade_length
{-# LINE 1113 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr fade_level
{-# LINE 1114 "src/SDL/Raw/Types.hsc" #-}
    HapticLeftRight typ len large_magnitude small_magnitude -> do
      ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr typ
{-# LINE 1116 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr len
{-# LINE 1117 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr large_magnitude
{-# LINE 1118 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 10)) ptr small_magnitude
{-# LINE 1119 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1121 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr direction
{-# LINE 1122 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr len
{-# LINE 1123 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr delay
{-# LINE 1124 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 26)) ptr button
{-# LINE 1125 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr interval
{-# LINE 1126 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 30)) ptr channels
{-# LINE 1127 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr period
{-# LINE 1128 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 34)) ptr samples
{-# LINE 1129 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr datum
{-# LINE 1130 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr attack_length
{-# LINE 1131 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 50)) ptr attack_level
{-# LINE 1132 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 52)) ptr fade_length
{-# LINE 1133 "src/SDL/Raw/Types.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 54)) ptr fade_level
{-# LINE 1134 "src/SDL/Raw/Types.hsc" #-}

data JoystickGUID = JoystickGUID
  { joystickGUID :: ![Word8]
  } deriving (Eq, Show, Typeable)

instance Storable JoystickGUID where
  sizeOf _ = ((16))
{-# LINE 1141 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    guid <- peekArray 16 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 0)) ptr
{-# LINE 1144 "src/SDL/Raw/Types.hsc" #-}
    return $! JoystickGUID guid
  poke ptr (JoystickGUID guid) =
    pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 0)) ptr) guid
{-# LINE 1147 "src/SDL/Raw/Types.hsc" #-}

data Keysym = Keysym
  { keysymScancode :: !Scancode
  , keysymKeycode :: !Keycode
  , keysymMod :: !Word16
  } deriving (Eq, Show, Typeable)

instance Storable Keysym where
  sizeOf _ = ((16))
{-# LINE 1156 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    scancode <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1159 "src/SDL/Raw/Types.hsc" #-}
    sym <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 1160 "src/SDL/Raw/Types.hsc" #-}
    mod' <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1161 "src/SDL/Raw/Types.hsc" #-}
    return $! Keysym scancode sym mod'
  poke ptr (Keysym scancode sym mod') = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr scancode
{-# LINE 1164 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr sym
{-# LINE 1165 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr mod'
{-# LINE 1166 "src/SDL/Raw/Types.hsc" #-}

data MessageBoxButtonData = MessageBoxButtonData
  { messageBoxButtonDataFlags :: !Word32
  , messageBoxButtonButtonID :: !CInt
  , messageBoxButtonText :: !CString
  } deriving (Eq, Show, Typeable)

instance Storable MessageBoxButtonData where
  sizeOf _ = ((16))
{-# LINE 1175 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    flags <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1178 "src/SDL/Raw/Types.hsc" #-}
    buttonid <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 1179 "src/SDL/Raw/Types.hsc" #-}
    text <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1180 "src/SDL/Raw/Types.hsc" #-}
    return $! MessageBoxButtonData flags buttonid text
  poke ptr (MessageBoxButtonData flags buttonid text) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr flags
{-# LINE 1183 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr buttonid
{-# LINE 1184 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr text
{-# LINE 1185 "src/SDL/Raw/Types.hsc" #-}

data MessageBoxColor = MessageBoxColor
  { messageBoxColorR :: !Word8
  , messageBoxColorG :: !Word8
  , messageBoxColorB :: !Word8
  } deriving (Eq, Show, Typeable)

instance Storable MessageBoxColor where
  sizeOf _ = ((3))
{-# LINE 1194 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    r <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1197 "src/SDL/Raw/Types.hsc" #-}
    g <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
{-# LINE 1198 "src/SDL/Raw/Types.hsc" #-}
    b <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
{-# LINE 1199 "src/SDL/Raw/Types.hsc" #-}
    return $! MessageBoxColor r g b
  poke ptr (MessageBoxColor r g b) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr r
{-# LINE 1202 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr g
{-# LINE 1203 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr b
{-# LINE 1204 "src/SDL/Raw/Types.hsc" #-}

data MessageBoxColorScheme = MessageBoxColorScheme
  { messageBoxColorSchemeColorBackground :: !MessageBoxColor
  , messageBoxColorSchemeColorText :: !MessageBoxColor
  , messageBoxColorSchemeColorButtonBorder :: !MessageBoxColor
  , messageBoxColorSchemeColorButtonBackground :: !MessageBoxColor
  , messageBoxColorSchemeColorButtonSelected :: !MessageBoxColor
  } deriving (Eq, Show, Typeable)

instance Storable MessageBoxColorScheme where
  sizeOf _ = ((15))
{-# LINE 1215 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    background <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1218 "src/SDL/Raw/Types.hsc" #-}
    text <- ((\hsc_ptr -> peekByteOff hsc_ptr 3)) ptr
{-# LINE 1219 "src/SDL/Raw/Types.hsc" #-}
    button_border <- ((\hsc_ptr -> peekByteOff hsc_ptr 6)) ptr
{-# LINE 1220 "src/SDL/Raw/Types.hsc" #-}
    button_background <- ((\hsc_ptr -> peekByteOff hsc_ptr 9)) ptr
{-# LINE 1221 "src/SDL/Raw/Types.hsc" #-}
    button_selected <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 1222 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1225 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 3)) ptr text
{-# LINE 1226 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 6)) ptr button_border
{-# LINE 1227 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 9)) ptr button_background
{-# LINE 1228 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr button_selected
{-# LINE 1229 "src/SDL/Raw/Types.hsc" #-}

data MessageBoxData = MessageBoxData
  { messageBoxDataFlags :: !Word32
  , messageBoxDataWindow :: !Window
  , messageBoxDataTitle :: !CString
  , messageBoxDataMessage :: !CString
  , messageBoxDataNumButtons :: !CInt
  , messageBoxDataButtons :: !(Ptr MessageBoxButtonData)
  , messageBoxDataColorScheme :: !(Ptr MessageBoxColorScheme)
  } deriving (Eq, Show, Typeable)

instance Storable MessageBoxData where
  sizeOf _ = ((56))
{-# LINE 1242 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    flags <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1245 "src/SDL/Raw/Types.hsc" #-}
    window <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1246 "src/SDL/Raw/Types.hsc" #-}
    title <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 1247 "src/SDL/Raw/Types.hsc" #-}
    message <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 1248 "src/SDL/Raw/Types.hsc" #-}
    numbuttons <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 1249 "src/SDL/Raw/Types.hsc" #-}
    buttons <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 1250 "src/SDL/Raw/Types.hsc" #-}
    color_scheme <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr
{-# LINE 1251 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1254 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr window
{-# LINE 1255 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr title
{-# LINE 1256 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr message
{-# LINE 1257 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr numbuttons
{-# LINE 1258 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr buttons
{-# LINE 1259 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr color_scheme
{-# LINE 1260 "src/SDL/Raw/Types.hsc" #-}

data Palette = Palette
  { paletteNColors :: !CInt
  , paletteColors :: !(Ptr Color)
  } deriving (Eq, Show, Typeable)

instance Storable Palette where
  sizeOf _ = ((24))
{-# LINE 1268 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    ncolors <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1271 "src/SDL/Raw/Types.hsc" #-}
    colors <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1272 "src/SDL/Raw/Types.hsc" #-}
    return $! Palette ncolors colors
  poke ptr (Palette ncolors colors) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr ncolors
{-# LINE 1275 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr colors
{-# LINE 1276 "src/SDL/Raw/Types.hsc" #-}

data PixelFormat = PixelFormat
  { pixelFormatFormat :: !Word32
  , pixelFormatPalette :: !(Ptr Palette)
  , pixelFormatBitsPerPixel :: !Word8
  , pixelFormatBytesPerPixel :: !Word8
  , pixelFormatRMask :: !Word32
  , pixelFormatGMask :: !Word32
  , pixelFormatBMask :: !Word32
  , pixelFormatAMask :: !Word32
  } deriving (Eq, Show, Typeable)

instance Storable PixelFormat where
  sizeOf _ = ((56))
{-# LINE 1290 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    format <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1293 "src/SDL/Raw/Types.hsc" #-}
    palette <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1294 "src/SDL/Raw/Types.hsc" #-}
    bits_per_pixel <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 1295 "src/SDL/Raw/Types.hsc" #-}
    bytes_per_pixel <- ((\hsc_ptr -> peekByteOff hsc_ptr 17)) ptr
{-# LINE 1296 "src/SDL/Raw/Types.hsc" #-}
    rmask <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 1297 "src/SDL/Raw/Types.hsc" #-}
    gmask <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 1298 "src/SDL/Raw/Types.hsc" #-}
    bmask <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 1299 "src/SDL/Raw/Types.hsc" #-}
    amask <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 1300 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1303 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr palette
{-# LINE 1304 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr bits_per_pixel
{-# LINE 1305 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 17)) ptr bytes_per_pixel
{-# LINE 1306 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr rmask
{-# LINE 1307 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr gmask
{-# LINE 1308 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr bmask
{-# LINE 1309 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr amask
{-# LINE 1310 "src/SDL/Raw/Types.hsc" #-}

data Point = Point
  { pointX :: !CInt
  , pointY :: !CInt
  } deriving (Eq, Show, Typeable)

instance Storable Point where
  sizeOf _ = ((8))
{-# LINE 1318 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    x <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1321 "src/SDL/Raw/Types.hsc" #-}
    y <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 1322 "src/SDL/Raw/Types.hsc" #-}
    return $! Point x y
  poke ptr (Point x y) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr x
{-# LINE 1325 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr y
{-# LINE 1326 "src/SDL/Raw/Types.hsc" #-}

data Rect = Rect
  { rectX :: !CInt
  , rectY :: !CInt
  , rectW :: !CInt
  , rectH :: !CInt
  } deriving (Eq, Show, Typeable)

instance Storable Rect where
  sizeOf _ = ((16))
{-# LINE 1336 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    x <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1339 "src/SDL/Raw/Types.hsc" #-}
    y <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr
{-# LINE 1340 "src/SDL/Raw/Types.hsc" #-}
    w <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1341 "src/SDL/Raw/Types.hsc" #-}
    h <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 1342 "src/SDL/Raw/Types.hsc" #-}
    return $! Rect x y w h
  poke ptr (Rect x y w h) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr x
{-# LINE 1345 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr y
{-# LINE 1346 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr w
{-# LINE 1347 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr h
{-# LINE 1348 "src/SDL/Raw/Types.hsc" #-}

data RendererInfo = RendererInfo
  { rendererInfoName :: !CString
  , rendererInfoFlags :: !Word32
  , rendererInfoNumTextureFormats :: !Word32
  , rendererInfoTextureFormats :: ![Word32]
  , rendererInfoMaxTextureWidth :: !CInt
  , rendererInfoMaxTextureHeight :: !CInt
  } deriving (Eq, Show, Typeable)

instance Storable RendererInfo where
  sizeOf _ = ((88))
{-# LINE 1360 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    name <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1363 "src/SDL/Raw/Types.hsc" #-}
    flags <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1364 "src/SDL/Raw/Types.hsc" #-}
    num_texture_formats <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr
{-# LINE 1365 "src/SDL/Raw/Types.hsc" #-}
    texture_formats <- peekArray 16 $ ((\hsc_ptr -> hsc_ptr `plusPtr` 16)) ptr
{-# LINE 1366 "src/SDL/Raw/Types.hsc" #-}
    max_texture_width <- ((\hsc_ptr -> peekByteOff hsc_ptr 80)) ptr
{-# LINE 1367 "src/SDL/Raw/Types.hsc" #-}
    max_texture_height <- ((\hsc_ptr -> peekByteOff hsc_ptr 84)) ptr
{-# LINE 1368 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1371 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr flags
{-# LINE 1372 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr num_texture_formats
{-# LINE 1373 "src/SDL/Raw/Types.hsc" #-}
    pokeArray (((\hsc_ptr -> hsc_ptr `plusPtr` 16)) ptr) texture_formats
{-# LINE 1374 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 80)) ptr max_texture_width
{-# LINE 1375 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 84)) ptr max_texture_height
{-# LINE 1376 "src/SDL/Raw/Types.hsc" #-}

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, Typeable)

instance Storable RWops where
  sizeOf _ = ((72))
{-# LINE 1388 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    size <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1391 "src/SDL/Raw/Types.hsc" #-}
    seek <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1392 "src/SDL/Raw/Types.hsc" #-}
    read' <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 1393 "src/SDL/Raw/Types.hsc" #-}
    write <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 1394 "src/SDL/Raw/Types.hsc" #-}
    close <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 1395 "src/SDL/Raw/Types.hsc" #-}
    typ <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 1396 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1399 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr seek
{-# LINE 1400 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr read'
{-# LINE 1401 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr write
{-# LINE 1402 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr close
{-# LINE 1403 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr typ
{-# LINE 1404 "src/SDL/Raw/Types.hsc" #-}

data Surface = Surface
  { surfaceFormat :: !(Ptr PixelFormat)
  , surfaceW :: !CInt
  , surfaceH :: !CInt
  , surfacePixels :: !(Ptr ())
  , surfaceUserdata :: !(Ptr ())
  , surfaceClipRect :: !Rect
  , surfaceRefcount :: !CInt
  } deriving (Eq, Show, Typeable)

instance Storable Surface where
  sizeOf _ = ((96))
{-# LINE 1417 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    format <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 1420 "src/SDL/Raw/Types.hsc" #-}
    w <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 1421 "src/SDL/Raw/Types.hsc" #-}
    h <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 1422 "src/SDL/Raw/Types.hsc" #-}
    pixels <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 1423 "src/SDL/Raw/Types.hsc" #-}
    userdata <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr
{-# LINE 1424 "src/SDL/Raw/Types.hsc" #-}
    cliprect <- ((\hsc_ptr -> peekByteOff hsc_ptr 64)) ptr
{-# LINE 1425 "src/SDL/Raw/Types.hsc" #-}
    refcount <- ((\hsc_ptr -> peekByteOff hsc_ptr 88)) ptr
{-# LINE 1426 "src/SDL/Raw/Types.hsc" #-}
    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
{-# LINE 1429 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr w
{-# LINE 1430 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr h
{-# LINE 1431 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr pixels
{-# LINE 1432 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr userdata
{-# LINE 1433 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 64)) ptr cliprect
{-# LINE 1434 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 88)) ptr refcount
{-# LINE 1435 "src/SDL/Raw/Types.hsc" #-}

data Version = Version
  { versionMajor :: !Word8
  , versionMinor :: !Word8
  , versionPatch :: !Word8
  } deriving (Eq, Show, Typeable)

instance Storable Version where
  sizeOf _ = ((3))
{-# LINE 1444 "src/SDL/Raw/Types.hsc" #-}
  alignment = sizeOf
  peek ptr = do
    major <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 1447 "src/SDL/Raw/Types.hsc" #-}
    minor <- ((\hsc_ptr -> peekByteOff hsc_ptr 1)) ptr
{-# LINE 1448 "src/SDL/Raw/Types.hsc" #-}
    patch <- ((\hsc_ptr -> peekByteOff hsc_ptr 2)) ptr
{-# LINE 1449 "src/SDL/Raw/Types.hsc" #-}
    return $! Version major minor patch
  poke ptr (Version major minor patch) = do
    ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr major
{-# LINE 1452 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 1)) ptr minor
{-# LINE 1453 "src/SDL/Raw/Types.hsc" #-}
    ((\hsc_ptr -> pokeByteOff hsc_ptr 2)) ptr patch
{-# LINE 1454 "src/SDL/Raw/Types.hsc" #-}