packages feed

sdl2 2.3.0.1 → 2.4.0

raw patch · 45 files changed

+12917/−12885 lines, 45 filesdep ~exceptionssetup-changed

Dependency ranges changed: exceptions

Files

ChangeLog.md view
@@ -1,216 +1,220 @@-Unreleased
-==========
-
-
-
-2.3.0
-=====
-
-* Windows builds now use `-D_SDL_main_h`. See https://github.com/haskell-game/sdl2/issues/139 for more discussion.
-* Some basic support for game controller events have been added. See `SDL.Input.GameController` and changes to `ControllerDeviceEventData`.
-* Support for event watching: `addEventWatch` and `delEventWatch`.
-* High-level bindings now distinguish between finger down / motion / up.
-  See `SDL.Event.TouchFingerEvent` and `SDL.Event.TouchFingerMotionEvent`.
-* Several event payloads now have their `Window` fields modified to use `Maybe Window`, substituting `Nothing` for null pointers.
-* High-level structure for controller button state: `ControllerButtonState`.
-* High-level structure for controller buttons: `ControllerButton`.
-* High-level structure for controller connection: `ControllerDeviceConnection`.
-* High-level structure for joystick device connection: `JoyDeviceConnection`.
-* High-level structure for joystick button state: `JoyButtonState`.
-* Support for user defined events: `registerEvent`, `pushRegisteredEvent`, and `getRegisteredEvent`.
-* Initial window visibility can be specified in `WindowConfig` for `createWindow` function.
-* `WarpMouseOrigin` is now fully exported and can warp to global coordinates.
-* It's possible to retrieve palette information with `paletteNColors`, `paletteColors` and `palletColor`.
-
-
-2.2.0
-=====
-
-* Version 2.0.4 of the SDL2 C library is now required:
-  * `SDL.Event`:
-    * Add `AudioDeviceEvent` constructor to `Event`
-    * Add `KeymapChangedEvent` constructor to `EventPayload`
-    * Add `mouseWheelEventDirection` field to `MouseWheelEventData`
-  * `SDL.Input.Mouse`:
-    * Add `MouseScrollDirection` enumeration
-  * `SDL.Raw.Audio`:
-    * Add `clearQueuedAudio` function
-    * Add `getQueuedAudioSize` function
-    * Add `queueAudio` function
-  * `SDL.Raw.Enum`:
-    * Add `SDL_GL_CONTEXT_RELEASE_BEHAVIOR` pattern synonym
-    * Add `JoystickPowerLevel` pattern synonyms
-    * Add `SDL_MOUSEWHEEL_NORMAL` and `SDL_MOUSEWHEEL_FLIPPED` pattern synonyms
-    * Add `SDL_KEYMAPCHANGED`, `SDL_AUDIODEVICEADDED`, `SDL_AUDIODEVICEREMOVED`,
-      `SDL_RENDER_TARGETS_RESET`, and `SDL_RENDER_DEVICE_RESET` pattern synonyms
-    * Add `SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE` and
-      `SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH` pattern synonyms
-    * Add `SDL_WINDOW_MOUSE_CAPTURE` pattern synonym
-  * `SDL.Raw.Event`:
-    * Add `captureMouse` function
-    * Add `getGlobalMouseState` function
-    * Add `warpMouseGlobal` function
-    * Add `joystickCurrentPowerLevel` function
-    * Add `joystickFromInstanceID` function
-    * Add `gameControllerFromInstanceID` function
-  * `SDL.Raw.Event`:
-    * Add `AudioDeviceEvent` constructor to `Event`
-    * Add `KeymapChangedEvent` constructor to `Event`
-    * Add `mouseWheelEventDirection` field to `MouseMotionEvent` constructor
-
-* Add `SDL.Exception` module, exposing `SDLException`
-* Add new function, `createSoftwareRenderer`, to render onto a surface
-* Add joystick POV hat support
-* Remove deprecated functionality:
-  * `InitEverything` enumeration in `SDL.Init`
-  * `mapRGB` in `SDL.Video.Renderer`
-  * `setRelativeMouseMode` in `SDL.Input.Mouse`
-  * `getRelativeMouseMode` in `SDL.Input.Mouse`
-  * `getMouseLocation` in `SDL.Input.Mouse`
-* Remove `ClipboardUpdateEventData`
-* Merge `isScreenSaverEnabled`, `enableScreenSaver`, and `disableScreenSaver`
-  into a `screenSaverEnabled` StateVar.
-* Make function `surfaceBlit` in `SDL.Video.Renderer` return final blit
-  rectangle post-clipping.
-* Make all fields in EventData constructors strict
-* Fix issue with `setWindowMode` transitions not working properly between
-  fullscreen and windowed modes.
-
-2.1.3.1
-=======
-
-* Raise upper bounds for `vector` to <0.13
-
-2.1.3
-=====
-
-* Cabal flag `no-linear` removes dependency on `linear` (and thus, transiently,
-  `lens`). See `SDL.Vect` for details.
-* Remove 'lens' dependency from all examples.
-* Add Cabal flag `opengl-example` to separate that target from `examples`,
-  because it is now the only example with an extra dependency (OpenGL).
-* Make `hlint` happy with examples.
-* Add `updateTexture` wrapper for native `SDL_UpdateTexture`.
-* Expose `glGetDrawableSize` (can differ from window size in some environments).
-* Correct `hintToString` output to match SDL hint tokens, rather than the names
-  of the CPP macros defining them.
-* Removed `ghc-options: -Wall` until we drop support for GHC 7.8. (>1300 warnings!)
-* Various documentation updates.
-
-2.1.2.1
-=======
-
-* Raise upper bounds for `lens` to <4.15 (affects examples only)
-
-2.1.2
-=====
-
-* Revise some documentation examples to be more idomatic
-* Update `.gitignore` to cover `stack` and other tools
-* Raise upper bounds for `transformers` to <0.6
-* Lower required SDL2 version to 2.0.2.
-* Fix decoding of `TextEditingEvent` where the Raw bindings failed to stop reading
-  character data past the null terminator.
-
-2.1.1
-=====
-
-* `SDL.Input.Mouse` new has a new API for fetching the location of the mouse. This
-  API gives you greater control over finding the mouse position with respect to the
-  various "modes" a mouse can be in. The old API still exists, but will be removed
-  at some point in the future.
-* `SDL.Raw` now has a binding to `SDL_free`.
-
-2.1.0
-=====
-
-* Introduce `initializeAll` and deprecate `InitEverything`. To fix this deprecation
-  warning, change `initialize [InitEverything]` to `initializeAll`.
-* `surfaceColorKey`, `surfaceFillRect` and `surfaceFillRects` now all operate on
-  on RGBA `V4 Word8` values. They all implicitly map and unmap (using `SDL_MapRGBA`
-  and `SDL_GetRGBA` respectively).
-* `SDL.mapRGB` is now deprecated, as this conversion is always done for you.
-  If you still need this routine, use `SDL.Raw.mapRGB`.
-* Fix a runtime crash when reading the current BlendMode of a texture. Thanks to
-  @seppeljordan for discovering and fixing this bug.
-
-2.0.0
-=====
-* Introduce a set of comprehensive high-level bindings to SDL. These bindings
-  should allow users to work with SDL while writing idiomatic Haskell code. They
-  take care of pointer manipulation, and wrap up values in much more "natural"
-  data types. The high-level bindings live in the `SDL` namespace, and have been
-  extensively documented.
-* Raw bindings have been moved from `Graphics.UI.SDL` to `SDL.Raw`.
-
-
-1.3.1
-=====
-* Correct type signature of `getSurfaceBlendMode`
-
-1.3.0
-=====
-* Use pattern synonyms exclusively
-  * `Graphics.UI.SDL.Enum.Pattern` overrides `Graphics.UI.SDL.Enum`
-* Generalize all IO functions over MonadIO
-* Add convenience wrapper functions for constructing FunPtr callbacks
-* Add Typeable instances to all type classes
-* Add strictness annotations to all data structure fields
-* Add missing `SDLK_AUDIOPREV` enumeration
-* Correct deserialization of `SDL_TEXTINPUT` event
-  * Data beyond the null terminator was returned previously
-
-1.2.0
-=====
-* Add support for pattern synonyms as an alternative for SDL enumerations
-  * Only present when compiling with GHC 7.8 or newer
-* Add missing enumerations:
-  * `keymodShift`, `keymodCtrl`, `keymodAlt`, `keymodGUI`
-  * `keyPressend`, `keyReleased`
-  * `toucheMouseID`
-* Specialize init flags over `InitFlag`, a `Word32`
-* Generalize `keymod*` enumerations over `Num`
-  * The C API is inconsistent on their types
-* Fix foreign imports on `Graphics.UI.SDL.Thread`
-* Correct type signature of `getRenderDrawBlendMode`
-* Correct type signature of `queryTexture`
-* Remove export of `Keycode` from `Graphics.UI.SDL.Types`
-  * `Graphics.UI.SDL.Enum` already exports `Keycode`
-
-1.1.3
-=====
-* Add missing `Keycode` enumerations
-* Add missing enumerations:
-  * `audioAllowFrequencyChange`, `audioAllowFormatChange`
-  * `audioAllowChannelsChange`, `audioAllowAnyChange`
-
-1.1.2
-=====
-* Add `ClipboardUpdateEvent` to `Event` data structure
-* Add `UnknownEvent` to `Event` data structure
-
-1.1.1
-=====
-* Add `Graphics.UI.SDL.Platform` module
-* Add `Graphics.UI.SDL.Thread` module and associated types and enumerations
-* Add `getWindowWMInfo`
-* Add `setError`
-* Add additional logging functions
-
-1.1.0
-=====
-* Require SDL 2.0.3
-  * Add `gameControllerAddMappingsFromFile`
-  * Add `gameControllerAddMappingsFromRW`
-  * Add `glResetAttributes`
-  * Add `mouseButtonEventClicks` field to `WindowEvent`
-* Add missing mouse button enumerations
-
-1.0.2
-=====
-* Correct type signature of `getNumTouchFingers`
-
-1.0.1
-=====
-* Factor type of `addHintCallback` and `delHintCallback` into `HintCallback`
-* Add `Version` data structure
+2.4.0+=====+* `getRelativeMouseLocation` now returns `Vector` instead of `Point`.+* `getModalMouseLocation` returns either a `Vector` or a `Point`, wrapped in (new) `ModalLocation`.+* `WindowSizeChangedEventData` includes the new window size.+* Added an invalid state to the `ControllerButtonState` enum, and switched to a more reliable state detection method.+* Raise upper bounds for `exceptions` to <0.10+++2.3.0+=====++* Windows builds now use `-D_SDL_main_h`. See https://github.com/haskell-game/sdl2/issues/139 for more discussion.+* Some basic support for game controller events have been added. See `SDL.Input.GameController` and changes to `ControllerDeviceEventData`.+* Support for event watching: `addEventWatch` and `delEventWatch`.+* High-level bindings now distinguish between finger down / motion / up.+  See `SDL.Event.TouchFingerEvent` and `SDL.Event.TouchFingerMotionEvent`.+* Several event payloads now have their `Window` fields modified to use `Maybe Window`, substituting `Nothing` for null pointers.+* High-level structure for controller button state: `ControllerButtonState`.+* High-level structure for controller buttons: `ControllerButton`.+* High-level structure for controller connection: `ControllerDeviceConnection`.+* High-level structure for joystick device connection: `JoyDeviceConnection`.+* High-level structure for joystick button state: `JoyButtonState`.+* Support for user defined events: `registerEvent`, `pushRegisteredEvent`, and `getRegisteredEvent`.+* Initial window visibility can be specified in `WindowConfig` for `createWindow` function.+* `WarpMouseOrigin` is now fully exported and can warp to global coordinates.+* It's possible to retrieve palette information with `paletteNColors`, `paletteColors` and `palletColor`.+++2.2.0+=====++* Version 2.0.4 of the SDL2 C library is now required:+  * `SDL.Event`:+    * Add `AudioDeviceEvent` constructor to `Event`+    * Add `KeymapChangedEvent` constructor to `EventPayload`+    * Add `mouseWheelEventDirection` field to `MouseWheelEventData`+  * `SDL.Input.Mouse`:+    * Add `MouseScrollDirection` enumeration+  * `SDL.Raw.Audio`:+    * Add `clearQueuedAudio` function+    * Add `getQueuedAudioSize` function+    * Add `queueAudio` function+  * `SDL.Raw.Enum`:+    * Add `SDL_GL_CONTEXT_RELEASE_BEHAVIOR` pattern synonym+    * Add `JoystickPowerLevel` pattern synonyms+    * Add `SDL_MOUSEWHEEL_NORMAL` and `SDL_MOUSEWHEEL_FLIPPED` pattern synonyms+    * Add `SDL_KEYMAPCHANGED`, `SDL_AUDIODEVICEADDED`, `SDL_AUDIODEVICEREMOVED`,+      `SDL_RENDER_TARGETS_RESET`, and `SDL_RENDER_DEVICE_RESET` pattern synonyms+    * Add `SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE` and+      `SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH` pattern synonyms+    * Add `SDL_WINDOW_MOUSE_CAPTURE` pattern synonym+  * `SDL.Raw.Event`:+    * Add `captureMouse` function+    * Add `getGlobalMouseState` function+    * Add `warpMouseGlobal` function+    * Add `joystickCurrentPowerLevel` function+    * Add `joystickFromInstanceID` function+    * Add `gameControllerFromInstanceID` function+  * `SDL.Raw.Event`:+    * Add `AudioDeviceEvent` constructor to `Event`+    * Add `KeymapChangedEvent` constructor to `Event`+    * Add `mouseWheelEventDirection` field to `MouseMotionEvent` constructor++* Add `SDL.Exception` module, exposing `SDLException`+* Add new function, `createSoftwareRenderer`, to render onto a surface+* Add joystick POV hat support+* Remove deprecated functionality:+  * `InitEverything` enumeration in `SDL.Init`+  * `mapRGB` in `SDL.Video.Renderer`+  * `setRelativeMouseMode` in `SDL.Input.Mouse`+  * `getRelativeMouseMode` in `SDL.Input.Mouse`+  * `getMouseLocation` in `SDL.Input.Mouse`+* Remove `ClipboardUpdateEventData`+* Merge `isScreenSaverEnabled`, `enableScreenSaver`, and `disableScreenSaver`+  into a `screenSaverEnabled` StateVar.+* Make function `surfaceBlit` in `SDL.Video.Renderer` return final blit+  rectangle post-clipping.+* Make all fields in EventData constructors strict+* Fix issue with `setWindowMode` transitions not working properly between+  fullscreen and windowed modes.++2.1.3.1+=======++* Raise upper bounds for `vector` to <0.13++2.1.3+=====++* Cabal flag `no-linear` removes dependency on `linear` (and thus, transiently,+  `lens`). See `SDL.Vect` for details.+* Remove 'lens' dependency from all examples.+* Add Cabal flag `opengl-example` to separate that target from `examples`,+  because it is now the only example with an extra dependency (OpenGL).+* Make `hlint` happy with examples.+* Add `updateTexture` wrapper for native `SDL_UpdateTexture`.+* Expose `glGetDrawableSize` (can differ from window size in some environments).+* Correct `hintToString` output to match SDL hint tokens, rather than the names+  of the CPP macros defining them.+* Removed `ghc-options: -Wall` until we drop support for GHC 7.8. (>1300 warnings!)+* Various documentation updates.++2.1.2.1+=======++* Raise upper bounds for `lens` to <4.15 (affects examples only)++2.1.2+=====++* Revise some documentation examples to be more idomatic+* Update `.gitignore` to cover `stack` and other tools+* Raise upper bounds for `transformers` to <0.6+* Lower required SDL2 version to 2.0.2.+* Fix decoding of `TextEditingEvent` where the Raw bindings failed to stop reading+  character data past the null terminator.++2.1.1+=====++* `SDL.Input.Mouse` new has a new API for fetching the location of the mouse. This+  API gives you greater control over finding the mouse position with respect to the+  various "modes" a mouse can be in. The old API still exists, but will be removed+  at some point in the future.+* `SDL.Raw` now has a binding to `SDL_free`.++2.1.0+=====++* Introduce `initializeAll` and deprecate `InitEverything`. To fix this deprecation+  warning, change `initialize [InitEverything]` to `initializeAll`.+* `surfaceColorKey`, `surfaceFillRect` and `surfaceFillRects` now all operate on+  on RGBA `V4 Word8` values. They all implicitly map and unmap (using `SDL_MapRGBA`+  and `SDL_GetRGBA` respectively).+* `SDL.mapRGB` is now deprecated, as this conversion is always done for you.+  If you still need this routine, use `SDL.Raw.mapRGB`.+* Fix a runtime crash when reading the current BlendMode of a texture. Thanks to+  @seppeljordan for discovering and fixing this bug.++2.0.0+=====+* Introduce a set of comprehensive high-level bindings to SDL. These bindings+  should allow users to work with SDL while writing idiomatic Haskell code. They+  take care of pointer manipulation, and wrap up values in much more "natural"+  data types. The high-level bindings live in the `SDL` namespace, and have been+  extensively documented.+* Raw bindings have been moved from `Graphics.UI.SDL` to `SDL.Raw`.+++1.3.1+=====+* Correct type signature of `getSurfaceBlendMode`++1.3.0+=====+* Use pattern synonyms exclusively+  * `Graphics.UI.SDL.Enum.Pattern` overrides `Graphics.UI.SDL.Enum`+* Generalize all IO functions over MonadIO+* Add convenience wrapper functions for constructing FunPtr callbacks+* Add Typeable instances to all type classes+* Add strictness annotations to all data structure fields+* Add missing `SDLK_AUDIOPREV` enumeration+* Correct deserialization of `SDL_TEXTINPUT` event+  * Data beyond the null terminator was returned previously++1.2.0+=====+* Add support for pattern synonyms as an alternative for SDL enumerations+  * Only present when compiling with GHC 7.8 or newer+* Add missing enumerations:+  * `keymodShift`, `keymodCtrl`, `keymodAlt`, `keymodGUI`+  * `keyPressend`, `keyReleased`+  * `toucheMouseID`+* Specialize init flags over `InitFlag`, a `Word32`+* Generalize `keymod*` enumerations over `Num`+  * The C API is inconsistent on their types+* Fix foreign imports on `Graphics.UI.SDL.Thread`+* Correct type signature of `getRenderDrawBlendMode`+* Correct type signature of `queryTexture`+* Remove export of `Keycode` from `Graphics.UI.SDL.Types`+  * `Graphics.UI.SDL.Enum` already exports `Keycode`++1.1.3+=====+* Add missing `Keycode` enumerations+* Add missing enumerations:+  * `audioAllowFrequencyChange`, `audioAllowFormatChange`+  * `audioAllowChannelsChange`, `audioAllowAnyChange`++1.1.2+=====+* Add `ClipboardUpdateEvent` to `Event` data structure+* Add `UnknownEvent` to `Event` data structure++1.1.1+=====+* Add `Graphics.UI.SDL.Platform` module+* Add `Graphics.UI.SDL.Thread` module and associated types and enumerations+* Add `getWindowWMInfo`+* Add `setError`+* Add additional logging functions++1.1.0+=====+* Require SDL 2.0.3+  * Add `gameControllerAddMappingsFromFile`+  * Add `gameControllerAddMappingsFromRW`+  * Add `glResetAttributes`+  * Add `mouseButtonEventClicks` field to `WindowEvent`+* Add missing mouse button enumerations++1.0.2+=====+* Correct type signature of `getNumTouchFingers`++1.0.1+=====+* Factor type of `addHintCallback` and `delHintCallback` into `HintCallback`+* Add `Version` data structure
LICENSE view
@@ -1,30 +1,30 @@-Copyright (c) 2013-2017  Gabríel Arthúr Pétursson
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-
-    * Neither the name of Gabríel Arthúr Pétursson nor the names of other
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Copyright (c) 2013-2017  Gabríel Arthúr Pétursson++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Gabríel Arthúr Pétursson nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple
-main = defaultMain
+import Distribution.Simple+main = defaultMain
cbits/sdlhelper.c view
@@ -1,77 +1,77 @@-#include <string.h>
-#include "sdlhelper.h"
-
-void SDLHelper_JoystickGetDeviceGUID (int device_index, SDL_JoystickGUID *guid)
-{
-  SDL_JoystickGUID t = SDL_JoystickGetDeviceGUID (device_index);
-  memcpy (guid, &t, sizeof (*guid));
-}
-
-void SDLHelper_JoystickGetGUID (SDL_Joystick *joystick, SDL_JoystickGUID *guid)
-{
-  SDL_JoystickGUID t = SDL_JoystickGetGUID (joystick);
-  memcpy (guid, &t, sizeof (*guid));
-}
-
-void SDLHelper_JoystickGetGUIDFromString (const char *pchGUID, SDL_JoystickGUID *guid)
-{
-  SDL_JoystickGUID t = SDL_JoystickGetGUIDFromString (pchGUID);
-  memcpy (guid, &t, sizeof (*guid));
-}
-
-void SDLHelper_JoystickGetGUIDString (const SDL_JoystickGUID *guid, char *gszGUID, int cbGUID)
-{
-  SDL_JoystickGetGUIDString (*guid, gszGUID, cbGUID);
-}
-
-void SDLHelper_GameControllerGetBindForAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis, SDL_GameControllerButtonBind *bind)
-{
-  SDL_GameControllerButtonBind t = SDL_GameControllerGetBindForAxis (gamecontroller, axis);
-  memcpy (bind, &t, sizeof (*bind));
-}
-
-void SDLHelper_GameControllerGetBindForButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button, SDL_GameControllerButtonBind *bind)
-{
-  SDL_GameControllerButtonBind t = SDL_GameControllerGetBindForButton (gamecontroller, button);
-  memcpy (bind, &t, sizeof (*bind));
-}
-
-char *SDLHelper_GameControllerMappingForGUID (const SDL_JoystickGUID *guid)
-{
-  return SDL_GameControllerMappingForGUID (*guid);
-}
-
-void SDLHelper_LogMessage (int category, SDL_LogPriority priority, const char *str)
-{
-  SDL_LogMessage (category, priority, "%s", str);
-}
-
-int SDLHelper_RWclose (SDL_RWops *ctx)
-{
-  return SDL_RWclose (ctx);
-}
-
-size_t SDLHelper_RWread (SDL_RWops *ctx, void *ptr, size_t size, size_t maxnum)
-{
-  return SDL_RWread (ctx, ptr, size, maxnum);
-}
-
-Sint64 SDLHelper_RWseek (SDL_RWops *ctx, Sint64 offset, int whence)
-{
-  return SDL_RWseek (ctx, offset, whence);
-}
-
-Sint64 SDLHelper_RWtell (SDL_RWops *ctx)
-{
-  return SDL_RWtell (ctx);
-}
-
-size_t SDLHelper_RWwrite (SDL_RWops *ctx, const void *ptr, size_t size, size_t num)
-{
-  return SDL_RWwrite (ctx, ptr, size, num);
-}
-
-int SDLHelper_SetError (const char *str)
-{
-  return SDL_SetError ("%s", str);
-}
+#include <string.h>+#include "sdlhelper.h"++void SDLHelper_JoystickGetDeviceGUID (int device_index, SDL_JoystickGUID *guid)+{+  SDL_JoystickGUID t = SDL_JoystickGetDeviceGUID (device_index);+  memcpy (guid, &t, sizeof (*guid));+}++void SDLHelper_JoystickGetGUID (SDL_Joystick *joystick, SDL_JoystickGUID *guid)+{+  SDL_JoystickGUID t = SDL_JoystickGetGUID (joystick);+  memcpy (guid, &t, sizeof (*guid));+}++void SDLHelper_JoystickGetGUIDFromString (const char *pchGUID, SDL_JoystickGUID *guid)+{+  SDL_JoystickGUID t = SDL_JoystickGetGUIDFromString (pchGUID);+  memcpy (guid, &t, sizeof (*guid));+}++void SDLHelper_JoystickGetGUIDString (const SDL_JoystickGUID *guid, char *gszGUID, int cbGUID)+{+  SDL_JoystickGetGUIDString (*guid, gszGUID, cbGUID);+}++void SDLHelper_GameControllerGetBindForAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis, SDL_GameControllerButtonBind *bind)+{+  SDL_GameControllerButtonBind t = SDL_GameControllerGetBindForAxis (gamecontroller, axis);+  memcpy (bind, &t, sizeof (*bind));+}++void SDLHelper_GameControllerGetBindForButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button, SDL_GameControllerButtonBind *bind)+{+  SDL_GameControllerButtonBind t = SDL_GameControllerGetBindForButton (gamecontroller, button);+  memcpy (bind, &t, sizeof (*bind));+}++char *SDLHelper_GameControllerMappingForGUID (const SDL_JoystickGUID *guid)+{+  return SDL_GameControllerMappingForGUID (*guid);+}++void SDLHelper_LogMessage (int category, SDL_LogPriority priority, const char *str)+{+  SDL_LogMessage (category, priority, "%s", str);+}++int SDLHelper_RWclose (SDL_RWops *ctx)+{+  return SDL_RWclose (ctx);+}++size_t SDLHelper_RWread (SDL_RWops *ctx, void *ptr, size_t size, size_t maxnum)+{+  return SDL_RWread (ctx, ptr, size, maxnum);+}++Sint64 SDLHelper_RWseek (SDL_RWops *ctx, Sint64 offset, int whence)+{+  return SDL_RWseek (ctx, offset, whence);+}++Sint64 SDLHelper_RWtell (SDL_RWops *ctx)+{+  return SDL_RWtell (ctx);+}++size_t SDLHelper_RWwrite (SDL_RWops *ctx, const void *ptr, size_t size, size_t num)+{+  return SDL_RWwrite (ctx, ptr, size, num);+}++int SDLHelper_SetError (const char *str)+{+  return SDL_SetError ("%s", str);+}
examples/AudioExample.hs view
@@ -1,50 +1,50 @@-{-# LANGUAGE GADTs #-}
-
-module AudioExample where
-
-import Data.IORef
-import Control.Monad
-import Control.Concurrent
-import Data.Int (Int16, Int32)
-import SDL
-import qualified Data.Vector.Storable.Mutable as V
-
-sinSamples :: [Int16]
-sinSamples =
-  map (\n ->
-         let t = fromIntegral n / 48000 :: Double
-             freq = 440 * 4
-         in round (fromIntegral (maxBound `div` 2 :: Int16) * sin (t * freq)))
-      [0 :: Int32 ..]
-
-audioCB :: IORef [Int16] -> AudioFormat sampleType -> V.IOVector sampleType -> IO ()
-audioCB samples format buffer =
-  case format of
-    Signed16BitLEAudio ->
-      do samples' <- readIORef samples
-         let n = V.length buffer
-         zipWithM_ (V.write buffer)
-                   [0 ..]
-                   (take n samples')
-         writeIORef samples
-                    (drop n samples')
-    _ -> error "Unsupported audio format"
-
-main :: IO ()
-main =
-  do initializeAll
-     samples <- newIORef sinSamples
-     (device,_) <-
-       openAudioDevice
-         OpenDeviceSpec {SDL.openDeviceFreq =
-                           Mandate 48000
-                        ,SDL.openDeviceFormat =
-                           Mandate Signed16BitNativeAudio
-                        ,SDL.openDeviceChannels =
-                           Mandate Mono
-                        ,SDL.openDeviceSamples = 4096 * 2
-                        ,SDL.openDeviceCallback = audioCB samples
-                        ,SDL.openDeviceUsage = ForPlayback
-                        ,SDL.openDeviceName = Nothing}
-     setAudioDevicePlaybackState device Play
-     forever (threadDelay maxBound)
+{-# LANGUAGE GADTs #-}++module AudioExample where++import Data.IORef+import Control.Monad+import Control.Concurrent+import Data.Int (Int16, Int32)+import SDL+import qualified Data.Vector.Storable.Mutable as V++sinSamples :: [Int16]+sinSamples =+  map (\n ->+         let t = fromIntegral n / 48000 :: Double+             freq = 440 * 4+         in round (fromIntegral (maxBound `div` 2 :: Int16) * sin (t * freq)))+      [0 :: Int32 ..]++audioCB :: IORef [Int16] -> AudioFormat sampleType -> V.IOVector sampleType -> IO ()+audioCB samples format buffer =+  case format of+    Signed16BitLEAudio ->+      do samples' <- readIORef samples+         let n = V.length buffer+         zipWithM_ (V.write buffer)+                   [0 ..]+                   (take n samples')+         writeIORef samples+                    (drop n samples')+    _ -> error "Unsupported audio format"++main :: IO ()+main =+  do initializeAll+     samples <- newIORef sinSamples+     (device,_) <-+       openAudioDevice+         OpenDeviceSpec {SDL.openDeviceFreq =+                           Mandate 48000+                        ,SDL.openDeviceFormat =+                           Mandate Signed16BitNativeAudio+                        ,SDL.openDeviceChannels =+                           Mandate Mono+                        ,SDL.openDeviceSamples = 4096 * 2+                        ,SDL.openDeviceCallback = audioCB samples+                        ,SDL.openDeviceUsage = ForPlayback+                        ,SDL.openDeviceName = Nothing}+     setAudioDevicePlaybackState device Play+     forever (threadDelay maxBound)
examples/EventWatch.hs view
@@ -1,52 +1,52 @@-{-# LANGUAGE OverloadedStrings #-}
-
-{-|
-
-The following example shows how setting a watch for the WindowSizeChangedEvent
-allows us to handle the events as they are generated. Handling them in the
-event loop, on the other hand, only allows us to see a final, coalesced, event.
-
-To demonstrate this, run the program, resize the window with your mouse,
-and check your console output.
-
--}
-module EventWatch where
-
-import SDL
-
-main :: IO ()
-main = do
-  initializeAll
-  window <- createWindow "resize" WindowConfig {
-      windowBorder       = True
-    , windowHighDPI      = False
-    , windowInputGrabbed = False
-    , windowMode         = Windowed
-    , windowOpenGL       = Nothing
-    , windowPosition     = Wherever
-    , windowResizable    = True
-    , windowInitialSize  = V2 800 600
-    , windowVisible      = True
-  }
-  renderer <- createRenderer window (-1) defaultRenderer
-  addEventWatch $ \ev ->
-    case eventPayload ev of
-      WindowSizeChangedEvent sizeChangeData ->
-        putStrLn $ "eventWatch windowSizeChanged: " ++ show sizeChangeData
-      _ -> return ()
-  appLoop
-
-appLoop :: IO ()
-appLoop = waitEvent >>= go
-  where
-  go :: Event -> IO ()
-  go ev =
-    case eventPayload ev of
-      WindowSizeChangedEvent sizeChangeData -> do
-        putStrLn $ "waitEvent windowSizeChanged: " ++ show sizeChangeData
-        waitEvent >>= go
-      KeyboardEvent keyboardEvent
-        |  keyboardEventKeyMotion keyboardEvent == Pressed &&
-           keysymKeycode (keyboardEventKeysym keyboardEvent) == KeycodeQ
-        -> return ()
-      _ -> waitEvent >>= go
+{-# LANGUAGE OverloadedStrings #-}++{-|++The following example shows how setting a watch for the WindowSizeChangedEvent+allows us to handle the events as they are generated. Handling them in the+event loop, on the other hand, only allows us to see a final, coalesced, event.++To demonstrate this, run the program, resize the window with your mouse,+and check your console output.++-}+module EventWatch where++import SDL++main :: IO ()+main = do+  initializeAll+  window <- createWindow "resize" WindowConfig {+      windowBorder       = True+    , windowHighDPI      = False+    , windowInputGrabbed = False+    , windowMode         = Windowed+    , windowOpenGL       = Nothing+    , windowPosition     = Wherever+    , windowResizable    = True+    , windowInitialSize  = V2 800 600+    , windowVisible      = True+  }+  renderer <- createRenderer window (-1) defaultRenderer+  addEventWatch $ \ev ->+    case eventPayload ev of+      WindowSizeChangedEvent sizeChangeData ->+        putStrLn $ "eventWatch windowSizeChanged: " ++ show sizeChangeData+      _ -> return ()+  appLoop++appLoop :: IO ()+appLoop = waitEvent >>= go+  where+  go :: Event -> IO ()+  go ev =+    case eventPayload ev of+      WindowSizeChangedEvent sizeChangeData -> do+        putStrLn $ "waitEvent windowSizeChanged: " ++ show sizeChangeData+        waitEvent >>= go+      KeyboardEvent keyboardEvent+        |  keyboardEventKeyMotion keyboardEvent == Pressed &&+           keysymKeycode (keyboardEventKeysym keyboardEvent) == KeycodeQ+        -> return ()+      _ -> waitEvent >>= go
examples/UserEvents.hs view
@@ -1,64 +1,64 @@-module UserEvents where
-
-import Control.Concurrent (myThreadId)
-import Data.Maybe (Maybe(Nothing))
-import Data.Word (Word32)
-import qualified Data.Text as Text
-import Foreign.Ptr (nullPtr)
-import SDL
-
--- | A timer event with timestamp
-data TimerEvent = TimerEvent Word32
-
-timerEvent :: IO TimerEvent
-timerEvent = do
-  t <- show <$> ticks
-  tid <- show <$> myThreadId
-  putStrLn $ "Created timer event at " ++ t ++ " ticks. Threadid: " ++ tid
-  return $ TimerEvent 0
-
-main :: IO ()
-main = do
-  initializeAll
-  let toTimerEvent _ = return . Just . TimerEvent
-      fromTimerEvent = const $ return emptyRegisteredEvent
-  registeredEvent <- registerEvent toTimerEvent fromTimerEvent
-  case registeredEvent of
-    Nothing -> putStrLn "Fatal error: unable to register timer events."
-    Just registeredTimerEvent -> do
-      addTimer 1000 $ mkTimerCb registeredTimerEvent
-      putStrLn "press q at any time to quit"
-      appLoop registeredTimerEvent
-
-mkTimerCb :: RegisteredEventType TimerEvent -> TimerCallback
-mkTimerCb (RegisteredEventType pushTimerEvent _) interval = do
-  pushResult <- pushTimerEvent =<< timerEvent
-  case pushResult of
-    EventPushSuccess -> return ()
-    EventPushFiltered -> putStrLn "event push was filtered: this is impossible"
-    EventPushFailure e -> putStrLn $ "Couldn't push event: " ++ Text.unpack e
-  return $ Reschedule interval
-
-appLoop :: RegisteredEventType TimerEvent -> IO ()
-appLoop (RegisteredEventType pushTimerEvent getTimerEvent) = waitEvent >>= go
-  where
-  go :: Event -> IO ()
-  go ev =
-    case eventPayload ev of
-      -- Press Q to quit
-      KeyboardEvent keyboardEvent
-        |  keyboardEventKeyMotion keyboardEvent == Pressed &&
-           keysymKeycode (keyboardEventKeysym keyboardEvent) == KeycodeQ
-        -> return ()
-      UserEvent _ -> do
-        maybeTimerEvent <- getTimerEvent ev
-        case maybeTimerEvent of
-          Just (TimerEvent ts) -> do
-             t <- show <$> ticks
-             tid <- show <$> myThreadId
-             putStrLn $ "Got timer event from queue at " ++ t ++ " ticks."
-             putStrLn $ "Timestamp: " ++ show ts
-             putStrLn $ "Threadid: " ++ tid
-          Nothing -> return ()
-        waitEvent >>= go
-      _ -> waitEvent >>= go
+module UserEvents where++import Control.Concurrent (myThreadId)+import Data.Maybe (Maybe(Nothing))+import Data.Word (Word32)+import qualified Data.Text as Text+import Foreign.Ptr (nullPtr)+import SDL++-- | A timer event with timestamp+data TimerEvent = TimerEvent Word32++timerEvent :: IO TimerEvent+timerEvent = do+  t <- show <$> ticks+  tid <- show <$> myThreadId+  putStrLn $ "Created timer event at " ++ t ++ " ticks. Threadid: " ++ tid+  return $ TimerEvent 0++main :: IO ()+main = do+  initializeAll+  let toTimerEvent _ = return . Just . TimerEvent+      fromTimerEvent = const $ return emptyRegisteredEvent+  registeredEvent <- registerEvent toTimerEvent fromTimerEvent+  case registeredEvent of+    Nothing -> putStrLn "Fatal error: unable to register timer events."+    Just registeredTimerEvent -> do+      addTimer 1000 $ mkTimerCb registeredTimerEvent+      putStrLn "press q at any time to quit"+      appLoop registeredTimerEvent++mkTimerCb :: RegisteredEventType TimerEvent -> TimerCallback+mkTimerCb (RegisteredEventType pushTimerEvent _) interval = do+  pushResult <- pushTimerEvent =<< timerEvent+  case pushResult of+    EventPushSuccess -> return ()+    EventPushFiltered -> putStrLn "event push was filtered: this is impossible"+    EventPushFailure e -> putStrLn $ "Couldn't push event: " ++ Text.unpack e+  return $ Reschedule interval++appLoop :: RegisteredEventType TimerEvent -> IO ()+appLoop (RegisteredEventType pushTimerEvent getTimerEvent) = waitEvent >>= go+  where+  go :: Event -> IO ()+  go ev =+    case eventPayload ev of+      -- Press Q to quit+      KeyboardEvent keyboardEvent+        |  keyboardEventKeyMotion keyboardEvent == Pressed &&+           keysymKeycode (keyboardEventKeysym keyboardEvent) == KeycodeQ+        -> return ()+      UserEvent _ -> do+        maybeTimerEvent <- getTimerEvent ev+        case maybeTimerEvent of+          Just (TimerEvent ts) -> do+             t <- show <$> ticks+             tid <- show <$> myThreadId+             putStrLn $ "Got timer event from queue at " ++ t ++ " ticks."+             putStrLn $ "Timestamp: " ++ show ts+             putStrLn $ "Threadid: " ++ tid+          Nothing -> return ()+        waitEvent >>= go+      _ -> waitEvent >>= go
examples/lazyfoo/Lesson12.hs view
@@ -83,9 +83,9 @@                                     SDL.ScancodeQ -> Sum (V3 32 0 0)                                     SDL.ScancodeW -> Sum (V3 0 32 0)                                     SDL.ScancodeE -> Sum (V3 0 0 32)-                                    SDL.ScancodeA -> Sum (V3 (-32) 0 0)-                                    SDL.ScancodeS -> Sum (V3 0 (-32) 0)-                                    SDL.ScancodeD -> Sum (V3 0 0 (-32))+                                    SDL.ScancodeA -> Sum (V3 224 0 0)+                                    SDL.ScancodeS -> Sum (V3 0 224 0)+                                    SDL.ScancodeD -> Sum (V3 0 0 224)                                     _ -> mempty                               | otherwise -> mempty                          _ -> mempty) $
include/sdlhelper.h view
@@ -1,26 +1,26 @@-#ifndef _HS_SDL2_HELPER_H_
-#define _HS_SDL2_HELPER_H_
-
-#include <stddef.h>
-#include "SDL.h"
-
-void SDLHelper_JoystickGetDeviceGUID (int device_index, SDL_JoystickGUID *guid);
-void SDLHelper_JoystickGetGUID (SDL_Joystick *joystick, SDL_JoystickGUID *guid);
-void SDLHelper_JoystickGetGUIDFromString (const char *pchGUID, SDL_JoystickGUID *guid);
-void SDLHelper_JoystickGetGUIDString (const SDL_JoystickGUID *guid, char *gszGUID, int cbGUID);
-
-void SDLHelper_GameControllerGetBindForAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis, SDL_GameControllerButtonBind *bind);
-void SDLHelper_GameControllerGetBindForButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button, SDL_GameControllerButtonBind *bind);
-char *SDLHelper_GameControllerMappingForGUID (const SDL_JoystickGUID *guid);
-
-void SDLHelper_LogMessage (int category, SDL_LogPriority priority, const char *str);
-
-int SDLHelper_RWclose (SDL_RWops *ctx);
-size_t SDLHelper_RWread (SDL_RWops *ctx, void *ptr, size_t size, size_t maxnum);
-Sint64 SDLHelper_RWseek (SDL_RWops *ctx, Sint64 offset, int whence);
-Sint64 SDLHelper_RWtell (SDL_RWops *ctx);
-size_t SDLHelper_RWwrite (SDL_RWops *ctx, const void *ptr, size_t size, size_t num);
-
-int SDLHelper_SetError(const char *str);
-
-#endif
+#ifndef _HS_SDL2_HELPER_H_+#define _HS_SDL2_HELPER_H_++#include <stddef.h>+#include "SDL.h"++void SDLHelper_JoystickGetDeviceGUID (int device_index, SDL_JoystickGUID *guid);+void SDLHelper_JoystickGetGUID (SDL_Joystick *joystick, SDL_JoystickGUID *guid);+void SDLHelper_JoystickGetGUIDFromString (const char *pchGUID, SDL_JoystickGUID *guid);+void SDLHelper_JoystickGetGUIDString (const SDL_JoystickGUID *guid, char *gszGUID, int cbGUID);++void SDLHelper_GameControllerGetBindForAxis (SDL_GameController *gamecontroller, SDL_GameControllerAxis axis, SDL_GameControllerButtonBind *bind);+void SDLHelper_GameControllerGetBindForButton (SDL_GameController *gamecontroller, SDL_GameControllerButton button, SDL_GameControllerButtonBind *bind);+char *SDLHelper_GameControllerMappingForGUID (const SDL_JoystickGUID *guid);++void SDLHelper_LogMessage (int category, SDL_LogPriority priority, const char *str);++int SDLHelper_RWclose (SDL_RWops *ctx);+size_t SDLHelper_RWread (SDL_RWops *ctx, void *ptr, size_t size, size_t maxnum);+Sint64 SDLHelper_RWseek (SDL_RWops *ctx, Sint64 offset, int whence);+Sint64 SDLHelper_RWtell (SDL_RWops *ctx);+size_t SDLHelper_RWwrite (SDL_RWops *ctx, const void *ptr, size_t size, size_t num);++int SDLHelper_SetError(const char *str);++#endif
sdl2.cabal view
@@ -1,452 +1,480 @@-name:                sdl2
-version:             2.3.0.1
-synopsis:            Both high- and low-level bindings to the SDL library (version 2.0.4+).
-description:
-  This package contains bindings to the SDL 2 library, in both high- and
-  low-level forms:
-  .
-  The 'SDL' namespace contains high-level bindings, where enumerations are split
-  into sum types, and we perform automatic error-checking.
-  .
-  The 'SDL.Raw' namespace contains an almost 1-1 translation of the C API into
-  Haskell FFI calls. As such, this does not contain sum types nor error
-  checking. Thus this namespace is suitable for building your own abstraction
-  over SDL, but is not recommended for day-to-day programming.
-
-license:             BSD3
-license-file:        LICENSE
-author:              Gabríel Arthúr Pétursson, Oliver Charles
-maintainer:          gabriel@system.is, ollie@ocharles.org.uk
-copyright:           Copyright © 2013-2017  Gabríel Arthúr Pétursson
-category:            Graphics
-build-type:          Simple
-cabal-version:       >= 1.10
-
-extra-source-files:
-  ChangeLog.md,
-  cbits/sdlhelper.c,
-  include/sdlhelper.h
-
-data-files:
-  examples/lazyfoo/*.bmp
-  examples/twinklebear/*.bmp
-
-source-repository head
-  type:     git
-  location: https://github.com/haskell-game/sdl2.git
-
--- source-repository this
---   type:     git
---   location: https://github.com/haskell-game/sdl2.git
---  tag:      2.0.0
-
-flag examples
-  description:       Build examples (except opengl-example)
-  default:           False
-
-flag opengl-example
-  description:       Build opengl-example
-  default:           False
-
-flag no-linear
-  description:       Do not depend on 'linear' library
-  default:           False
-  manual:            True
-
-library
-  -- ghc-options: -Wall
-
-  exposed-modules:
-    SDL
-    SDL.Audio
-    SDL.Event
-    SDL.Exception
-    SDL.Filesystem
-    SDL.Hint
-    SDL.Init
-    SDL.Input
-    SDL.Input.GameController
-    SDL.Input.Joystick
-    SDL.Input.Keyboard
-    SDL.Input.Keyboard.Codes
-    SDL.Input.Mouse
-    SDL.Power
-    SDL.Time
-    SDL.Vect
-    SDL.Video
-    SDL.Video.OpenGL
-    SDL.Video.Renderer
-
-    SDL.Internal.Exception
-    SDL.Internal.Numbered
-    SDL.Internal.Types
-    SDL.Internal.Vect
-
-    SDL.Raw
-    SDL.Raw.Audio
-    SDL.Raw.Basic
-    SDL.Raw.Enum
-    SDL.Raw.Error
-    SDL.Raw.Event
-    SDL.Raw.Filesystem
-    SDL.Raw.Haptic
-    SDL.Raw.Platform
-    SDL.Raw.Power
-    SDL.Raw.Thread
-    SDL.Raw.Timer
-    SDL.Raw.Types
-    SDL.Raw.Video
-
-  other-modules:
-    Data.Bitmask
-
-  hs-source-dirs:
-    src/
-
-  c-sources:
-    cbits/sdlhelper.c
-
-  include-dirs:
-    include
-
-  includes:
-    SDL.h
-    sdlhelper.h
-
-  extra-libraries:
-    SDL2
-
-  pkgconfig-depends:
-    sdl2 >= 2.0.4
-
-  build-depends:
-    base >= 4.7 && < 5,
-    bytestring >= 0.10.4.0 && < 0.11,
-    exceptions >= 0.4 && < 0.9,
-    StateVar >= 1.1.0.0 && < 1.2,
-    text >= 1.1.0.0 && < 1.3,
-    transformers >= 0.2 && < 0.6,
-    vector >= 0.10.9.0 && < 0.13
-
-  if flag(no-linear)
-    cpp-options: -Dnolinear
-  else
-    build-depends:
-      linear >= 1.10.1.2 && < 1.21
-
-  default-language:
-    Haskell2010
-
-  if os(windows)
-    cpp-options: -D_SDL_main_h -DSDL_main_h_
-
-executable lazyfoo-lesson-01
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson01.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson01
-
-executable lazyfoo-lesson-02
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson02.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson02
-
-executable lazyfoo-lesson-03
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson03.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson03
-
-executable lazyfoo-lesson-04
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson04.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson04
-
-executable lazyfoo-lesson-05
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson05.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson05
-
-executable lazyfoo-lesson-07
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson07.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson07
-
-executable lazyfoo-lesson-08
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson08.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson08
-
-executable lazyfoo-lesson-09
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson09.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson09
-
-executable lazyfoo-lesson-10
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson10.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson10
-
-executable lazyfoo-lesson-11
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson11.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson11
-
-executable lazyfoo-lesson-12
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson12.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson12
-
-executable lazyfoo-lesson-13
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson13.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson13
-
-executable lazyfoo-lesson-14
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson14.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson14
-
-executable lazyfoo-lesson-15
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson15.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson15
-
-executable lazyfoo-lesson-17
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson17.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson17
-
-executable lazyfoo-lesson-18
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson18.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson18
-
-executable lazyfoo-lesson-19
-  if flag(examples)
-    build-depends: base, vector, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson19.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson19
-
-executable lazyfoo-lesson-20
-  if flag(examples)
-    build-depends: base, vector, sdl2
-  else
-    buildable: False
-
-  -- Not buildable until someone with a haptic device can help out!
-  buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson20.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson20
-
-executable lazyfoo-lesson-43
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/lazyfoo
-  main-is: Lesson43.hs
-  default-language: Haskell2010
-  ghc-options: -main-is Lazyfoo.Lesson43
-
-executable twinklebear-lesson-01
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/twinklebear
-  main-is: Lesson01.hs
-  default-language: Haskell2010
-  ghc-options: -main-is TwinkleBear.Lesson01
-
-executable twinklebear-lesson-02
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/twinklebear
-  main-is: Lesson02.hs
-  default-language: Haskell2010
-  ghc-options: -main-is TwinkleBear.Lesson02
-
-executable twinklebear-lesson-04
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/twinklebear
-  main-is: Lesson04.hs
-  default-language: Haskell2010
-  ghc-options: -main-is TwinkleBear.Lesson04
-
-executable twinklebear-lesson-04a
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/twinklebear
-  main-is: Lesson04a.hs
-  default-language: Haskell2010
-  ghc-options: -main-is TwinkleBear.Lesson04a
-
-executable twinklebear-lesson-05
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples/twinklebear
-  main-is: Lesson05.hs
-  default-language: Haskell2010
-  ghc-options: -main-is TwinkleBear.Lesson05
-
-executable audio-example
-  if flag(examples)
-    build-depends: base, vector, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples
-  main-is: AudioExample.hs
-  default-language: Haskell2010
-  ghc-options: -main-is AudioExample -threaded
-
-executable eventwatch-example
-  if flag(examples)
-    build-depends: base, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples
-  main-is: EventWatch.hs
-  default-language: Haskell2010
-  ghc-options: -main-is EventWatch
-
-executable userevent-example
-  if flag(examples)
-    build-depends: base, text, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples
-  main-is: UserEvents.hs
-  default-language: Haskell2010
-  ghc-options: -main-is UserEvents
-
-executable opengl-example
-  if flag(opengl-example)
-    build-depends: base, OpenGL, bytestring, vector, sdl2
-  else
-    buildable: False
-
-  hs-source-dirs: examples
-  main-is: OpenGLExample.hs
-  default-language: Haskell2010
-  ghc-options: -main-is OpenGLExample
+name:                sdl2+version:             2.4.0+synopsis:            Both high- and low-level bindings to the SDL library (version 2.0.4+).+description:+  This package contains bindings to the SDL 2 library, in both high- and+  low-level forms:+  .+  The 'SDL' namespace contains high-level bindings, where enumerations are split+  into sum types, and we perform automatic error-checking.+  .+  The 'SDL.Raw' namespace contains an almost 1-1 translation of the C API into+  Haskell FFI calls. As such, this does not contain sum types nor error+  checking. Thus this namespace is suitable for building your own abstraction+  over SDL, but is not recommended for day-to-day programming.++license:             BSD3+license-file:        LICENSE+author:              Gabríel Arthúr Pétursson, Oliver Charles+maintainer:          gabriel@system.is, ollie@ocharles.org.uk+copyright:           Copyright © 2013-2017  Gabríel Arthúr Pétursson+category:            Graphics+build-type:          Simple+cabal-version:       >= 1.10++extra-source-files:+  ChangeLog.md,+  cbits/sdlhelper.c,+  include/sdlhelper.h++data-files:+  examples/lazyfoo/*.bmp+  examples/twinklebear/*.bmp++source-repository head+  type:     git+  location: https://github.com/haskell-game/sdl2.git++-- source-repository this+--   type:     git+--   location: https://github.com/haskell-game/sdl2.git+--  tag:      2.0.0++flag examples+  description:       Build examples (except opengl-example)+  default:           False++flag opengl-example+  description:       Build opengl-example+  default:           False++flag no-linear+  description:       Do not depend on 'linear' library+  default:           False+  manual:            True++library+  -- ghc-options: -Wall++  exposed-modules:+    SDL+    SDL.Audio+    SDL.Event+    SDL.Exception+    SDL.Filesystem+    SDL.Hint+    SDL.Init+    SDL.Input+    SDL.Input.GameController+    SDL.Input.Joystick+    SDL.Input.Keyboard+    SDL.Input.Keyboard.Codes+    SDL.Input.Mouse+    SDL.Power+    SDL.Time+    SDL.Vect+    SDL.Video+    SDL.Video.OpenGL+    SDL.Video.Renderer++    SDL.Internal.Exception+    SDL.Internal.Numbered+    SDL.Internal.Types+    SDL.Internal.Vect++    SDL.Raw+    SDL.Raw.Audio+    SDL.Raw.Basic+    SDL.Raw.Enum+    SDL.Raw.Error+    SDL.Raw.Event+    SDL.Raw.Filesystem+    SDL.Raw.Haptic+    SDL.Raw.Platform+    SDL.Raw.Power+    SDL.Raw.Thread+    SDL.Raw.Timer+    SDL.Raw.Types+    SDL.Raw.Video++  other-modules:+    Data.Bitmask++  hs-source-dirs:+    src/++  c-sources:+    cbits/sdlhelper.c++  include-dirs:+    include++  includes:+    SDL.h+    sdlhelper.h++  extra-libraries:+    SDL2++  pkgconfig-depends:+    sdl2 >= 2.0.4++  build-depends:+    base >= 4.7 && < 5,+    bytestring >= 0.10.4.0 && < 0.11,+    exceptions >= 0.4 && < 0.10,+    StateVar >= 1.1.0.0 && < 1.2,+    text >= 1.1.0.0 && < 1.3,+    transformers >= 0.2 && < 0.6,+    vector >= 0.10.9.0 && < 0.13++  if flag(no-linear)+    cpp-options: -Dnolinear+  else+    build-depends:+      linear >= 1.10.1.2 && < 1.21++  default-language:+    Haskell2010++  if os(windows)+    cpp-options: -D_SDL_main_h -DSDL_main_h_++executable lazyfoo-lesson-01+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson01.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson01+  other-modules: Paths_sdl2++executable lazyfoo-lesson-02+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson02.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson02+  other-modules: Paths_sdl2++executable lazyfoo-lesson-03+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson03.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson03+  other-modules: Paths_sdl2++executable lazyfoo-lesson-04+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson04.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson04+  other-modules: Paths_sdl2++executable lazyfoo-lesson-05+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson05.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson05+  other-modules: Paths_sdl2++executable lazyfoo-lesson-07+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson07.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson07+  other-modules: Paths_sdl2++executable lazyfoo-lesson-08+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson08.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson08+  other-modules: Paths_sdl2++executable lazyfoo-lesson-09+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson09.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson09+  other-modules: Paths_sdl2++executable lazyfoo-lesson-10+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson10.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson10+  other-modules: Paths_sdl2++executable lazyfoo-lesson-11+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson11.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson11+  other-modules: Paths_sdl2++executable lazyfoo-lesson-12+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson12.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson12+  other-modules: Paths_sdl2++executable lazyfoo-lesson-13+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson13.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson13+  other-modules: Paths_sdl2++executable lazyfoo-lesson-14+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson14.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson14+  other-modules: Paths_sdl2++executable lazyfoo-lesson-15+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson15.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson15+  other-modules: Paths_sdl2++executable lazyfoo-lesson-17+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson17.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson17+  other-modules: Paths_sdl2++executable lazyfoo-lesson-18+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson18.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson18+  other-modules: Paths_sdl2++executable lazyfoo-lesson-19+  if flag(examples)+    build-depends: base, vector, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson19.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson19+  other-modules: Paths_sdl2++executable lazyfoo-lesson-20+  if flag(examples)+    build-depends: base, vector, sdl2+  else+    buildable: False++  -- Not buildable until someone with a haptic device can help out!+  buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson20.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson20+  other-modules: Paths_sdl2++executable lazyfoo-lesson-43+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/lazyfoo+  main-is: Lesson43.hs+  default-language: Haskell2010+  ghc-options: -main-is Lazyfoo.Lesson43+  other-modules: Paths_sdl2++executable twinklebear-lesson-01+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/twinklebear+  main-is: Lesson01.hs+  default-language: Haskell2010+  ghc-options: -main-is TwinkleBear.Lesson01+  other-modules: Paths_sdl2++executable twinklebear-lesson-02+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/twinklebear+  main-is: Lesson02.hs+  default-language: Haskell2010+  ghc-options: -main-is TwinkleBear.Lesson02+  other-modules: Paths_sdl2++executable twinklebear-lesson-04+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/twinklebear+  main-is: Lesson04.hs+  default-language: Haskell2010+  ghc-options: -main-is TwinkleBear.Lesson04+  other-modules: Paths_sdl2++executable twinklebear-lesson-04a+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/twinklebear+  main-is: Lesson04a.hs+  default-language: Haskell2010+  ghc-options: -main-is TwinkleBear.Lesson04a+  other-modules: Paths_sdl2++executable twinklebear-lesson-05+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples/twinklebear+  main-is: Lesson05.hs+  default-language: Haskell2010+  ghc-options: -main-is TwinkleBear.Lesson05+  other-modules: Paths_sdl2++executable audio-example+  if flag(examples)+    build-depends: base, vector, sdl2+  else+    buildable: False++  hs-source-dirs: examples+  main-is: AudioExample.hs+  default-language: Haskell2010+  ghc-options: -main-is AudioExample -threaded+  other-modules: Paths_sdl2++executable eventwatch-example+  if flag(examples)+    build-depends: base, sdl2+  else+    buildable: False++  hs-source-dirs: examples+  main-is: EventWatch.hs+  default-language: Haskell2010+  ghc-options: -main-is EventWatch+  other-modules: Paths_sdl2++executable userevent-example+  if flag(examples)+    build-depends: base, text, sdl2+  else+    buildable: False++  hs-source-dirs: examples+  main-is: UserEvents.hs+  default-language: Haskell2010+  ghc-options: -main-is UserEvents+  other-modules: Paths_sdl2++executable opengl-example+  if flag(opengl-example)+    build-depends: base, OpenGL, bytestring, vector, sdl2+  else+    buildable: False++  hs-source-dirs: examples+  main-is: OpenGLExample.hs+  default-language: Haskell2010+  ghc-options: -main-is OpenGLExample+  other-modules: Paths_sdl2
src/Data/Bitmask.hs view
@@ -1,9 +1,9 @@-module Data.Bitmask (foldFlags) where
-
-import Prelude hiding (foldl)
-
-import Data.Bits
-import Data.Foldable
-
-foldFlags :: (Bits b, Foldable f, Num b) => (flag -> b) -> f flag -> b
-foldFlags f = foldl (\a b -> a .|. f b) 0
+module Data.Bitmask (foldFlags) where++import Prelude hiding (foldl)++import Data.Bits+import Data.Foldable++foldFlags :: (Bits b, Foldable f, Num b) => (flag -> b) -> f flag -> b+foldFlags f = foldl (\a b -> a .|. f b) 0
src/SDL.hs view
@@ -1,160 +1,160 @@-{-|
-
-SDL (Simple DirectMedia Layer) is a library for cross-platform development of
-interactive applications. SDL provides routines for managing windows, rendering
-graphics, processing sound, collecting input data, and much more. The Haskell
-@sdl2@ library provides both a high- and low-level API to interface with
-SDL. This module exports the high-level API, whereas "SDL.Raw" provides the
-lower-level bindings.
-
--}
-module SDL
-  ( -- * Getting Started
-    -- $gettingStarted
-
-    -- * Initialization
-    module SDL.Init
-
-    -- * Modules
-  , module SDL.Audio
-  , module SDL.Event
-  , module SDL.Filesystem
-  , module SDL.Hint
-  , module SDL.Input
-  , module SDL.Power
-  , module SDL.Time
-  , module SDL.Vect
-  , module SDL.Video
-
-  -- * Error Handling
-  , module SDL.Exception
-
-  -- * Working with State Variables
-  -- $stateVars
-  , get, ($=), ($~)
-  -- ** Strict modification
-  , ($=!), ($~!)
-  ) where
-
-import Data.StateVar
-import SDL.Audio
-import SDL.Event
-import SDL.Exception
-import SDL.Filesystem
-import SDL.Hint
-import SDL.Init
-import SDL.Input
-import SDL.Power
-import SDL.Time
-import SDL.Vect
-import SDL.Video
-
-{- $gettingStarted
-
-The "SDL" module exports a high-level Haskell-like abstraction to use the <http://libsdl.org/ SDL> library. SDL is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
-
-To get started, import "SDL" and begin by initializing the subsystems you need:
-
-@
-import "SDL"
-
-main :: IO ()
-main = do
-  'initializeAll'
-@
-
-Next, you can create a 'Window' by using 'createWindow'
-
-@
-  window <- 'createWindow' "My SDL Application" 'defaultWindow'
-@
-
-If you wish to use SDL's 2D graphics API, you can also create a 'Renderer':
-
-@
-  renderer <- 'createRenderer' window (-1) 'defaultRenderer'
-@
-
-Finally, we enter our main application loop:
-
-@
-  appLoop renderer
-@
-
-For the body of your application, we enter a loop. Inside this loop you should begin by collecting all events that
-have happened - these events will inform you about information such as key presses and mouse movement:
-
-@
-appLoop :: 'Renderer' -> IO ()
-appLoop renderer = do
-  events <- 'pollEvents'
-@
-
-Here @events@ is a list of 'Event' values. For our application we will check if the user pressed the q key, indicating they wish to quit the application
-
-@
-  let eventIsQPress event =
-        case 'eventPayload' event of
-          'KeyboardEvent' keyboardEvent ->
-            'keyboardEventKeyMotion' keyboardEvent == 'Pressed' &&
-            'keysymKeycode' ('keyboardEventKeysym' keyboardEvent) == 'KeycodeQ'
-          _ -> False
-      qPressed = any eventIsQPress events
-@
-
-In our @appLoop@ we process events and then update the screen accordingly. Here we simply use the 'Renderer'
-to clear the screen to blue:
-
-@
-  'rendererDrawColor' renderer '$=' V4 0 0 255 255
-  'clear' renderer
-  'present' renderer
-@
-
-If q was not pressed, we loop again. Otherwise, we exit the loop:
-
-@
-  unless qPressed (appLoop renderer)
-@
-
-To recap, here is our full application
-
-@
-
-\{\-\# LANGUAGE OverloadedStrings \#\-\}
-module "Main" where
-
-import "SDL"
-import "Linear" (V4(..))
-import "Control.Monad" (unless)
-
-main :: IO ()
-main = do
-  'initializeAll'
-  window <- 'createWindow' "My SDL Application" 'defaultWindow'
-  renderer <- 'createRenderer' window (-1) 'defaultRenderer'
-  appLoop renderer
-
-appLoop :: 'Renderer' -> IO ()
-appLoop renderer = do
-  events <- 'pollEvents'
-  let eventIsQPress event =
-        case 'eventPayload' event of
-          'KeyboardEvent' keyboardEvent ->
-            'keyboardEventKeyMotion' keyboardEvent == 'Pressed' &&
-            'keysymKeycode' ('keyboardEventKeysym' keyboardEvent) == 'KeycodeQ'
-          _ -> False
-      qPressed = any eventIsQPress events
-  'rendererDrawColor' renderer '$=' V4 0 0 255 255
-  'clear' renderer
-  'present' renderer
-  unless qPressed (appLoop renderer)
-@
-
--}
-
-{- $stateVars
-
-The SDL API is moderately stateful. For the places where there is state that can be both read and changed, we use an abstraction provided by "Data.StateVar". This module exposes the 'StateVar' type, which models a mutable variable. You can query the contents of a 'StateVar' with 'get', and you can replace the contents of 'StateVar' with the infix assignment operator '$='.
-
--}
+{-|++SDL (Simple DirectMedia Layer) is a library for cross-platform development of+interactive applications. SDL provides routines for managing windows, rendering+graphics, processing sound, collecting input data, and much more. The Haskell+@sdl2@ library provides both a high- and low-level API to interface with+SDL. This module exports the high-level API, whereas "SDL.Raw" provides the+lower-level bindings.++-}+module SDL+  ( -- * Getting Started+    -- $gettingStarted++    -- * Initialization+    module SDL.Init++    -- * Modules+  , module SDL.Audio+  , module SDL.Event+  , module SDL.Filesystem+  , module SDL.Hint+  , module SDL.Input+  , module SDL.Power+  , module SDL.Time+  , module SDL.Vect+  , module SDL.Video++  -- * Error Handling+  , module SDL.Exception++  -- * Working with State Variables+  -- $stateVars+  , get, ($=), ($~)+  -- ** Strict modification+  , ($=!), ($~!)+  ) where++import Data.StateVar+import SDL.Audio+import SDL.Event+import SDL.Exception+import SDL.Filesystem+import SDL.Hint+import SDL.Init+import SDL.Input+import SDL.Power+import SDL.Time+import SDL.Vect+import SDL.Video++{- $gettingStarted++The "SDL" module exports a high-level Haskell-like abstraction to use the <http://libsdl.org/ SDL> library. SDL is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.++To get started, import "SDL" and begin by initializing the subsystems you need:++@+import "SDL"++main :: IO ()+main = do+  'initializeAll'+@++Next, you can create a 'Window' by using 'createWindow'++@+  window <- 'createWindow' "My SDL Application" 'defaultWindow'+@++If you wish to use SDL's 2D graphics API, you can also create a 'Renderer':++@+  renderer <- 'createRenderer' window (-1) 'defaultRenderer'+@++Finally, we enter our main application loop:++@+  appLoop renderer+@++For the body of your application, we enter a loop. Inside this loop you should begin by collecting all events that+have happened - these events will inform you about information such as key presses and mouse movement:++@+appLoop :: 'Renderer' -> IO ()+appLoop renderer = do+  events <- 'pollEvents'+@++Here @events@ is a list of 'Event' values. For our application we will check if the user pressed the q key, indicating they wish to quit the application++@+  let eventIsQPress event =+        case 'eventPayload' event of+          'KeyboardEvent' keyboardEvent ->+            'keyboardEventKeyMotion' keyboardEvent == 'Pressed' &&+            'keysymKeycode' ('keyboardEventKeysym' keyboardEvent) == 'KeycodeQ'+          _ -> False+      qPressed = any eventIsQPress events+@++In our @appLoop@ we process events and then update the screen accordingly. Here we simply use the 'Renderer'+to clear the screen to blue:++@+  'rendererDrawColor' renderer '$=' V4 0 0 255 255+  'clear' renderer+  'present' renderer+@++If q was not pressed, we loop again. Otherwise, we exit the loop:++@+  unless qPressed (appLoop renderer)+@++To recap, here is our full application++@++\{\-\# LANGUAGE OverloadedStrings \#\-\}+module "Main" where++import "SDL"+import "Linear" (V4(..))+import "Control.Monad" (unless)++main :: IO ()+main = do+  'initializeAll'+  window <- 'createWindow' "My SDL Application" 'defaultWindow'+  renderer <- 'createRenderer' window (-1) 'defaultRenderer'+  appLoop renderer++appLoop :: 'Renderer' -> IO ()+appLoop renderer = do+  events <- 'pollEvents'+  let eventIsQPress event =+        case 'eventPayload' event of+          'KeyboardEvent' keyboardEvent ->+            'keyboardEventKeyMotion' keyboardEvent == 'Pressed' &&+            'keysymKeycode' ('keyboardEventKeysym' keyboardEvent) == 'KeycodeQ'+          _ -> False+      qPressed = any eventIsQPress events+  'rendererDrawColor' renderer '$=' V4 0 0 255 255+  'clear' renderer+  'present' renderer+  unless qPressed (appLoop renderer)+@++-}++{- $stateVars++The SDL API is moderately stateful. For the places where there is state that can be both read and changed, we use an abstraction provided by "Data.StateVar". This module exposes the 'StateVar' type, which models a mutable variable. You can query the contents of a 'StateVar' with 'get', and you can replace the contents of 'StateVar' with the infix assignment operator '$='.++-}
src/SDL/Audio.hs view
@@ -1,447 +1,447 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE ConstraintKinds #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveFoldable #-}
-{-# LANGUAGE DeriveFunctor #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE DeriveTraversable #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
-{-# LANGUAGE GADTs #-}
-{-# LANGUAGE KindSignatures #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE StandaloneDeriving #-}
-{-# LANGUAGE ScopedTypeVariables #-}
-
-{-|
-
-"SDL.Audio" provides a high-level API to SDL's audio device capabilities.
-
--}
-
-module SDL.Audio
-  ( -- * Managing 'AudioDevice's
-    -- $audioDevice
-    AudioDevice
-
-    -- ** Opening and Closing 'AudioDevice's
-  , openAudioDevice
-  , closeAudioDevice
-  , OpenDeviceSpec(..)
-  , AudioDeviceUsage(..)
-  , Channels(..)
-  , Changeable(..)
-
-    -- ** Working with Opened Devices
-    -- *** Locking 'AudioDevice's
-  , setAudioDeviceLocked
-  , LockState(..)
-
-    -- *** Switching Playback States
-  , PlaybackState(..)
-  , setAudioDevicePlaybackState
-
-    -- *** Querying an 'AudioDevice's Status.
-  , AudioDeviceStatus(..)
-  , audioDeviceStatus
-
-    -- ** 'AudioFormat'
-  , AudioFormat(..)
-
-    -- ** Enumerating 'AudioDevice's
-  , getAudioDeviceNames
-
-    -- * 'AudioSpec'
-  , AudioSpec
-  , audioSpecFreq
-  , audioSpecFormat
-  , audioSpecChannels
-  , audioSpecSilence
-  , audioSpecSize
-  , audioSpecCallback
-
-    -- * Audio Drivers
-  , getAudioDrivers
-  , currentAudioDriver
-  , AudioDriver
-  , audioDriverName
-
-    -- * Explicit Initialization
-  , audioInit
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Bits
-import Data.Data (Data)
-import Data.IORef (newIORef, writeIORef, readIORef)
-import Data.Int (Int8, Int16, Int32)
-import Data.Text (Text)
-import Data.Traversable (for)
-import Data.Typeable
-import Data.Word
-import Foreign.C.Types
-import Foreign.ForeignPtr
-import Foreign.Marshal.Alloc
-import Foreign.Marshal.Utils
-import Foreign.Ptr
-import Foreign.Storable
-import GHC.Exts (Constraint)
-import GHC.Generics (Generic)
-import SDL.Internal.Exception
-import qualified Data.ByteString as BS
-import qualified Data.Text.Encoding as Text
-import qualified Data.Vector as V
-import qualified Data.Vector.Storable.Mutable as MV
-import qualified SDL.Raw.Audio as Raw
-import qualified SDL.Raw.Enum as Raw
-import qualified SDL.Raw.Types as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-import Data.Foldable (Foldable)
-import Data.Traversable (Traversable)
-#endif
-
-{-
-
-$audioDevice
-
-In order to produce sound, you must first open an 'AudioDevice'. To do so,
-pass an 'OpenDeviceSpec' to 'openAudioDevice'.
-
--}
-
--- | A specification to 'openAudioDevice', indicating the desired output format.
--- Note that many of these properties are 'Changeable', meaning that you can
--- choose whether or not SDL should interpret your specification as an
--- unbreakable request ('Mandate'), or as an approximation 'Desire'.
-data OpenDeviceSpec = forall sampleType. OpenDeviceSpec
-  { openDeviceFreq :: !(Changeable CInt)
-    -- ^ The output audio frequency in herts.
-  , openDeviceFormat :: !(Changeable (AudioFormat sampleType))
-    -- ^ The format of audio that will be sampled from the output buffer.
-  , openDeviceChannels :: !(Changeable Channels)
-    -- ^ The amount of audio channels.
-  , openDeviceSamples :: !Word16
-    -- ^ Output audio buffer size in samples. This should be a power of 2.
-  , openDeviceCallback :: forall actualSampleType. AudioFormat actualSampleType -> MV.IOVector actualSampleType -> IO ()
-    -- ^ A callback to invoke whenever new sample data is required. The callback
-    -- will be passed a single 'MV.MVector' that must be filled with audio data.
-  , openDeviceUsage :: !AudioDeviceUsage
-    -- ^ How you intend to use the opened 'AudioDevice' - either for outputting
-    -- or capturing audio.
-  , openDeviceName :: !(Maybe Text)
-    -- ^ The name of the 'AudioDevice' that should be opened. If 'Nothing',
-    -- any suitable 'AudioDevice' will be used.
-  } deriving (Typeable)
-
--- | Attempt to open the closest matching 'AudioDevice', as specified by the
--- given 'OpenDeviceSpec'.
---
--- See @<https://wiki.libsdl.org/SDL_OpenAudioDevice SDL_OpenAudioDevice>@ for C documentation.
-openAudioDevice :: MonadIO m => OpenDeviceSpec -> m (AudioDevice, AudioSpec)
-openAudioDevice OpenDeviceSpec{..} = liftIO $
-  maybeWith (BS.useAsCString . Text.encodeUtf8) openDeviceName $ \cDevName -> do
-    anAudioFormatRef <- newIORef undefined
-    cb <- Raw.mkAudioCallback $ \_ buffer len -> do
-      fp <- newForeignPtr_ buffer
-      anAudioFormat <- readIORef anAudioFormatRef
-      case anAudioFormat of
-        AnAudioFormat audioFormat ->
-          case audioFormatStorable audioFormat of
-            Dict -> openDeviceCallback audioFormat
-                                       (MV.unsafeCast (MV.unsafeFromForeignPtr0 fp (fromIntegral len)))
-    with (desiredSpec cb) $ \desiredSpecPtr ->
-      alloca $ \actualSpecPtr -> do
-        devId <- throwIf0 "SDL.Audio.openAudioDevice" "SDL_OpenAudioDevice" $
-          Raw.openAudioDevice cDevName (encodeUsage openDeviceUsage) desiredSpecPtr actualSpecPtr changes
-        actual <- peek actualSpecPtr
-        let audioDevice = AudioDevice devId
-            anAudioFormat = decodeAudioFormat (Raw.audioSpecFormat actual)
-            spec =
-              case anAudioFormat of
-                AnAudioFormat audioFormat ->
-                  AudioSpec { audioSpecFreq = Raw.audioSpecFreq actual
-                            , audioSpecFormat = audioFormat
-                            , audioSpecChannels = fromC "SDL.Audio.openAudioDevice" "audioSpecChannels" readChannels (Raw.audioSpecChannels actual)
-                            , audioSpecSilence = Raw.audioSpecSilence actual
-                            , audioSpecSize = Raw.audioSpecSize actual
-                            , audioSpecSamples = Raw.audioSpecSamples actual
-                            , audioSpecCallback = openDeviceCallback
-                            }
-        writeIORef anAudioFormatRef anAudioFormat
-        return (audioDevice, spec)
-
-  where
-  changes = foldl (.|.) 0 [ foldChangeable (const Raw.SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) (const 0) openDeviceFreq
-                          , foldChangeable (const Raw.SDL_AUDIO_ALLOW_FORMAT_CHANGE) (const 0) openDeviceFormat
-                          , foldChangeable (const Raw.SDL_AUDIO_ALLOW_CHANNELS_CHANGE) (const 0) openDeviceChannels
-                          ]
-
-  channelsToWord8 Mono = 1
-  channelsToWord8 Stereo = 2
-  channelsToWord8 Quad = 4
-  channelsToWord8 FivePointOne = 6
-
-  readChannels 1 = Just Mono
-  readChannels 2 = Just Stereo
-  readChannels 4 = Just Quad
-  readChannels 6 = Just FivePointOne
-  readChannels _ = Nothing
-
-  desiredSpec cb = Raw.AudioSpec
-    { Raw.audioSpecFreq = unpackChangeable openDeviceFreq
-    , Raw.audioSpecFormat = encodeAudioFormat (unpackChangeable openDeviceFormat)
-    , Raw.audioSpecChannels = channelsToWord8 (unpackChangeable openDeviceChannels)
-    , Raw.audioSpecSilence = 0
-    , Raw.audioSpecSize = 0
-    , Raw.audioSpecSamples = openDeviceSamples
-    , Raw.audioSpecCallback = cb
-    , Raw.audioSpecUserdata = nullPtr
-    }
-
-  -- Witness the 'Storable' instance for the sample type of any audio format. Needed in order to use 'MV.unsafeCast'
-  audioFormatStorable :: AudioFormat sampleType -> Dict (Storable sampleType)
-  audioFormatStorable Signed8BitAudio = Dict
-  audioFormatStorable Unsigned8BitAudio = Dict
-  audioFormatStorable Signed16BitLEAudio = Dict
-  audioFormatStorable Signed16BitBEAudio = Dict
-  audioFormatStorable Signed16BitNativeAudio = Dict
-  audioFormatStorable Unsigned16BitLEAudio = Dict
-  audioFormatStorable Unsigned16BitBEAudio = Dict
-  audioFormatStorable Unsigned16BitNativeAudio = Dict
-  audioFormatStorable Signed32BitLEAudio = Dict
-  audioFormatStorable Signed32BitBEAudio = Dict
-  audioFormatStorable Signed32BitNativeAudio = Dict
-  audioFormatStorable FloatingLEAudio = Dict
-  audioFormatStorable FloatingBEAudio = Dict
-  audioFormatStorable FloatingNativeAudio = Dict
-
-data Dict :: Constraint -> * where
-  Dict :: c => Dict c
-
--- |
---
--- See @<https://wiki.libsdl.org/SDL_CloseAudioDevice SDL_CloseAudioDevice>@ for C documentation.
-closeAudioDevice :: MonadIO m => AudioDevice -> m ()
-closeAudioDevice (AudioDevice d) = Raw.closeAudioDevice d
-
--- | An open audio device. These can be created via 'openAudioDevice' and should be closed with 'closeAudioDevice'
-newtype AudioDevice = AudioDevice (Raw.AudioDeviceID)
-  deriving (Eq, Typeable)
-
--- | Enumerate all 'AudioDevice's attached to this system, that can be used as
--- specified by the given 'AudioDeviceUsage'. SDL cannot always guarantee
--- that this list can be produced, in which case 'Nothing' will be returned.
-getAudioDeviceNames :: MonadIO m => AudioDeviceUsage -> m (Maybe (V.Vector Text))
-getAudioDeviceNames usage = liftIO $ do
-  n <- Raw.getNumAudioDevices usage'
-  if n == -1
-    then return Nothing
-    else fmap (Just . V.fromList) $
-         for [0 .. (n - 1)] $ \i -> do
-           cstr <- throwIfNull "SDL.Audio.getAudioDeviceNames" "SDL_GetAudioDeviceName" $
-             Raw.getAudioDeviceName i usage'
-           Text.decodeUtf8 <$> BS.packCString cstr
-
-  where usage' = encodeUsage usage
-
--- | Information about what format an audio bytestream is. The type variable
--- @t@ indicates the type used for audio buffer samples. It is determined
--- by the choice of the provided 'SampleBitSize'. For example:
---
--- @AudioFormat UnsignedInteger Sample8Bit Native :: AudioFormat Word8@
---
--- Indicating that an 8-bit audio format in the platforms native endianness
--- uses a buffer of 'Word8' values.
-data AudioFormat sampleType where
-  Signed8BitAudio :: AudioFormat Int8
-  Unsigned8BitAudio :: AudioFormat Word8
-  Signed16BitLEAudio :: AudioFormat Int16
-  Signed16BitBEAudio :: AudioFormat Int16
-  Signed16BitNativeAudio :: AudioFormat Int16
-  Unsigned16BitLEAudio :: AudioFormat Word16
-  Unsigned16BitBEAudio :: AudioFormat Word16
-  Unsigned16BitNativeAudio :: AudioFormat Word16
-  Signed32BitLEAudio :: AudioFormat Int32
-  Signed32BitBEAudio :: AudioFormat Int32
-  Signed32BitNativeAudio :: AudioFormat Int32
-  FloatingLEAudio :: AudioFormat Float
-  FloatingBEAudio :: AudioFormat Float
-  FloatingNativeAudio :: AudioFormat Float
-
-deriving instance Eq (AudioFormat sampleType)
-deriving instance Ord (AudioFormat sampleType)
-deriving instance Show (AudioFormat sampleType)
-
-data AnAudioFormat where
-  AnAudioFormat :: AudioFormat sampleType -> AnAudioFormat
-
-encodeAudioFormat :: AudioFormat sampleType -> Word16
-encodeAudioFormat Signed8BitAudio = Raw.SDL_AUDIO_S8
-encodeAudioFormat Unsigned8BitAudio = Raw.SDL_AUDIO_U8
-encodeAudioFormat Signed16BitLEAudio = Raw.SDL_AUDIO_S16LSB
-encodeAudioFormat Signed16BitBEAudio = Raw.SDL_AUDIO_S16MSB
-encodeAudioFormat Signed16BitNativeAudio = Raw.SDL_AUDIO_S16SYS
-encodeAudioFormat Unsigned16BitLEAudio = Raw.SDL_AUDIO_U16LSB
-encodeAudioFormat Unsigned16BitBEAudio = Raw.SDL_AUDIO_U16MSB
-encodeAudioFormat Unsigned16BitNativeAudio = Raw.SDL_AUDIO_U16SYS
-encodeAudioFormat Signed32BitLEAudio = Raw.SDL_AUDIO_S32LSB
-encodeAudioFormat Signed32BitBEAudio = Raw.SDL_AUDIO_S32MSB
-encodeAudioFormat Signed32BitNativeAudio = Raw.SDL_AUDIO_S32SYS
-encodeAudioFormat FloatingLEAudio = Raw.SDL_AUDIO_F32LSB
-encodeAudioFormat FloatingBEAudio = Raw.SDL_AUDIO_F32MSB
-encodeAudioFormat FloatingNativeAudio = Raw.SDL_AUDIO_F32SYS
-
-decodeAudioFormat :: Word16 -> AnAudioFormat
-decodeAudioFormat Raw.SDL_AUDIO_S8 = AnAudioFormat Signed8BitAudio
-decodeAudioFormat Raw.SDL_AUDIO_U8 = AnAudioFormat Unsigned8BitAudio
-decodeAudioFormat Raw.SDL_AUDIO_S16LSB = AnAudioFormat Signed16BitLEAudio
-decodeAudioFormat Raw.SDL_AUDIO_S16MSB = AnAudioFormat Signed16BitBEAudio
-decodeAudioFormat Raw.SDL_AUDIO_S16SYS = AnAudioFormat Signed16BitNativeAudio
-decodeAudioFormat Raw.SDL_AUDIO_U16LSB = AnAudioFormat Unsigned16BitLEAudio
-decodeAudioFormat Raw.SDL_AUDIO_U16MSB = AnAudioFormat Unsigned16BitBEAudio
-decodeAudioFormat Raw.SDL_AUDIO_U16SYS = AnAudioFormat Unsigned16BitNativeAudio
-decodeAudioFormat Raw.SDL_AUDIO_S32LSB = AnAudioFormat Signed32BitLEAudio
-decodeAudioFormat Raw.SDL_AUDIO_S32MSB = AnAudioFormat Signed32BitBEAudio
-decodeAudioFormat Raw.SDL_AUDIO_S32SYS = AnAudioFormat Signed32BitNativeAudio
-decodeAudioFormat Raw.SDL_AUDIO_F32LSB = AnAudioFormat FloatingLEAudio
-decodeAudioFormat Raw.SDL_AUDIO_F32MSB = AnAudioFormat FloatingBEAudio
-decodeAudioFormat Raw.SDL_AUDIO_F32SYS = AnAudioFormat FloatingNativeAudio
-decodeAudioFormat x = error ("decodeAudioFormat failed: Unknown format " ++ show x)
-
--- | How many channels audio should be played on
-data Channels
-  = Mono -- ^ A single speaker configuration
-  | Stereo -- ^ A traditional left/right stereo system
-  | Quad
-  | FivePointOne -- ^ 5.1 surround sound
-  deriving (Bounded,Data,Enum,Eq,Generic,Ord,Read,Show,Typeable)
-
--- | 'AudioSpec' is the concrete specification of how an 'AudioDevice' was
--- sucessfully opened. Unlike 'OpenDeviceSpec', which specifies what you
--- /want/, 'AudioSpec' specifies what you /have/.
-data AudioSpec = forall sampleType. AudioSpec
-  { audioSpecFreq :: !CInt
-    -- ^ DSP frequency (samples per second)
-  , audioSpecFormat :: !(AudioFormat sampleType)
-    -- ^ Audio data format
-  , audioSpecChannels :: !Channels
-    -- ^ Number of separate sound channels
-  , audioSpecSilence :: !Word8
-    -- ^ Calculated udio buffer silence value
-  , audioSpecSamples :: !Word16
-    -- ^ Audio buffer size in samples (power of 2)
-  , audioSpecSize :: !Word32
-    -- ^ Calculated audio buffer size in bytes
-  , audioSpecCallback :: AudioFormat sampleType -> MV.IOVector sampleType -> IO ()
-    -- ^ The function to call when the audio device needs more data
-  }
-  deriving (Typeable)
-
--- | How you intend to use an 'AudioDevice'
-data AudioDeviceUsage
-  = ForPlayback -- ^ The device will be used for sample playback.
-  | ForCapture -- ^ The device will be used for sample capture.
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-encodeUsage :: Num a => AudioDeviceUsage -> a
-encodeUsage usage =
-  case usage of
-    ForPlayback -> 0
-    ForCapture -> 1
-
--- | Used to indicate to SDL whether it is allowed to open other audio devices (if a property is marked as a 'Desire') or if it should fail if the device is unavailable ('Mandate').
-data Changeable a
-  = Mandate !a
-    -- ^ 'Mandate' this exact property value, and fail if a matching audio device cannot be found.
-  | Desire !a
-    -- ^ 'Desire' this property value, but allow other audio devices to be opened.
-  deriving (Data, Foldable, Functor, Eq, Generic, Read, Show, Traversable, Typeable)
-
-foldChangeable :: (a -> b) -> (a -> b) -> Changeable a -> b
-foldChangeable f _ (Mandate a) = f a
-foldChangeable _ g (Desire a) = g a
-
-unpackChangeable :: Changeable a -> a
-unpackChangeable = foldChangeable id id
-
--- | Whether a device should be locked or unlocked.
-data LockState
-  = Locked  -- ^ Lock the device, preventing the callback from producing data.
-  | Unlocked -- ^ Unlock the device, resuming calls to the callback.
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Lock an 'AudioDevice' such that its associated callback will not be called
--- until the device is unlocked.
-setAudioDeviceLocked :: MonadIO m => AudioDevice -> LockState -> m ()
-setAudioDeviceLocked (AudioDevice d) Locked = Raw.lockAudioDevice d
-setAudioDeviceLocked (AudioDevice d) Unlocked = Raw.unlockAudioDevice d
-
--- | Whether to allow an 'AudioDevice' to play sound or remain paused.
-data PlaybackState
-  = Pause -- ^ Pause the 'AudioDevice', which will stop producing/capturing audio.
-  | Play -- ^ Resume the 'AudioDevice'.
-  deriving (Bounded, Enum, Eq, Ord, Read, Data, Generic, Show, Typeable)
-
--- | Change the playback state of an 'AudioDevice'.
-setAudioDevicePlaybackState :: MonadIO m => AudioDevice -> PlaybackState -> m ()
-setAudioDevicePlaybackState (AudioDevice d) Pause = Raw.pauseAudioDevice d 1
-setAudioDevicePlaybackState (AudioDevice d) Play = Raw.pauseAudioDevice d 0
-
--- | Opened devices are always 'Playing' or 'Paused' in normal circumstances. A
--- failing device may change its status to 'Stopped' at any time, and closing a
--- device will progress to 'Stopped' too.
-data AudioDeviceStatus
-  = Playing -- ^ The 'AudioDevice' is playing.
-  | Paused -- ^ The 'AudioDevice' is paused.
-  | Stopped -- ^ The 'AudioDevice' is stopped.
-  deriving (Bounded, Enum, Eq, Ord, Read, Data, Generic, Show, Typeable)
-
--- | Query the state of an 'AudioDevice'.
-audioDeviceStatus :: MonadIO m => AudioDevice -> m AudioDeviceStatus
-audioDeviceStatus (AudioDevice d) = liftIO $
-  fromC "SDL.Audio.audioDeviceStatus" "SDL_AudioStatus" readStatus <$> Raw.getAudioDeviceStatus d
-  where
-  readStatus n = case n of
-    Raw.SDL_AUDIO_PLAYING -> Just Playing
-    Raw.SDL_AUDIO_STOPPED -> Just Stopped
-    Raw.SDL_AUDIO_PAUSED -> Just Paused
-    _ -> Nothing
-
--- clearQueuedAudio :: AudioDevice -> IO ()
--- clearQueuedAudio (AudioDevice d) = Raw.clearQueuedAudio d
-
--- | An abstract description of an audio driver on the host machine.
-newtype AudioDriver = AudioDriver Text
-  deriving (Eq, Show, Typeable)
-
--- | Get the human readable name of an 'AudioDriver'
-audioDriverName :: AudioDriver -> Text
-audioDriverName (AudioDriver t) = t
-
--- | Obtain a list of all possible audio drivers for this system. These drivers
--- can be used to specificially initialize the audio system.
-getAudioDrivers :: MonadIO m => m (V.Vector AudioDriver)
-getAudioDrivers = liftIO $ do
-  n <- Raw.getNumAudioDrivers
-  fmap V.fromList $
-    for [0 .. (n - 1)] $ \i -> do
-      -- TODO This could return null if i is invalid, but it's not an SDL_Error.
-      cstr <- Raw.getAudioDriver i
-      AudioDriver . Text.decodeUtf8 <$> BS.packCString cstr
-
--- | Explicitly initialize the audio system against a specific
--- 'AudioDriver'. Note that most users will not need to do this, as the normal
--- initialization routines will already take care of this for you.
-audioInit :: MonadIO m => AudioDriver -> m ()
-audioInit (AudioDriver n) = liftIO $ BS.useAsCString (Text.encodeUtf8 n) $
-  throwIfNeg_ "SDL.Audio.audioInit" "SDL_AudioInit" . Raw.audioInit
-
--- | Query SDL for the name of the currently initialized audio driver, if
--- possible. This will return 'Nothing' if no driver has been initialized.
-currentAudioDriver :: MonadIO m => m (Maybe Text)
-currentAudioDriver =
-  liftIO $ maybePeek (fmap Text.decodeUtf8 . BS.packCString) =<< Raw.getCurrentAudioDriver
+{-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE ScopedTypeVariables #-}++{-|++"SDL.Audio" provides a high-level API to SDL's audio device capabilities.++-}++module SDL.Audio+  ( -- * Managing 'AudioDevice's+    -- $audioDevice+    AudioDevice++    -- ** Opening and Closing 'AudioDevice's+  , openAudioDevice+  , closeAudioDevice+  , OpenDeviceSpec(..)+  , AudioDeviceUsage(..)+  , Channels(..)+  , Changeable(..)++    -- ** Working with Opened Devices+    -- *** Locking 'AudioDevice's+  , setAudioDeviceLocked+  , LockState(..)++    -- *** Switching Playback States+  , PlaybackState(..)+  , setAudioDevicePlaybackState++    -- *** Querying an 'AudioDevice's Status.+  , AudioDeviceStatus(..)+  , audioDeviceStatus++    -- ** 'AudioFormat'+  , AudioFormat(..)++    -- ** Enumerating 'AudioDevice's+  , getAudioDeviceNames++    -- * 'AudioSpec'+  , AudioSpec+  , audioSpecFreq+  , audioSpecFormat+  , audioSpecChannels+  , audioSpecSilence+  , audioSpecSize+  , audioSpecCallback++    -- * Audio Drivers+  , getAudioDrivers+  , currentAudioDriver+  , AudioDriver+  , audioDriverName++    -- * Explicit Initialization+  , audioInit+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Bits+import Data.Data (Data)+import Data.IORef (newIORef, writeIORef, readIORef)+import Data.Int (Int8, Int16, Int32)+import Data.Text (Text)+import Data.Traversable (for)+import Data.Typeable+import Data.Word+import Foreign.C.Types+import Foreign.ForeignPtr+import Foreign.Marshal.Alloc+import Foreign.Marshal.Utils+import Foreign.Ptr+import Foreign.Storable+import GHC.Exts (Constraint)+import GHC.Generics (Generic)+import SDL.Internal.Exception+import qualified Data.ByteString as BS+import qualified Data.Text.Encoding as Text+import qualified Data.Vector as V+import qualified Data.Vector.Storable.Mutable as MV+import qualified SDL.Raw.Audio as Raw+import qualified SDL.Raw.Enum as Raw+import qualified SDL.Raw.Types as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+import Data.Foldable (Foldable)+import Data.Traversable (Traversable)+#endif++{-++$audioDevice++In order to produce sound, you must first open an 'AudioDevice'. To do so,+pass an 'OpenDeviceSpec' to 'openAudioDevice'.++-}++-- | A specification to 'openAudioDevice', indicating the desired output format.+-- Note that many of these properties are 'Changeable', meaning that you can+-- choose whether or not SDL should interpret your specification as an+-- unbreakable request ('Mandate'), or as an approximation 'Desire'.+data OpenDeviceSpec = forall sampleType. OpenDeviceSpec+  { openDeviceFreq :: !(Changeable CInt)+    -- ^ The output audio frequency in herts.+  , openDeviceFormat :: !(Changeable (AudioFormat sampleType))+    -- ^ The format of audio that will be sampled from the output buffer.+  , openDeviceChannels :: !(Changeable Channels)+    -- ^ The amount of audio channels.+  , openDeviceSamples :: !Word16+    -- ^ Output audio buffer size in samples. This should be a power of 2.+  , openDeviceCallback :: forall actualSampleType. AudioFormat actualSampleType -> MV.IOVector actualSampleType -> IO ()+    -- ^ A callback to invoke whenever new sample data is required. The callback+    -- will be passed a single 'MV.MVector' that must be filled with audio data.+  , openDeviceUsage :: !AudioDeviceUsage+    -- ^ How you intend to use the opened 'AudioDevice' - either for outputting+    -- or capturing audio.+  , openDeviceName :: !(Maybe Text)+    -- ^ The name of the 'AudioDevice' that should be opened. If 'Nothing',+    -- any suitable 'AudioDevice' will be used.+  } deriving (Typeable)++-- | Attempt to open the closest matching 'AudioDevice', as specified by the+-- given 'OpenDeviceSpec'.+--+-- See @<https://wiki.libsdl.org/SDL_OpenAudioDevice SDL_OpenAudioDevice>@ for C documentation.+openAudioDevice :: MonadIO m => OpenDeviceSpec -> m (AudioDevice, AudioSpec)+openAudioDevice OpenDeviceSpec{..} = liftIO $+  maybeWith (BS.useAsCString . Text.encodeUtf8) openDeviceName $ \cDevName -> do+    anAudioFormatRef <- newIORef undefined+    cb <- Raw.mkAudioCallback $ \_ buffer len -> do+      fp <- newForeignPtr_ buffer+      anAudioFormat <- readIORef anAudioFormatRef+      case anAudioFormat of+        AnAudioFormat audioFormat ->+          case audioFormatStorable audioFormat of+            Dict -> openDeviceCallback audioFormat+                                       (MV.unsafeCast (MV.unsafeFromForeignPtr0 fp (fromIntegral len)))+    with (desiredSpec cb) $ \desiredSpecPtr ->+      alloca $ \actualSpecPtr -> do+        devId <- throwIf0 "SDL.Audio.openAudioDevice" "SDL_OpenAudioDevice" $+          Raw.openAudioDevice cDevName (encodeUsage openDeviceUsage) desiredSpecPtr actualSpecPtr changes+        actual <- peek actualSpecPtr+        let audioDevice = AudioDevice devId+            anAudioFormat = decodeAudioFormat (Raw.audioSpecFormat actual)+            spec =+              case anAudioFormat of+                AnAudioFormat audioFormat ->+                  AudioSpec { audioSpecFreq = Raw.audioSpecFreq actual+                            , audioSpecFormat = audioFormat+                            , audioSpecChannels = fromC "SDL.Audio.openAudioDevice" "audioSpecChannels" readChannels (Raw.audioSpecChannels actual)+                            , audioSpecSilence = Raw.audioSpecSilence actual+                            , audioSpecSize = Raw.audioSpecSize actual+                            , audioSpecSamples = Raw.audioSpecSamples actual+                            , audioSpecCallback = openDeviceCallback+                            }+        writeIORef anAudioFormatRef anAudioFormat+        return (audioDevice, spec)++  where+  changes = foldl (.|.) 0 [ foldChangeable (const Raw.SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) (const 0) openDeviceFreq+                          , foldChangeable (const Raw.SDL_AUDIO_ALLOW_FORMAT_CHANGE) (const 0) openDeviceFormat+                          , foldChangeable (const Raw.SDL_AUDIO_ALLOW_CHANNELS_CHANGE) (const 0) openDeviceChannels+                          ]++  channelsToWord8 Mono = 1+  channelsToWord8 Stereo = 2+  channelsToWord8 Quad = 4+  channelsToWord8 FivePointOne = 6++  readChannels 1 = Just Mono+  readChannels 2 = Just Stereo+  readChannels 4 = Just Quad+  readChannels 6 = Just FivePointOne+  readChannels _ = Nothing++  desiredSpec cb = Raw.AudioSpec+    { Raw.audioSpecFreq = unpackChangeable openDeviceFreq+    , Raw.audioSpecFormat = encodeAudioFormat (unpackChangeable openDeviceFormat)+    , Raw.audioSpecChannels = channelsToWord8 (unpackChangeable openDeviceChannels)+    , Raw.audioSpecSilence = 0+    , Raw.audioSpecSize = 0+    , Raw.audioSpecSamples = openDeviceSamples+    , Raw.audioSpecCallback = cb+    , Raw.audioSpecUserdata = nullPtr+    }++  -- Witness the 'Storable' instance for the sample type of any audio format. Needed in order to use 'MV.unsafeCast'+  audioFormatStorable :: AudioFormat sampleType -> Dict (Storable sampleType)+  audioFormatStorable Signed8BitAudio = Dict+  audioFormatStorable Unsigned8BitAudio = Dict+  audioFormatStorable Signed16BitLEAudio = Dict+  audioFormatStorable Signed16BitBEAudio = Dict+  audioFormatStorable Signed16BitNativeAudio = Dict+  audioFormatStorable Unsigned16BitLEAudio = Dict+  audioFormatStorable Unsigned16BitBEAudio = Dict+  audioFormatStorable Unsigned16BitNativeAudio = Dict+  audioFormatStorable Signed32BitLEAudio = Dict+  audioFormatStorable Signed32BitBEAudio = Dict+  audioFormatStorable Signed32BitNativeAudio = Dict+  audioFormatStorable FloatingLEAudio = Dict+  audioFormatStorable FloatingBEAudio = Dict+  audioFormatStorable FloatingNativeAudio = Dict++data Dict :: Constraint -> * where+  Dict :: c => Dict c++-- |+--+-- See @<https://wiki.libsdl.org/SDL_CloseAudioDevice SDL_CloseAudioDevice>@ for C documentation.+closeAudioDevice :: MonadIO m => AudioDevice -> m ()+closeAudioDevice (AudioDevice d) = Raw.closeAudioDevice d++-- | An open audio device. These can be created via 'openAudioDevice' and should be closed with 'closeAudioDevice'+newtype AudioDevice = AudioDevice (Raw.AudioDeviceID)+  deriving (Eq, Typeable)++-- | Enumerate all 'AudioDevice's attached to this system, that can be used as+-- specified by the given 'AudioDeviceUsage'. SDL cannot always guarantee+-- that this list can be produced, in which case 'Nothing' will be returned.+getAudioDeviceNames :: MonadIO m => AudioDeviceUsage -> m (Maybe (V.Vector Text))+getAudioDeviceNames usage = liftIO $ do+  n <- Raw.getNumAudioDevices usage'+  if n == -1+    then return Nothing+    else fmap (Just . V.fromList) $+         for [0 .. (n - 1)] $ \i -> do+           cstr <- throwIfNull "SDL.Audio.getAudioDeviceNames" "SDL_GetAudioDeviceName" $+             Raw.getAudioDeviceName i usage'+           Text.decodeUtf8 <$> BS.packCString cstr++  where usage' = encodeUsage usage++-- | Information about what format an audio bytestream is. The type variable+-- @t@ indicates the type used for audio buffer samples. It is determined+-- by the choice of the provided 'SampleBitSize'. For example:+--+-- @AudioFormat UnsignedInteger Sample8Bit Native :: AudioFormat Word8@+--+-- Indicating that an 8-bit audio format in the platforms native endianness+-- uses a buffer of 'Word8' values.+data AudioFormat sampleType where+  Signed8BitAudio :: AudioFormat Int8+  Unsigned8BitAudio :: AudioFormat Word8+  Signed16BitLEAudio :: AudioFormat Int16+  Signed16BitBEAudio :: AudioFormat Int16+  Signed16BitNativeAudio :: AudioFormat Int16+  Unsigned16BitLEAudio :: AudioFormat Word16+  Unsigned16BitBEAudio :: AudioFormat Word16+  Unsigned16BitNativeAudio :: AudioFormat Word16+  Signed32BitLEAudio :: AudioFormat Int32+  Signed32BitBEAudio :: AudioFormat Int32+  Signed32BitNativeAudio :: AudioFormat Int32+  FloatingLEAudio :: AudioFormat Float+  FloatingBEAudio :: AudioFormat Float+  FloatingNativeAudio :: AudioFormat Float++deriving instance Eq (AudioFormat sampleType)+deriving instance Ord (AudioFormat sampleType)+deriving instance Show (AudioFormat sampleType)++data AnAudioFormat where+  AnAudioFormat :: AudioFormat sampleType -> AnAudioFormat++encodeAudioFormat :: AudioFormat sampleType -> Word16+encodeAudioFormat Signed8BitAudio = Raw.SDL_AUDIO_S8+encodeAudioFormat Unsigned8BitAudio = Raw.SDL_AUDIO_U8+encodeAudioFormat Signed16BitLEAudio = Raw.SDL_AUDIO_S16LSB+encodeAudioFormat Signed16BitBEAudio = Raw.SDL_AUDIO_S16MSB+encodeAudioFormat Signed16BitNativeAudio = Raw.SDL_AUDIO_S16SYS+encodeAudioFormat Unsigned16BitLEAudio = Raw.SDL_AUDIO_U16LSB+encodeAudioFormat Unsigned16BitBEAudio = Raw.SDL_AUDIO_U16MSB+encodeAudioFormat Unsigned16BitNativeAudio = Raw.SDL_AUDIO_U16SYS+encodeAudioFormat Signed32BitLEAudio = Raw.SDL_AUDIO_S32LSB+encodeAudioFormat Signed32BitBEAudio = Raw.SDL_AUDIO_S32MSB+encodeAudioFormat Signed32BitNativeAudio = Raw.SDL_AUDIO_S32SYS+encodeAudioFormat FloatingLEAudio = Raw.SDL_AUDIO_F32LSB+encodeAudioFormat FloatingBEAudio = Raw.SDL_AUDIO_F32MSB+encodeAudioFormat FloatingNativeAudio = Raw.SDL_AUDIO_F32SYS++decodeAudioFormat :: Word16 -> AnAudioFormat+decodeAudioFormat Raw.SDL_AUDIO_S8 = AnAudioFormat Signed8BitAudio+decodeAudioFormat Raw.SDL_AUDIO_U8 = AnAudioFormat Unsigned8BitAudio+decodeAudioFormat Raw.SDL_AUDIO_S16LSB = AnAudioFormat Signed16BitLEAudio+decodeAudioFormat Raw.SDL_AUDIO_S16MSB = AnAudioFormat Signed16BitBEAudio+decodeAudioFormat Raw.SDL_AUDIO_S16SYS = AnAudioFormat Signed16BitNativeAudio+decodeAudioFormat Raw.SDL_AUDIO_U16LSB = AnAudioFormat Unsigned16BitLEAudio+decodeAudioFormat Raw.SDL_AUDIO_U16MSB = AnAudioFormat Unsigned16BitBEAudio+decodeAudioFormat Raw.SDL_AUDIO_U16SYS = AnAudioFormat Unsigned16BitNativeAudio+decodeAudioFormat Raw.SDL_AUDIO_S32LSB = AnAudioFormat Signed32BitLEAudio+decodeAudioFormat Raw.SDL_AUDIO_S32MSB = AnAudioFormat Signed32BitBEAudio+decodeAudioFormat Raw.SDL_AUDIO_S32SYS = AnAudioFormat Signed32BitNativeAudio+decodeAudioFormat Raw.SDL_AUDIO_F32LSB = AnAudioFormat FloatingLEAudio+decodeAudioFormat Raw.SDL_AUDIO_F32MSB = AnAudioFormat FloatingBEAudio+decodeAudioFormat Raw.SDL_AUDIO_F32SYS = AnAudioFormat FloatingNativeAudio+decodeAudioFormat x = error ("decodeAudioFormat failed: Unknown format " ++ show x)++-- | How many channels audio should be played on+data Channels+  = Mono -- ^ A single speaker configuration+  | Stereo -- ^ A traditional left/right stereo system+  | Quad+  | FivePointOne -- ^ 5.1 surround sound+  deriving (Bounded,Data,Enum,Eq,Generic,Ord,Read,Show,Typeable)++-- | 'AudioSpec' is the concrete specification of how an 'AudioDevice' was+-- sucessfully opened. Unlike 'OpenDeviceSpec', which specifies what you+-- /want/, 'AudioSpec' specifies what you /have/.+data AudioSpec = forall sampleType. AudioSpec+  { audioSpecFreq :: !CInt+    -- ^ DSP frequency (samples per second)+  , audioSpecFormat :: !(AudioFormat sampleType)+    -- ^ Audio data format+  , audioSpecChannels :: !Channels+    -- ^ Number of separate sound channels+  , audioSpecSilence :: !Word8+    -- ^ Calculated udio buffer silence value+  , audioSpecSamples :: !Word16+    -- ^ Audio buffer size in samples (power of 2)+  , audioSpecSize :: !Word32+    -- ^ Calculated audio buffer size in bytes+  , audioSpecCallback :: AudioFormat sampleType -> MV.IOVector sampleType -> IO ()+    -- ^ The function to call when the audio device needs more data+  }+  deriving (Typeable)++-- | How you intend to use an 'AudioDevice'+data AudioDeviceUsage+  = ForPlayback -- ^ The device will be used for sample playback.+  | ForCapture -- ^ The device will be used for sample capture.+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++encodeUsage :: Num a => AudioDeviceUsage -> a+encodeUsage usage =+  case usage of+    ForPlayback -> 0+    ForCapture -> 1++-- | Used to indicate to SDL whether it is allowed to open other audio devices (if a property is marked as a 'Desire') or if it should fail if the device is unavailable ('Mandate').+data Changeable a+  = Mandate !a+    -- ^ 'Mandate' this exact property value, and fail if a matching audio device cannot be found.+  | Desire !a+    -- ^ 'Desire' this property value, but allow other audio devices to be opened.+  deriving (Data, Foldable, Functor, Eq, Generic, Read, Show, Traversable, Typeable)++foldChangeable :: (a -> b) -> (a -> b) -> Changeable a -> b+foldChangeable f _ (Mandate a) = f a+foldChangeable _ g (Desire a) = g a++unpackChangeable :: Changeable a -> a+unpackChangeable = foldChangeable id id++-- | Whether a device should be locked or unlocked.+data LockState+  = Locked  -- ^ Lock the device, preventing the callback from producing data.+  | Unlocked -- ^ Unlock the device, resuming calls to the callback.+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++-- | Lock an 'AudioDevice' such that its associated callback will not be called+-- until the device is unlocked.+setAudioDeviceLocked :: MonadIO m => AudioDevice -> LockState -> m ()+setAudioDeviceLocked (AudioDevice d) Locked = Raw.lockAudioDevice d+setAudioDeviceLocked (AudioDevice d) Unlocked = Raw.unlockAudioDevice d++-- | Whether to allow an 'AudioDevice' to play sound or remain paused.+data PlaybackState+  = Pause -- ^ Pause the 'AudioDevice', which will stop producing/capturing audio.+  | Play -- ^ Resume the 'AudioDevice'.+  deriving (Bounded, Enum, Eq, Ord, Read, Data, Generic, Show, Typeable)++-- | Change the playback state of an 'AudioDevice'.+setAudioDevicePlaybackState :: MonadIO m => AudioDevice -> PlaybackState -> m ()+setAudioDevicePlaybackState (AudioDevice d) Pause = Raw.pauseAudioDevice d 1+setAudioDevicePlaybackState (AudioDevice d) Play = Raw.pauseAudioDevice d 0++-- | Opened devices are always 'Playing' or 'Paused' in normal circumstances. A+-- failing device may change its status to 'Stopped' at any time, and closing a+-- device will progress to 'Stopped' too.+data AudioDeviceStatus+  = Playing -- ^ The 'AudioDevice' is playing.+  | Paused -- ^ The 'AudioDevice' is paused.+  | Stopped -- ^ The 'AudioDevice' is stopped.+  deriving (Bounded, Enum, Eq, Ord, Read, Data, Generic, Show, Typeable)++-- | Query the state of an 'AudioDevice'.+audioDeviceStatus :: MonadIO m => AudioDevice -> m AudioDeviceStatus+audioDeviceStatus (AudioDevice d) = liftIO $+  fromC "SDL.Audio.audioDeviceStatus" "SDL_AudioStatus" readStatus <$> Raw.getAudioDeviceStatus d+  where+  readStatus n = case n of+    Raw.SDL_AUDIO_PLAYING -> Just Playing+    Raw.SDL_AUDIO_STOPPED -> Just Stopped+    Raw.SDL_AUDIO_PAUSED -> Just Paused+    _ -> Nothing++-- clearQueuedAudio :: AudioDevice -> IO ()+-- clearQueuedAudio (AudioDevice d) = Raw.clearQueuedAudio d++-- | An abstract description of an audio driver on the host machine.+newtype AudioDriver = AudioDriver Text+  deriving (Eq, Show, Typeable)++-- | Get the human readable name of an 'AudioDriver'+audioDriverName :: AudioDriver -> Text+audioDriverName (AudioDriver t) = t++-- | Obtain a list of all possible audio drivers for this system. These drivers+-- can be used to specificially initialize the audio system.+getAudioDrivers :: MonadIO m => m (V.Vector AudioDriver)+getAudioDrivers = liftIO $ do+  n <- Raw.getNumAudioDrivers+  fmap V.fromList $+    for [0 .. (n - 1)] $ \i -> do+      -- TODO This could return null if i is invalid, but it's not an SDL_Error.+      cstr <- Raw.getAudioDriver i+      AudioDriver . Text.decodeUtf8 <$> BS.packCString cstr++-- | Explicitly initialize the audio system against a specific+-- 'AudioDriver'. Note that most users will not need to do this, as the normal+-- initialization routines will already take care of this for you.+audioInit :: MonadIO m => AudioDriver -> m ()+audioInit (AudioDriver n) = liftIO $ BS.useAsCString (Text.encodeUtf8 n) $+  throwIfNeg_ "SDL.Audio.audioInit" "SDL_AudioInit" . Raw.audioInit++-- | Query SDL for the name of the currently initialized audio driver, if+-- possible. This will return 'Nothing' if no driver has been initialized.+currentAudioDriver :: MonadIO m => m (Maybe Text)+currentAudioDriver =+  liftIO $ maybePeek (fmap Text.decodeUtf8 . BS.packCString) =<< Raw.getCurrentAudioDriver
src/SDL/Event.hs view
@@ -1,905 +1,905 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE MultiWayIf #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-
--- | "SDL.Event" exports an interface for working with the SDL event model. Event handling allows your application to receive input from the user. Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like 'pollEvent' and 'waitEvent' you can observe and handle waiting input events.
---
--- The event queue itself is composed of a series of 'Event' values, one for each waiting event. 'Event' values are read from the queue with the 'pollEvent' function and it is then up to the application to process the information stored with them.
-module SDL.Event
-  ( -- * Polling events
-    pollEvent
-  , pollEvents
-  , mapEvents
-  , pumpEvents
-  , waitEvent
-  , waitEventTimeout
-    -- * Registering user events
-  , RegisteredEventType(..)
-  , RegisteredEventData(..)
-  , EventPushResult(..)
-  , emptyRegisteredEvent
-  , registerEvent
-    -- * Watching events
-  , EventWatchCallback
-  , EventWatch
-  , addEventWatch
-  , delEventWatch
-    -- * Event data
-  , Event(..)
-  , Timestamp
-  , EventPayload(..)
-    -- ** Window events
-  , WindowShownEventData(..)
-  , WindowHiddenEventData(..)
-  , WindowExposedEventData(..)
-  , WindowMovedEventData(..)
-  , WindowResizedEventData(..)
-  , WindowSizeChangedEventData(..)
-  , WindowMinimizedEventData(..)
-  , WindowMaximizedEventData(..)
-  , WindowRestoredEventData(..)
-  , WindowGainedMouseFocusEventData(..)
-  , WindowLostMouseFocusEventData(..)
-  , WindowGainedKeyboardFocusEventData(..)
-  , WindowLostKeyboardFocusEventData(..)
-  , WindowClosedEventData(..)
-  , SysWMEventData(..)
-    -- ** Keyboard events
-  , KeyboardEventData(..)
-  , TextEditingEventData(..)
-  , TextInputEventData(..)
-    -- ** Mouse events
-  , MouseMotionEventData(..)
-  , MouseButtonEventData(..)
-  , MouseWheelEventData(..)
-    -- ** Joystick events
-  , JoyAxisEventData(..)
-  , JoyBallEventData(..)
-  , JoyHatEventData(..)
-  , JoyButtonEventData(..)
-  , JoyDeviceEventData(..)
-    -- ** Controller events
-  , ControllerAxisEventData(..)
-  , ControllerButtonEventData(..)
-  , ControllerDeviceEventData(..)
-    -- ** Audio events
-  , AudioDeviceEventData(..)
-    -- ** User events
-  , UserEventData(..)
-    -- ** Touch events
-  , TouchFingerEventData(..)
-  , TouchFingerMotionEventData(..)
-    -- ** Gesture events
-  , MultiGestureEventData(..)
-  , DollarGestureEventData(..)
-    -- ** Drag and drop events
-  , DropEventData(..)
-    -- ** Unknown events
-  , UnknownEventData(..)
-    -- * Auxiliary event data
-  , InputMotion(..)
-  , MouseButton(..)
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Data (Data)
-import Data.Maybe (catMaybes)
-import Data.Text (Text)
-import Data.Typeable
-import Foreign hiding (throwIfNeg_)
-import Foreign.C
-import GHC.Generics (Generic)
-import SDL.Vect
-import SDL.Input.Joystick
-import SDL.Input.GameController
-import SDL.Input.Keyboard
-import SDL.Input.Mouse
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import SDL.Internal.Types (Window(Window))
-import qualified Data.ByteString.Char8 as BSC8
-import qualified Data.Text.Encoding as Text
-import qualified SDL.Raw as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
--- | A single SDL event. This event occured at 'eventTimestamp' and carries data under 'eventPayload'.
-data Event = Event
-  { eventTimestamp :: Timestamp
-    -- ^ The time the event occured.
-  , eventPayload :: EventPayload
-    -- ^ Data pertaining to this event.
-  } deriving (Eq, Ord, Generic, Show, Typeable)
-
-type Timestamp = Word32
-
--- | An enumeration of all possible SDL event types. This data type pairs up event types with
--- their payload, where possible.
-data EventPayload
-  = WindowShownEvent !WindowShownEventData
-  | WindowHiddenEvent !WindowHiddenEventData
-  | WindowExposedEvent !WindowExposedEventData
-  | WindowMovedEvent !WindowMovedEventData
-  | WindowResizedEvent !WindowResizedEventData
-  | WindowSizeChangedEvent !WindowSizeChangedEventData
-  | WindowMinimizedEvent !WindowMinimizedEventData
-  | WindowMaximizedEvent !WindowMaximizedEventData
-  | WindowRestoredEvent !WindowRestoredEventData
-  | WindowGainedMouseFocusEvent !WindowGainedMouseFocusEventData
-  | WindowLostMouseFocusEvent !WindowLostMouseFocusEventData
-  | WindowGainedKeyboardFocusEvent !WindowGainedKeyboardFocusEventData
-  | WindowLostKeyboardFocusEvent !WindowLostKeyboardFocusEventData
-  | WindowClosedEvent !WindowClosedEventData
-  | KeyboardEvent !KeyboardEventData
-  | TextEditingEvent !TextEditingEventData
-  | TextInputEvent !TextInputEventData
-  | KeymapChangedEvent
-  | MouseMotionEvent !MouseMotionEventData
-  | MouseButtonEvent !MouseButtonEventData
-  | MouseWheelEvent !MouseWheelEventData
-  | JoyAxisEvent !JoyAxisEventData
-  | JoyBallEvent !JoyBallEventData
-  | JoyHatEvent !JoyHatEventData
-  | JoyButtonEvent !JoyButtonEventData
-  | JoyDeviceEvent !JoyDeviceEventData
-  | ControllerAxisEvent !ControllerAxisEventData
-  | ControllerButtonEvent !ControllerButtonEventData
-  | ControllerDeviceEvent !ControllerDeviceEventData
-  | AudioDeviceEvent !AudioDeviceEventData
-  | QuitEvent
-  | UserEvent !UserEventData
-  | SysWMEvent !SysWMEventData
-  | TouchFingerEvent !TouchFingerEventData
-  | TouchFingerMotionEvent !TouchFingerMotionEventData
-  | MultiGestureEvent !MultiGestureEventData
-  | DollarGestureEvent !DollarGestureEventData
-  | DropEvent !DropEventData
-  | ClipboardUpdateEvent
-  | UnknownEvent !UnknownEventData
-  deriving (Eq, Ord, Generic, Show, Typeable)
-
--- | A window has been shown.
-newtype WindowShownEventData =
-  WindowShownEventData {windowShownEventWindow :: Window
-                        -- ^ The associated 'Window'.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A window has been hidden.
-newtype WindowHiddenEventData =
-  WindowHiddenEventData {windowHiddenEventWindow :: Window
-                         -- ^ The associated 'Window'.
-                        }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A part of a window has been exposed - where exposure means to become visible (for example, an overlapping window no longer overlaps with the window).
-newtype WindowExposedEventData =
-  WindowExposedEventData {windowExposedEventWindow :: Window
-                          -- ^ The associated 'Window'.
-                         }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A 'Window' has been moved.
-data WindowMovedEventData =
-  WindowMovedEventData {windowMovedEventWindow :: !Window
-                        -- ^ The associated 'Window'.
-                       ,windowMovedEventPosition :: !(Point V2 Int32)
-                        -- ^ The new position of the 'Window'.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Window has been resized. This is event is always preceded by 'WindowSizeChangedEvent'.
-data WindowResizedEventData =
-  WindowResizedEventData {windowResizedEventWindow :: !Window
-                          -- ^ The associated 'Window'.
-                         ,windowResizedEventSize :: !(V2 Int32)
-                          -- ^ The new size of the 'Window'.
-                         }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window size has changed, either as a result of an API call or through the system or user changing the window size; this event is followed by 'WindowResizedEvent' if the size was changed by an external event, i.e. the user or the window manager.
-data WindowSizeChangedEventData =
-  WindowSizeChangedEventData {windowSizeChangedEventWindow :: !Window
-                              -- ^ The associated 'Window'.
-                             ,windowSizeChangedEventSize :: !(V2 Int32)
-                              -- ^ The new size of the 'Window'.
-                             }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has been minimized.
-newtype WindowMinimizedEventData =
-  WindowMinimizedEventData {windowMinimizedEventWindow :: Window
-                            -- ^ The associated 'Window'.
-                           }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has been maximized.
-newtype WindowMaximizedEventData =
-  WindowMaximizedEventData {windowMaximizedEventWindow :: Window
-                            -- ^ The associated 'Window'.
-                           }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has been restored to normal size and position.
-newtype WindowRestoredEventData =
-  WindowRestoredEventData {windowRestoredEventWindow :: Window
-                           -- ^ The associated 'Window'.
-                          }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has gained mouse focus.
-newtype WindowGainedMouseFocusEventData =
-  WindowGainedMouseFocusEventData {windowGainedMouseFocusEventWindow :: Window
-                                   -- ^ The associated 'Window'.
-                                  }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has lost mouse focus.
-newtype WindowLostMouseFocusEventData =
-  WindowLostMouseFocusEventData {windowLostMouseFocusEventWindow :: Window
-                                 -- ^ The associated 'Window'.
-                                }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has gained keyboard focus.
-newtype WindowGainedKeyboardFocusEventData =
-  WindowGainedKeyboardFocusEventData {windowGainedKeyboardFocusEventWindow :: Window
-                                      -- ^ The associated 'Window'.
-                                     }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window has lost keyboard focus.
-newtype WindowLostKeyboardFocusEventData =
-  WindowLostKeyboardFocusEventData {windowLostKeyboardFocusEventWindow :: Window
-                                    -- ^ The associated 'Window'.
-                                   }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | The window manager requests that the window be closed.
-newtype WindowClosedEventData =
-  WindowClosedEventData {windowClosedEventWindow :: Window
-                         -- ^ The associated 'Window'.
-                        }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A keyboard key has been pressed or released.
-data KeyboardEventData =
-  KeyboardEventData {keyboardEventWindow :: !(Maybe Window)
-                     -- ^ The 'Window' with keyboard focus, if any.
-                    ,keyboardEventKeyMotion :: !InputMotion
-                     -- ^ Whether the key was pressed or released.
-                    ,keyboardEventRepeat :: !Bool
-                     -- ^ 'True' if this is a repeating key press from the user holding the key down.
-                    ,keyboardEventKeysym :: !Keysym
-                     -- ^ A description of the key that this event pertains to.
-                    }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Keyboard text editing event information.
-data TextEditingEventData =
-  TextEditingEventData {textEditingEventWindow :: !(Maybe Window)
-                        -- ^ The 'Window' with keyboard focus, if any.
-                       ,textEditingEventText :: !Text
-                        -- ^ The editing text.
-                       ,textEditingEventStart :: !Int32
-                        -- ^ The location to begin editing from.
-                       ,textEditingEventLength :: !Int32
-                        -- ^ The number of characters to edit from the start point.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Keyboard text input event information.
-data TextInputEventData =
-  TextInputEventData {textInputEventWindow :: !(Maybe Window)
-                      -- ^ The 'Window' with keyboard focus, if any.
-                     ,textInputEventText :: !Text
-                      -- ^ The input text.
-                     }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A mouse or pointer device was moved.
-data MouseMotionEventData =
-  MouseMotionEventData {mouseMotionEventWindow :: !(Maybe Window)
-                        -- ^ The 'Window' with mouse focus, if any.
-                       ,mouseMotionEventWhich :: !MouseDevice
-                        -- ^ The 'MouseDevice' that was moved.
-                       ,mouseMotionEventState :: ![MouseButton]
-                        -- ^ A collection of 'MouseButton's that are currently held down.
-                       ,mouseMotionEventPos :: !(Point V2 Int32)
-                        -- ^ The new position of the mouse.
-                       ,mouseMotionEventRelMotion :: !(V2 Int32)
-                        -- ^ The relative mouse motion of the mouse.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A mouse or pointer device button was pressed or released.
-data MouseButtonEventData =
-  MouseButtonEventData {mouseButtonEventWindow :: !(Maybe Window)
-                        -- ^ The 'Window' with mouse focus, if any.
-                       ,mouseButtonEventMotion :: !InputMotion
-                        -- ^ Whether the button was pressed or released.
-                       ,mouseButtonEventWhich :: !MouseDevice
-                        -- ^ The 'MouseDevice' whose button was pressed or released.
-                       ,mouseButtonEventButton :: !MouseButton
-                        -- ^ The button that was pressed or released.
-                       ,mouseButtonEventClicks :: !Word8
-                        -- ^ The amount of clicks. 1 for a single-click, 2 for a double-click, etc.
-                       ,mouseButtonEventPos :: !(Point V2 Int32)
-                        -- ^ The coordinates of the mouse click.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Mouse wheel event information.
-data MouseWheelEventData =
-  MouseWheelEventData {mouseWheelEventWindow :: !(Maybe Window)
-                        -- ^ The 'Window' with mouse focus, if any.
-                      ,mouseWheelEventWhich :: !MouseDevice
-                       -- ^ The 'MouseDevice' whose wheel was scrolled.
-                      ,mouseWheelEventPos :: !(V2 Int32)
-                       -- ^ The amount scrolled.
-                      ,mouseWheelEventDirection :: !MouseScrollDirection
-                       -- ^ The scroll direction mode.
-                      }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Joystick axis motion event information
-data JoyAxisEventData =
-  JoyAxisEventData {joyAxisEventWhich :: !Raw.JoystickID
-                    -- ^ The instance id of the joystick that reported the event.
-                   ,joyAxisEventAxis :: !Word8
-                    -- ^ The index of the axis that changed.
-                   ,joyAxisEventValue :: !Int16
-                    -- ^ The current position of the axis, ranging between -32768 and 32767.
-                   }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Joystick trackball motion event information.
-data JoyBallEventData =
-  JoyBallEventData {joyBallEventWhich :: !Raw.JoystickID
-                    -- ^ The instance id of the joystick that reported the event.
-                   ,joyBallEventBall :: !Word8
-                    -- ^ The index of the trackball that changed.
-                   ,joyBallEventRelMotion :: !(V2 Int16)
-                    -- ^ The relative motion of the trackball.
-                   }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Joystick hat position change event information
-data JoyHatEventData =
-  JoyHatEventData {joyHatEventWhich :: !Raw.JoystickID
-                    -- ^ The instance id of the joystick that reported the event.
-                  ,joyHatEventHat :: !Word8
-                   -- ^ The index of the hat that changed.
-                  ,joyHatEventValue :: !JoyHatPosition
-                   -- ^ The new position of the hat.
-                  }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Joystick button event information.
-data JoyButtonEventData =
-  JoyButtonEventData {joyButtonEventWhich :: !Raw.JoystickID
-                      -- ^ The instance id of the joystick that reported the event.
-                     ,joyButtonEventButton :: !Word8
-                      -- ^ The index of the button that changed.
-                     ,joyButtonEventState :: !JoyButtonState
-                      -- ^ The state of the button.
-                     }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Joystick device event information.
-data JoyDeviceEventData =
-  JoyDeviceEventData {joyDeviceEventConnection :: !JoyDeviceConnection
-                      -- ^ Was the device added or removed?
-                     ,joyDeviceEventWhich :: !Int32
-                      -- ^ The instance id of the joystick that reported the event.
-                     }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Game controller axis motion event information.
-data ControllerAxisEventData =
-  ControllerAxisEventData {controllerAxisEventWhich :: !Raw.JoystickID
-                           -- ^ The joystick instance ID that reported the event.
-                          ,controllerAxisEventAxis :: !Word8
-                           -- ^ The index of the axis.
-                          ,controllerAxisEventValue :: !Int16
-                           -- ^ The axis value ranging between -32768 and 32767.
-                          }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Game controller button event information
-data ControllerButtonEventData =
-  ControllerButtonEventData {controllerButtonEventWhich :: !Raw.JoystickID
-                           -- ^ The joystick instance ID that reported the event.
-                            ,controllerButtonEventButton :: !ControllerButton
-                             -- ^ The controller button.
-                            ,controllerButtonEventState :: !ControllerButtonState
-                             -- ^ The state of the button.
-                            }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Controller device event information
-data ControllerDeviceEventData =
-  ControllerDeviceEventData {controllerDeviceEventConnection :: !ControllerDeviceConnection
-                             -- ^ Was the device added, removed, or remapped?
-                            ,controllerDeviceEventWhich :: !Int32
-                             -- ^ The joystick instance ID that reported the event.
-                            }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
-data AudioDeviceEventData =
-  AudioDeviceEventData {audioDeviceEventIsAddition :: !Bool
-                        -- ^ If the audio device is an addition, or a removal.
-                       ,audioDeviceEventWhich :: !Word32
-                        -- ^ The audio device ID that reported the event.
-                       ,audioDeviceEventIsCapture :: !Bool
-                        -- ^ If the audio device is a capture device.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Event data for application-defined events.
-data UserEventData =
-  UserEventData {userEventType :: !Word32
-                 -- ^ User defined event type.
-                ,userEventWindow :: !(Maybe Window)
-                 -- ^ The associated 'Window'.
-                ,userEventCode :: !Int32
-                 -- ^ User defined event code.
-                ,userEventData1 :: !(Ptr ())
-                 -- ^ User defined data pointer.
-                ,userEventData2 :: !(Ptr ())
-                 -- ^ User defined data pointer.
-                }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A video driver dependent system event
-newtype SysWMEventData =
-  SysWMEventData {sysWMEventMsg :: Raw.SysWMmsg}
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Finger touch event information.
-data TouchFingerEventData =
-  TouchFingerEventData {touchFingerEventTouchID :: !Raw.TouchID
-                        -- ^ The touch device index.
-                       ,touchFingerEventFingerID :: !Raw.FingerID
-                        -- ^ The finger index.
-                       ,touchFingerEventMotion :: !InputMotion
-                        -- ^ Whether the finger was pressed or released.
-                       ,touchFingerEventPos :: !(Point V2 CFloat)
-                        -- ^ The location of the touch event, normalized between 0 and 1.
-                       ,touchFingerEventPressure :: !CFloat
-                        -- ^ The quantity of the pressure applied, normalized between 0 and 1.
-                       }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Finger motion event information.
-data TouchFingerMotionEventData =
-  TouchFingerMotionEventData {touchFingerMotionEventTouchID :: !Raw.TouchID
-                              -- ^ The touch device index.
-                             ,touchFingerMotionEventFingerID :: !Raw.FingerID
-                              -- ^ The finger index.
-                             ,touchFingerMotionEventPos :: !(Point V2 CFloat)
-                              -- ^ The location of the touch event, normalized between 0 and 1.
-                             ,touchFingerMotionEventRelMotion :: !(V2 CFloat)
-                              -- ^ The distance moved, normalized between -1 and 1.
-                             ,touchFingerMotionEventPressure :: !CFloat
-                              -- ^ The quantity of the pressure applied, normalized between 0 and 1.
-                             }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Multiple finger gesture event information
-data MultiGestureEventData =
-  MultiGestureEventData {multiGestureEventTouchID :: !Raw.TouchID
-                         -- ^ The touch device index.
-                        ,multiGestureEventDTheta :: !CFloat
-                         -- ^ The amount that the fingers rotated during this motion.
-                        ,multiGestureEventDDist :: !CFloat
-                         -- ^ The amount that the fingers pinched during this motion.
-                        ,multiGestureEventPos :: !(Point V2 CFloat)
-                         -- ^ The normalized center of the gesture.
-                        ,multiGestureEventNumFingers :: !Word16
-                         -- ^ The number of fingers used in this gesture.
-                        }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | Complex gesture event information.
-data DollarGestureEventData =
-  DollarGestureEventData {dollarGestureEventTouchID :: !Raw.TouchID
-                          -- ^ The touch device index.
-                         ,dollarGestureEventGestureID :: !Raw.GestureID
-                          -- ^ The unique id of the closest gesture to the performed stroke.
-                         ,dollarGestureEventNumFingers :: !Word32
-                          -- ^ The number of fingers used to draw the stroke.
-                         ,dollarGestureEventError :: !CFloat
-                          -- ^ The difference between the gesture template and the actual performed gesture (lower errors correspond to closer matches).
-                         ,dollarGestureEventPos :: !(Point V2 CFloat)
-                          -- ^ The normalized center of the gesture.
-                         }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | An event used to request a file open by the system
-newtype DropEventData =
-  DropEventData {dropEventFile :: CString
-                 -- ^ The file name.
-                }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | SDL reported an unknown event type.
-newtype UnknownEventData =
-  UnknownEventData {unknownEventType :: Word32
-                    -- ^ The unknown event code.
-                   }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
-data InputMotion = Released | Pressed
-  deriving (Bounded, Enum, Eq, Ord, Read, Data, Generic, Show, Typeable)
-
-ccharStringToText :: [CChar] -> Text
-ccharStringToText = Text.decodeUtf8 . BSC8.pack . map castCCharToChar
-
-fromRawKeysym :: Raw.Keysym -> Keysym
-fromRawKeysym (Raw.Keysym scancode keycode modifier) =
-  Keysym scancode' keycode' modifier'
-  where scancode' = fromNumber scancode
-        keycode'  = fromNumber keycode
-        modifier' = fromNumber (fromIntegral modifier)
-
-convertRaw :: Raw.Event -> IO Event
-convertRaw (Raw.WindowEvent t ts a b c d) =
-  do w <- fmap Window (Raw.getWindowFromID a)
-     return (Event ts
-                   (case b of
-                      Raw.SDL_WINDOWEVENT_SHOWN ->
-                        WindowShownEvent (WindowShownEventData w)
-                      Raw.SDL_WINDOWEVENT_HIDDEN ->
-                        WindowHiddenEvent (WindowHiddenEventData w)
-                      Raw.SDL_WINDOWEVENT_EXPOSED ->
-                        WindowExposedEvent (WindowExposedEventData w)
-                      Raw.SDL_WINDOWEVENT_MOVED ->
-                        WindowMovedEvent
-                          (WindowMovedEventData w
-                                                (P (V2 c d)))
-                      Raw.SDL_WINDOWEVENT_RESIZED ->
-                        WindowResizedEvent
-                          (WindowResizedEventData w
-                                                  (V2 c d))
-                      Raw.SDL_WINDOWEVENT_SIZE_CHANGED ->
-                        WindowSizeChangedEvent (WindowSizeChangedEventData w (V2 c d))
-                      Raw.SDL_WINDOWEVENT_MINIMIZED ->
-                        WindowMinimizedEvent (WindowMinimizedEventData w)
-                      Raw.SDL_WINDOWEVENT_MAXIMIZED ->
-                        WindowMaximizedEvent (WindowMaximizedEventData w)
-                      Raw.SDL_WINDOWEVENT_RESTORED ->
-                        WindowRestoredEvent (WindowRestoredEventData w)
-                      Raw.SDL_WINDOWEVENT_ENTER ->
-                        WindowGainedMouseFocusEvent (WindowGainedMouseFocusEventData w)
-                      Raw.SDL_WINDOWEVENT_LEAVE ->
-                        WindowLostMouseFocusEvent (WindowLostMouseFocusEventData w)
-                      Raw.SDL_WINDOWEVENT_FOCUS_GAINED ->
-                        WindowGainedKeyboardFocusEvent (WindowGainedKeyboardFocusEventData w)
-                      Raw.SDL_WINDOWEVENT_FOCUS_LOST ->
-                        WindowLostKeyboardFocusEvent (WindowLostKeyboardFocusEventData w)
-                      Raw.SDL_WINDOWEVENT_CLOSE ->
-                        WindowClosedEvent (WindowClosedEventData w)
-                      _ ->
-                        UnknownEvent (UnknownEventData t)))
-convertRaw (Raw.KeyboardEvent Raw.SDL_KEYDOWN ts a _ c d) =
-  do w <- getWindowFromID a
-     return (Event ts
-                   (KeyboardEvent
-                      (KeyboardEventData w
-                                         Pressed
-                                         (c /= 0)
-                                         (fromRawKeysym d))))
-convertRaw (Raw.KeyboardEvent Raw.SDL_KEYUP ts a _ c d) =
-  do w <- getWindowFromID a
-     return (Event ts
-                   (KeyboardEvent
-                      (KeyboardEventData w
-                                         Released
-                                         (c /= 0)
-                                         (fromRawKeysym d))))
-convertRaw Raw.KeyboardEvent{} = error "convertRaw: Unknown keyboard motion"
-convertRaw (Raw.TextEditingEvent _ ts a b c d) =
-  do w <- getWindowFromID a
-     return (Event ts
-                   (TextEditingEvent
-                      (TextEditingEventData w
-                                            (ccharStringToText b)
-                                            c
-                                            d)))
-convertRaw (Raw.TextInputEvent _ ts a b) =
-  do w <- getWindowFromID a
-     return (Event ts
-                   (TextInputEvent
-                      (TextInputEventData w
-                                          (ccharStringToText b))))
-convertRaw (Raw.KeymapChangedEvent _ ts) =
-  return (Event ts KeymapChangedEvent)
-convertRaw (Raw.MouseMotionEvent _ ts a b c d e f g) =
-  do w <- getWindowFromID a
-     let buttons =
-           catMaybes [(Raw.SDL_BUTTON_LMASK `test` c) ButtonLeft
-                     ,(Raw.SDL_BUTTON_RMASK `test` c) ButtonRight
-                     ,(Raw.SDL_BUTTON_MMASK `test` c) ButtonMiddle
-                     ,(Raw.SDL_BUTTON_X1MASK `test` c) ButtonX1
-                     ,(Raw.SDL_BUTTON_X2MASK `test` c) ButtonX2]
-     return (Event ts
-                   (MouseMotionEvent
-                      (MouseMotionEventData w
-                                            (fromNumber b)
-                                            buttons
-                                            (P (V2 d e))
-                                            (V2 f g))))
-  where mask `test` x =
-          if mask .&. x /= 0
-             then Just
-             else const Nothing
-convertRaw (Raw.MouseButtonEvent t ts a b c _ e f g) =
-  do w <- getWindowFromID a
-     let motion
-           | t == Raw.SDL_MOUSEBUTTONUP = Released
-           | t == Raw.SDL_MOUSEBUTTONDOWN = Pressed
-           | otherwise = error "convertRaw: Unexpected mouse button motion"
-     return (Event ts
-                   (MouseButtonEvent
-                      (MouseButtonEventData w
-                                            motion
-                                            (fromNumber b)
-                                            (fromNumber c)
-                                            e
-                                            (P (V2 f g)))))
-convertRaw (Raw.MouseWheelEvent _ ts a b c d e) =
-  do w <- getWindowFromID a
-     return (Event ts
-                   (MouseWheelEvent
-                      (MouseWheelEventData w
-                                           (fromNumber b)
-                                           (V2 c d)
-                                           (fromNumber e))))
-convertRaw (Raw.JoyAxisEvent _ ts a b c) =
-  return (Event ts (JoyAxisEvent (JoyAxisEventData a b c)))
-convertRaw (Raw.JoyBallEvent _ ts a b c d) =
-  return (Event ts
-                (JoyBallEvent
-                   (JoyBallEventData a
-                                     b
-                                     (V2 c d))))
-convertRaw (Raw.JoyHatEvent _ ts a b c) =
-  return (Event ts
-                (JoyHatEvent
-                   (JoyHatEventData a
-                                    b
-                                    (fromNumber c))))
-convertRaw (Raw.JoyButtonEvent _ ts a b c) =
-  return (Event ts (JoyButtonEvent (JoyButtonEventData a b (fromNumber c))))
-convertRaw (Raw.JoyDeviceEvent t ts a) =
-  return (Event ts (JoyDeviceEvent (JoyDeviceEventData (fromNumber t) a)))
-convertRaw (Raw.ControllerAxisEvent _ ts a b c) =
-  return (Event ts (ControllerAxisEvent (ControllerAxisEventData a b c)))
-convertRaw (Raw.ControllerButtonEvent t ts a b _) =
-  return (Event ts 
-           (ControllerButtonEvent
-             (ControllerButtonEventData a 
-                                        (fromNumber $ fromIntegral b)
-                                        (fromNumber t))))
-convertRaw (Raw.ControllerDeviceEvent t ts a) =
-  return (Event ts (ControllerDeviceEvent (ControllerDeviceEventData (fromNumber t) a)))
-convertRaw (Raw.AudioDeviceEvent Raw.SDL_AUDIODEVICEADDED ts a b) =
-  return (Event ts (AudioDeviceEvent (AudioDeviceEventData True a (b /= 0))))
-convertRaw (Raw.AudioDeviceEvent Raw.SDL_AUDIODEVICEREMOVED ts a b) =
-  return (Event ts (AudioDeviceEvent (AudioDeviceEventData False a (b /= 0))))
-convertRaw Raw.AudioDeviceEvent{} =
-  error "convertRaw: Unknown audio device motion"
-convertRaw (Raw.QuitEvent _ ts) =
-  return (Event ts QuitEvent)
-convertRaw (Raw.UserEvent t ts a b c d) =
-  do w <- getWindowFromID a
-     return (Event ts (UserEvent (UserEventData t w b c d)))
-convertRaw (Raw.SysWMEvent _ ts a) =
-  return (Event ts (SysWMEvent (SysWMEventData a)))
-convertRaw (Raw.TouchFingerEvent t ts a b c d e f g) =
-  do let touchFingerEvent motion = TouchFingerEvent
-                                     (TouchFingerEventData a
-                                                           b
-                                                           motion
-                                                           (P (V2 c d))
-                                                           g)
-     let touchFingerMotionEvent = TouchFingerMotionEvent
-                                    (TouchFingerMotionEventData a
-                                                                b
-                                                                (P (V2 c d))
-                                                                (V2 e f)
-                                                                g)
-     case t of
-       Raw.SDL_FINGERDOWN   -> return (Event ts (touchFingerEvent Pressed))
-       Raw.SDL_FINGERUP     -> return (Event ts (touchFingerEvent Released))
-       Raw.SDL_FINGERMOTION -> return (Event ts touchFingerMotionEvent)
-       _                    -> error "convertRaw: Unexpected touch finger event"
-convertRaw (Raw.MultiGestureEvent _ ts a b c d e f) =
-  return (Event ts
-                (MultiGestureEvent
-                   (MultiGestureEventData a
-                                          b
-                                          c
-                                          (P (V2 d e))
-                                          f)))
-convertRaw (Raw.DollarGestureEvent _ ts a b c d e f) =
-  return (Event ts
-                (DollarGestureEvent
-                   (DollarGestureEventData a
-                                           b
-                                           c
-                                           d
-                                           (P (V2 e f)))))
-convertRaw (Raw.DropEvent _ ts a) =
-  return (Event ts (DropEvent (DropEventData a)))
-convertRaw (Raw.ClipboardUpdateEvent _ ts) =
-  return (Event ts ClipboardUpdateEvent)
-convertRaw (Raw.UnknownEvent t ts) =
-  return (Event ts (UnknownEvent (UnknownEventData t)))
-
--- | Poll for currently pending events. You can only call this function in the thread that set the video mode.
-pollEvent :: MonadIO m => m (Maybe Event)
-pollEvent = liftIO $ alloca $ \e -> do
-  n <- Raw.pollEvent e
-  if n == 0
-     then return Nothing
-     else fmap Just (peek e >>= convertRaw)
-
--- | Clear the event queue by polling for all pending events.
-pollEvents :: (Functor m, MonadIO m) => m [Event]
-pollEvents =
-  do e <- pollEvent
-     case e of
-       Nothing -> return []
-       Just e' -> (e' :) <$> pollEvents
-
--- | Run a monadic computation, accumulating over all known 'Event's.
---
--- This can be useful when used with a state monad, allowing you to fold all events together.
-mapEvents :: MonadIO m => (Event -> m ()) -> m ()
-mapEvents h = do
-  event' <- pollEvent
-  case event' of
-    Just event -> h event >> mapEvents h
-    Nothing -> return ()
-
--- | Wait indefinitely for the next available event.
-waitEvent :: MonadIO m => m Event
-waitEvent = liftIO $ alloca $ \e -> do
-  throwIfNeg_ "SDL.Events.waitEvent" "SDL_WaitEvent" $
-    Raw.waitEvent e
-  peek e >>= convertRaw
-
--- | Wait until the specified timeout for the next available amount.
-waitEventTimeout :: MonadIO m
-                 => CInt -- ^ The maximum amount of time to wait, in milliseconds.
-                 -> m (Maybe Event)
-waitEventTimeout timeout = liftIO $ alloca $ \e -> do
-  n <- Raw.waitEventTimeout e timeout
-  if n == 0
-     then return Nothing
-     else fmap Just (peek e >>= convertRaw)
-
--- | A user defined event structure that has been registered with SDL.
---
--- Use 'registerEvent', below, to obtain an instance.
-data RegisteredEventType a =
-  RegisteredEventType {pushRegisteredEvent :: a -> IO EventPushResult
-                      ,getRegisteredEvent :: Event -> IO (Maybe a)
-                      }
-
--- | A record used to convert between SDL Events and user-defined data structures.
---
--- Used for 'registerEvent', below.
-data RegisteredEventData =
-  RegisteredEventData {registeredEventWindow :: !(Maybe Window)
-                       -- ^ The associated 'Window'.
-                      ,registeredEventCode :: !Int32
-                       -- ^ User defined event code.
-                      ,registeredEventData1 :: !(Ptr ())
-                       -- ^ User defined data pointer.
-                      ,registeredEventData2 :: !(Ptr ())
-                       -- ^ User defined data pointer.
-                      }
-  deriving (Eq,Ord,Generic,Show,Typeable)
-
--- | A registered event with no associated data.
---
--- This is a resonable baseline to modify for converting to
--- 'RegisteredEventData'.
-emptyRegisteredEvent :: RegisteredEventData
-emptyRegisteredEvent = RegisteredEventData Nothing 0 nullPtr nullPtr
-
--- | Possible results of an attempted push of an event to the queue.
-data EventPushResult = EventPushSuccess | EventPushFiltered | EventPushFailure Text
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Register a new event type with SDL.
---
--- Provide functions that convert between 'UserEventData' and your structure.
--- You can then use 'pushRegisteredEvent' to add a custom event of the
--- registered type to the queue, and 'getRegisteredEvent' to test for such
--- events in the main loop.
-registerEvent :: MonadIO m
-              => (RegisteredEventData -> Timestamp -> IO (Maybe a))
-              -> (a -> IO RegisteredEventData)
-              -> m (Maybe (RegisteredEventType a))
-registerEvent registeredEventDataToEvent eventToRegisteredEventData = do
-  typ <- Raw.registerEvents 1
-  if typ == maxBound
-  then return Nothing
-  else
-    let pushEv ev = do
-          RegisteredEventData mWin code d1 d2 <- eventToRegisteredEventData ev
-          windowID <- case mWin of
-            Just (Window w) -> Raw.getWindowID w
-            Nothing         -> return 0
-          -- timestamp will be filled in by SDL
-          let rawEvent = Raw.UserEvent typ 0 windowID code d1 d2
-          liftIO . alloca $ \eventPtr -> do
-            poke eventPtr rawEvent
-            pushResult <- Raw.pushEvent eventPtr
-            case pushResult of
-              1 -> return $ EventPushSuccess
-              0 -> return $ EventPushFiltered
-              _ -> EventPushFailure <$> getError
-
-        getEv (Event ts (UserEvent (UserEventData typ mWin code d1 d2))) =
-          registeredEventDataToEvent (RegisteredEventData mWin code d1 d2) ts
-        getEv _ = return Nothing
-
-    in return . Just $ RegisteredEventType pushEv getEv
-
--- | Pump the event loop, gathering events from the input devices.
---
--- This function updates the event queue and internal input device state.
---
--- This should only be run in the thread that initialized the video subsystem, and for extra safety, you should consider only doing those things on the main thread in any case.
---
--- 'pumpEvents' gathers all the pending input information from devices and places it in the event queue. Without calls to 'pumpEvents' no events would ever be placed on the queue. Often the need for calls to 'pumpEvents' is hidden from the user since 'pollEvent' and 'waitEvent' implicitly call 'pumpEvents'. However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call 'pumpEvents' to force an event queue update.
---
--- See @<https://wiki.libsdl.org/SDL_PumpEvents SDL_PumpEvents>@ for C documentation.
-pumpEvents :: MonadIO m => m ()
-pumpEvents = Raw.pumpEvents
-
--- | An 'EventWatchCallback' can process and respond to an event
--- when it is added to the event queue.
-type EventWatchCallback = Event -> IO ()
-newtype EventWatch = EventWatch {runEventWatchRemoval :: IO ()}
-
--- | Trigger an 'EventWatchCallback' when an event is added to the SDL
--- event queue.
---
--- See @<https://wiki.libsdl.org/SDL_AddEventWatch>@ for C documentation.
-addEventWatch :: MonadIO m => EventWatchCallback -> m EventWatch
-addEventWatch callback = liftIO $ do
-  rawFilter <- Raw.mkEventFilter wrappedCb
-  Raw.addEventWatch rawFilter nullPtr
-  return (EventWatch $ auxRemove rawFilter)
-  where
-    wrappedCb :: Ptr () -> Ptr Raw.Event -> IO CInt
-    wrappedCb _ evPtr = 0 <$ (callback =<< convertRaw =<< peek evPtr)
-
-    auxRemove :: Raw.EventFilter -> IO ()
-    auxRemove rawFilter = do
-      Raw.delEventWatch rawFilter nullPtr
-      freeHaskellFunPtr rawFilter
-
--- | Remove an 'EventWatch'.
---
--- See @<https://wiki.libsdl.org/SDL_DelEventWatch>@ for C documentation.
-delEventWatch :: MonadIO m => EventWatch -> m ()
-delEventWatch = liftIO . runEventWatchRemoval
-
--- | Checks raw Windows for null references.
-getWindowFromID :: MonadIO m => Word32 -> m (Maybe Window)
-getWindowFromID id = do
-  rawWindow <- Raw.getWindowFromID id
-  return $ if rawWindow == nullPtr then Nothing else Just $ Window rawWindow
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}++-- | "SDL.Event" exports an interface for working with the SDL event model. Event handling allows your application to receive input from the user. Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like 'pollEvent' and 'waitEvent' you can observe and handle waiting input events.+--+-- The event queue itself is composed of a series of 'Event' values, one for each waiting event. 'Event' values are read from the queue with the 'pollEvent' function and it is then up to the application to process the information stored with them.+module SDL.Event+  ( -- * Polling events+    pollEvent+  , pollEvents+  , mapEvents+  , pumpEvents+  , waitEvent+  , waitEventTimeout+    -- * Registering user events+  , RegisteredEventType(..)+  , RegisteredEventData(..)+  , EventPushResult(..)+  , emptyRegisteredEvent+  , registerEvent+    -- * Watching events+  , EventWatchCallback+  , EventWatch+  , addEventWatch+  , delEventWatch+    -- * Event data+  , Event(..)+  , Timestamp+  , EventPayload(..)+    -- ** Window events+  , WindowShownEventData(..)+  , WindowHiddenEventData(..)+  , WindowExposedEventData(..)+  , WindowMovedEventData(..)+  , WindowResizedEventData(..)+  , WindowSizeChangedEventData(..)+  , WindowMinimizedEventData(..)+  , WindowMaximizedEventData(..)+  , WindowRestoredEventData(..)+  , WindowGainedMouseFocusEventData(..)+  , WindowLostMouseFocusEventData(..)+  , WindowGainedKeyboardFocusEventData(..)+  , WindowLostKeyboardFocusEventData(..)+  , WindowClosedEventData(..)+  , SysWMEventData(..)+    -- ** Keyboard events+  , KeyboardEventData(..)+  , TextEditingEventData(..)+  , TextInputEventData(..)+    -- ** Mouse events+  , MouseMotionEventData(..)+  , MouseButtonEventData(..)+  , MouseWheelEventData(..)+    -- ** Joystick events+  , JoyAxisEventData(..)+  , JoyBallEventData(..)+  , JoyHatEventData(..)+  , JoyButtonEventData(..)+  , JoyDeviceEventData(..)+    -- ** Controller events+  , ControllerAxisEventData(..)+  , ControllerButtonEventData(..)+  , ControllerDeviceEventData(..)+    -- ** Audio events+  , AudioDeviceEventData(..)+    -- ** User events+  , UserEventData(..)+    -- ** Touch events+  , TouchFingerEventData(..)+  , TouchFingerMotionEventData(..)+    -- ** Gesture events+  , MultiGestureEventData(..)+  , DollarGestureEventData(..)+    -- ** Drag and drop events+  , DropEventData(..)+    -- ** Unknown events+  , UnknownEventData(..)+    -- * Auxiliary event data+  , InputMotion(..)+  , MouseButton(..)+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Data (Data)+import Data.Maybe (catMaybes)+import Data.Text (Text)+import Data.Typeable+import Foreign hiding (throwIfNeg_)+import Foreign.C+import GHC.Generics (Generic)+import SDL.Vect+import SDL.Input.Joystick+import SDL.Input.GameController+import SDL.Input.Keyboard+import SDL.Input.Mouse+import SDL.Internal.Exception+import SDL.Internal.Numbered+import SDL.Internal.Types (Window(Window))+import qualified Data.ByteString.Char8 as BSC8+import qualified Data.Text.Encoding as Text+import qualified SDL.Raw as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++-- | A single SDL event. This event occured at 'eventTimestamp' and carries data under 'eventPayload'.+data Event = Event+  { eventTimestamp :: Timestamp+    -- ^ The time the event occured.+  , eventPayload :: EventPayload+    -- ^ Data pertaining to this event.+  } deriving (Eq, Ord, Generic, Show, Typeable)++type Timestamp = Word32++-- | An enumeration of all possible SDL event types. This data type pairs up event types with+-- their payload, where possible.+data EventPayload+  = WindowShownEvent !WindowShownEventData+  | WindowHiddenEvent !WindowHiddenEventData+  | WindowExposedEvent !WindowExposedEventData+  | WindowMovedEvent !WindowMovedEventData+  | WindowResizedEvent !WindowResizedEventData+  | WindowSizeChangedEvent !WindowSizeChangedEventData+  | WindowMinimizedEvent !WindowMinimizedEventData+  | WindowMaximizedEvent !WindowMaximizedEventData+  | WindowRestoredEvent !WindowRestoredEventData+  | WindowGainedMouseFocusEvent !WindowGainedMouseFocusEventData+  | WindowLostMouseFocusEvent !WindowLostMouseFocusEventData+  | WindowGainedKeyboardFocusEvent !WindowGainedKeyboardFocusEventData+  | WindowLostKeyboardFocusEvent !WindowLostKeyboardFocusEventData+  | WindowClosedEvent !WindowClosedEventData+  | KeyboardEvent !KeyboardEventData+  | TextEditingEvent !TextEditingEventData+  | TextInputEvent !TextInputEventData+  | KeymapChangedEvent+  | MouseMotionEvent !MouseMotionEventData+  | MouseButtonEvent !MouseButtonEventData+  | MouseWheelEvent !MouseWheelEventData+  | JoyAxisEvent !JoyAxisEventData+  | JoyBallEvent !JoyBallEventData+  | JoyHatEvent !JoyHatEventData+  | JoyButtonEvent !JoyButtonEventData+  | JoyDeviceEvent !JoyDeviceEventData+  | ControllerAxisEvent !ControllerAxisEventData+  | ControllerButtonEvent !ControllerButtonEventData+  | ControllerDeviceEvent !ControllerDeviceEventData+  | AudioDeviceEvent !AudioDeviceEventData+  | QuitEvent+  | UserEvent !UserEventData+  | SysWMEvent !SysWMEventData+  | TouchFingerEvent !TouchFingerEventData+  | TouchFingerMotionEvent !TouchFingerMotionEventData+  | MultiGestureEvent !MultiGestureEventData+  | DollarGestureEvent !DollarGestureEventData+  | DropEvent !DropEventData+  | ClipboardUpdateEvent+  | UnknownEvent !UnknownEventData+  deriving (Eq, Ord, Generic, Show, Typeable)++-- | A window has been shown.+newtype WindowShownEventData =+  WindowShownEventData {windowShownEventWindow :: Window+                        -- ^ The associated 'Window'.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A window has been hidden.+newtype WindowHiddenEventData =+  WindowHiddenEventData {windowHiddenEventWindow :: Window+                         -- ^ The associated 'Window'.+                        }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A part of a window has been exposed - where exposure means to become visible (for example, an overlapping window no longer overlaps with the window).+newtype WindowExposedEventData =+  WindowExposedEventData {windowExposedEventWindow :: Window+                          -- ^ The associated 'Window'.+                         }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A 'Window' has been moved.+data WindowMovedEventData =+  WindowMovedEventData {windowMovedEventWindow :: !Window+                        -- ^ The associated 'Window'.+                       ,windowMovedEventPosition :: !(Point V2 Int32)+                        -- ^ The new position of the 'Window'.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Window has been resized. This is event is always preceded by 'WindowSizeChangedEvent'.+data WindowResizedEventData =+  WindowResizedEventData {windowResizedEventWindow :: !Window+                          -- ^ The associated 'Window'.+                         ,windowResizedEventSize :: !(V2 Int32)+                          -- ^ The new size of the 'Window'.+                         }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window size has changed, either as a result of an API call or through the system or user changing the window size; this event is followed by 'WindowResizedEvent' if the size was changed by an external event, i.e. the user or the window manager.+data WindowSizeChangedEventData =+  WindowSizeChangedEventData {windowSizeChangedEventWindow :: !Window+                              -- ^ The associated 'Window'.+                             ,windowSizeChangedEventSize :: !(V2 Int32)+                              -- ^ The new size of the 'Window'.+                             }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has been minimized.+newtype WindowMinimizedEventData =+  WindowMinimizedEventData {windowMinimizedEventWindow :: Window+                            -- ^ The associated 'Window'.+                           }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has been maximized.+newtype WindowMaximizedEventData =+  WindowMaximizedEventData {windowMaximizedEventWindow :: Window+                            -- ^ The associated 'Window'.+                           }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has been restored to normal size and position.+newtype WindowRestoredEventData =+  WindowRestoredEventData {windowRestoredEventWindow :: Window+                           -- ^ The associated 'Window'.+                          }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has gained mouse focus.+newtype WindowGainedMouseFocusEventData =+  WindowGainedMouseFocusEventData {windowGainedMouseFocusEventWindow :: Window+                                   -- ^ The associated 'Window'.+                                  }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has lost mouse focus.+newtype WindowLostMouseFocusEventData =+  WindowLostMouseFocusEventData {windowLostMouseFocusEventWindow :: Window+                                 -- ^ The associated 'Window'.+                                }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has gained keyboard focus.+newtype WindowGainedKeyboardFocusEventData =+  WindowGainedKeyboardFocusEventData {windowGainedKeyboardFocusEventWindow :: Window+                                      -- ^ The associated 'Window'.+                                     }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window has lost keyboard focus.+newtype WindowLostKeyboardFocusEventData =+  WindowLostKeyboardFocusEventData {windowLostKeyboardFocusEventWindow :: Window+                                    -- ^ The associated 'Window'.+                                   }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | The window manager requests that the window be closed.+newtype WindowClosedEventData =+  WindowClosedEventData {windowClosedEventWindow :: Window+                         -- ^ The associated 'Window'.+                        }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A keyboard key has been pressed or released.+data KeyboardEventData =+  KeyboardEventData {keyboardEventWindow :: !(Maybe Window)+                     -- ^ The 'Window' with keyboard focus, if any.+                    ,keyboardEventKeyMotion :: !InputMotion+                     -- ^ Whether the key was pressed or released.+                    ,keyboardEventRepeat :: !Bool+                     -- ^ 'True' if this is a repeating key press from the user holding the key down.+                    ,keyboardEventKeysym :: !Keysym+                     -- ^ A description of the key that this event pertains to.+                    }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Keyboard text editing event information.+data TextEditingEventData =+  TextEditingEventData {textEditingEventWindow :: !(Maybe Window)+                        -- ^ The 'Window' with keyboard focus, if any.+                       ,textEditingEventText :: !Text+                        -- ^ The editing text.+                       ,textEditingEventStart :: !Int32+                        -- ^ The location to begin editing from.+                       ,textEditingEventLength :: !Int32+                        -- ^ The number of characters to edit from the start point.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Keyboard text input event information.+data TextInputEventData =+  TextInputEventData {textInputEventWindow :: !(Maybe Window)+                      -- ^ The 'Window' with keyboard focus, if any.+                     ,textInputEventText :: !Text+                      -- ^ The input text.+                     }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A mouse or pointer device was moved.+data MouseMotionEventData =+  MouseMotionEventData {mouseMotionEventWindow :: !(Maybe Window)+                        -- ^ The 'Window' with mouse focus, if any.+                       ,mouseMotionEventWhich :: !MouseDevice+                        -- ^ The 'MouseDevice' that was moved.+                       ,mouseMotionEventState :: ![MouseButton]+                        -- ^ A collection of 'MouseButton's that are currently held down.+                       ,mouseMotionEventPos :: !(Point V2 Int32)+                        -- ^ The new position of the mouse.+                       ,mouseMotionEventRelMotion :: !(V2 Int32)+                        -- ^ The relative mouse motion of the mouse.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A mouse or pointer device button was pressed or released.+data MouseButtonEventData =+  MouseButtonEventData {mouseButtonEventWindow :: !(Maybe Window)+                        -- ^ The 'Window' with mouse focus, if any.+                       ,mouseButtonEventMotion :: !InputMotion+                        -- ^ Whether the button was pressed or released.+                       ,mouseButtonEventWhich :: !MouseDevice+                        -- ^ The 'MouseDevice' whose button was pressed or released.+                       ,mouseButtonEventButton :: !MouseButton+                        -- ^ The button that was pressed or released.+                       ,mouseButtonEventClicks :: !Word8+                        -- ^ The amount of clicks. 1 for a single-click, 2 for a double-click, etc.+                       ,mouseButtonEventPos :: !(Point V2 Int32)+                        -- ^ The coordinates of the mouse click.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Mouse wheel event information.+data MouseWheelEventData =+  MouseWheelEventData {mouseWheelEventWindow :: !(Maybe Window)+                        -- ^ The 'Window' with mouse focus, if any.+                      ,mouseWheelEventWhich :: !MouseDevice+                       -- ^ The 'MouseDevice' whose wheel was scrolled.+                      ,mouseWheelEventPos :: !(V2 Int32)+                       -- ^ The amount scrolled.+                      ,mouseWheelEventDirection :: !MouseScrollDirection+                       -- ^ The scroll direction mode.+                      }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Joystick axis motion event information+data JoyAxisEventData =+  JoyAxisEventData {joyAxisEventWhich :: !Raw.JoystickID+                    -- ^ The instance id of the joystick that reported the event.+                   ,joyAxisEventAxis :: !Word8+                    -- ^ The index of the axis that changed.+                   ,joyAxisEventValue :: !Int16+                    -- ^ The current position of the axis, ranging between -32768 and 32767.+                   }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Joystick trackball motion event information.+data JoyBallEventData =+  JoyBallEventData {joyBallEventWhich :: !Raw.JoystickID+                    -- ^ The instance id of the joystick that reported the event.+                   ,joyBallEventBall :: !Word8+                    -- ^ The index of the trackball that changed.+                   ,joyBallEventRelMotion :: !(V2 Int16)+                    -- ^ The relative motion of the trackball.+                   }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Joystick hat position change event information+data JoyHatEventData =+  JoyHatEventData {joyHatEventWhich :: !Raw.JoystickID+                    -- ^ The instance id of the joystick that reported the event.+                  ,joyHatEventHat :: !Word8+                   -- ^ The index of the hat that changed.+                  ,joyHatEventValue :: !JoyHatPosition+                   -- ^ The new position of the hat.+                  }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Joystick button event information.+data JoyButtonEventData =+  JoyButtonEventData {joyButtonEventWhich :: !Raw.JoystickID+                      -- ^ The instance id of the joystick that reported the event.+                     ,joyButtonEventButton :: !Word8+                      -- ^ The index of the button that changed.+                     ,joyButtonEventState :: !JoyButtonState+                      -- ^ The state of the button.+                     }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Joystick device event information.+data JoyDeviceEventData =+  JoyDeviceEventData {joyDeviceEventConnection :: !JoyDeviceConnection+                      -- ^ Was the device added or removed?+                     ,joyDeviceEventWhich :: !Int32+                      -- ^ The instance id of the joystick that reported the event.+                     }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Game controller axis motion event information.+data ControllerAxisEventData =+  ControllerAxisEventData {controllerAxisEventWhich :: !Raw.JoystickID+                           -- ^ The joystick instance ID that reported the event.+                          ,controllerAxisEventAxis :: !Word8+                           -- ^ The index of the axis.+                          ,controllerAxisEventValue :: !Int16+                           -- ^ The axis value ranging between -32768 and 32767.+                          }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Game controller button event information+data ControllerButtonEventData =+  ControllerButtonEventData {controllerButtonEventWhich :: !Raw.JoystickID+                           -- ^ The joystick instance ID that reported the event.+                            ,controllerButtonEventButton :: !ControllerButton+                             -- ^ The controller button.+                            ,controllerButtonEventState :: !ControllerButtonState+                             -- ^ The state of the button.+                            }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Controller device event information+data ControllerDeviceEventData =+  ControllerDeviceEventData {controllerDeviceEventConnection :: !ControllerDeviceConnection+                             -- ^ Was the device added, removed, or remapped?+                            ,controllerDeviceEventWhich :: !Int32+                             -- ^ The joystick instance ID that reported the event.+                            }+  deriving (Eq,Ord,Generic,Show,Typeable)++data AudioDeviceEventData =+  AudioDeviceEventData {audioDeviceEventIsAddition :: !Bool+                        -- ^ If the audio device is an addition, or a removal.+                       ,audioDeviceEventWhich :: !Word32+                        -- ^ The audio device ID that reported the event.+                       ,audioDeviceEventIsCapture :: !Bool+                        -- ^ If the audio device is a capture device.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Event data for application-defined events.+data UserEventData =+  UserEventData {userEventType :: !Word32+                 -- ^ User defined event type.+                ,userEventWindow :: !(Maybe Window)+                 -- ^ The associated 'Window'.+                ,userEventCode :: !Int32+                 -- ^ User defined event code.+                ,userEventData1 :: !(Ptr ())+                 -- ^ User defined data pointer.+                ,userEventData2 :: !(Ptr ())+                 -- ^ User defined data pointer.+                }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A video driver dependent system event+newtype SysWMEventData =+  SysWMEventData {sysWMEventMsg :: Raw.SysWMmsg}+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Finger touch event information.+data TouchFingerEventData =+  TouchFingerEventData {touchFingerEventTouchID :: !Raw.TouchID+                        -- ^ The touch device index.+                       ,touchFingerEventFingerID :: !Raw.FingerID+                        -- ^ The finger index.+                       ,touchFingerEventMotion :: !InputMotion+                        -- ^ Whether the finger was pressed or released.+                       ,touchFingerEventPos :: !(Point V2 CFloat)+                        -- ^ The location of the touch event, normalized between 0 and 1.+                       ,touchFingerEventPressure :: !CFloat+                        -- ^ The quantity of the pressure applied, normalized between 0 and 1.+                       }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Finger motion event information.+data TouchFingerMotionEventData =+  TouchFingerMotionEventData {touchFingerMotionEventTouchID :: !Raw.TouchID+                              -- ^ The touch device index.+                             ,touchFingerMotionEventFingerID :: !Raw.FingerID+                              -- ^ The finger index.+                             ,touchFingerMotionEventPos :: !(Point V2 CFloat)+                              -- ^ The location of the touch event, normalized between 0 and 1.+                             ,touchFingerMotionEventRelMotion :: !(V2 CFloat)+                              -- ^ The distance moved, normalized between -1 and 1.+                             ,touchFingerMotionEventPressure :: !CFloat+                              -- ^ The quantity of the pressure applied, normalized between 0 and 1.+                             }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Multiple finger gesture event information+data MultiGestureEventData =+  MultiGestureEventData {multiGestureEventTouchID :: !Raw.TouchID+                         -- ^ The touch device index.+                        ,multiGestureEventDTheta :: !CFloat+                         -- ^ The amount that the fingers rotated during this motion.+                        ,multiGestureEventDDist :: !CFloat+                         -- ^ The amount that the fingers pinched during this motion.+                        ,multiGestureEventPos :: !(Point V2 CFloat)+                         -- ^ The normalized center of the gesture.+                        ,multiGestureEventNumFingers :: !Word16+                         -- ^ The number of fingers used in this gesture.+                        }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | Complex gesture event information.+data DollarGestureEventData =+  DollarGestureEventData {dollarGestureEventTouchID :: !Raw.TouchID+                          -- ^ The touch device index.+                         ,dollarGestureEventGestureID :: !Raw.GestureID+                          -- ^ The unique id of the closest gesture to the performed stroke.+                         ,dollarGestureEventNumFingers :: !Word32+                          -- ^ The number of fingers used to draw the stroke.+                         ,dollarGestureEventError :: !CFloat+                          -- ^ The difference between the gesture template and the actual performed gesture (lower errors correspond to closer matches).+                         ,dollarGestureEventPos :: !(Point V2 CFloat)+                          -- ^ The normalized center of the gesture.+                         }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | An event used to request a file open by the system+newtype DropEventData =+  DropEventData {dropEventFile :: CString+                 -- ^ The file name.+                }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | SDL reported an unknown event type.+newtype UnknownEventData =+  UnknownEventData {unknownEventType :: Word32+                    -- ^ The unknown event code.+                   }+  deriving (Eq,Ord,Generic,Show,Typeable)++data InputMotion = Released | Pressed+  deriving (Bounded, Enum, Eq, Ord, Read, Data, Generic, Show, Typeable)++ccharStringToText :: [CChar] -> Text+ccharStringToText = Text.decodeUtf8 . BSC8.pack . map castCCharToChar++fromRawKeysym :: Raw.Keysym -> Keysym+fromRawKeysym (Raw.Keysym scancode keycode modifier) =+  Keysym scancode' keycode' modifier'+  where scancode' = fromNumber scancode+        keycode'  = fromNumber keycode+        modifier' = fromNumber (fromIntegral modifier)++convertRaw :: Raw.Event -> IO Event+convertRaw (Raw.WindowEvent t ts a b c d) =+  do w <- fmap Window (Raw.getWindowFromID a)+     return (Event ts+                   (case b of+                      Raw.SDL_WINDOWEVENT_SHOWN ->+                        WindowShownEvent (WindowShownEventData w)+                      Raw.SDL_WINDOWEVENT_HIDDEN ->+                        WindowHiddenEvent (WindowHiddenEventData w)+                      Raw.SDL_WINDOWEVENT_EXPOSED ->+                        WindowExposedEvent (WindowExposedEventData w)+                      Raw.SDL_WINDOWEVENT_MOVED ->+                        WindowMovedEvent+                          (WindowMovedEventData w+                                                (P (V2 c d)))+                      Raw.SDL_WINDOWEVENT_RESIZED ->+                        WindowResizedEvent+                          (WindowResizedEventData w+                                                  (V2 c d))+                      Raw.SDL_WINDOWEVENT_SIZE_CHANGED ->+                        WindowSizeChangedEvent (WindowSizeChangedEventData w (V2 c d))+                      Raw.SDL_WINDOWEVENT_MINIMIZED ->+                        WindowMinimizedEvent (WindowMinimizedEventData w)+                      Raw.SDL_WINDOWEVENT_MAXIMIZED ->+                        WindowMaximizedEvent (WindowMaximizedEventData w)+                      Raw.SDL_WINDOWEVENT_RESTORED ->+                        WindowRestoredEvent (WindowRestoredEventData w)+                      Raw.SDL_WINDOWEVENT_ENTER ->+                        WindowGainedMouseFocusEvent (WindowGainedMouseFocusEventData w)+                      Raw.SDL_WINDOWEVENT_LEAVE ->+                        WindowLostMouseFocusEvent (WindowLostMouseFocusEventData w)+                      Raw.SDL_WINDOWEVENT_FOCUS_GAINED ->+                        WindowGainedKeyboardFocusEvent (WindowGainedKeyboardFocusEventData w)+                      Raw.SDL_WINDOWEVENT_FOCUS_LOST ->+                        WindowLostKeyboardFocusEvent (WindowLostKeyboardFocusEventData w)+                      Raw.SDL_WINDOWEVENT_CLOSE ->+                        WindowClosedEvent (WindowClosedEventData w)+                      _ ->+                        UnknownEvent (UnknownEventData t)))+convertRaw (Raw.KeyboardEvent Raw.SDL_KEYDOWN ts a _ c d) =+  do w <- getWindowFromID a+     return (Event ts+                   (KeyboardEvent+                      (KeyboardEventData w+                                         Pressed+                                         (c /= 0)+                                         (fromRawKeysym d))))+convertRaw (Raw.KeyboardEvent Raw.SDL_KEYUP ts a _ c d) =+  do w <- getWindowFromID a+     return (Event ts+                   (KeyboardEvent+                      (KeyboardEventData w+                                         Released+                                         (c /= 0)+                                         (fromRawKeysym d))))+convertRaw Raw.KeyboardEvent{} = error "convertRaw: Unknown keyboard motion"+convertRaw (Raw.TextEditingEvent _ ts a b c d) =+  do w <- getWindowFromID a+     return (Event ts+                   (TextEditingEvent+                      (TextEditingEventData w+                                            (ccharStringToText b)+                                            c+                                            d)))+convertRaw (Raw.TextInputEvent _ ts a b) =+  do w <- getWindowFromID a+     return (Event ts+                   (TextInputEvent+                      (TextInputEventData w+                                          (ccharStringToText b))))+convertRaw (Raw.KeymapChangedEvent _ ts) =+  return (Event ts KeymapChangedEvent)+convertRaw (Raw.MouseMotionEvent _ ts a b c d e f g) =+  do w <- getWindowFromID a+     let buttons =+           catMaybes [(Raw.SDL_BUTTON_LMASK `test` c) ButtonLeft+                     ,(Raw.SDL_BUTTON_RMASK `test` c) ButtonRight+                     ,(Raw.SDL_BUTTON_MMASK `test` c) ButtonMiddle+                     ,(Raw.SDL_BUTTON_X1MASK `test` c) ButtonX1+                     ,(Raw.SDL_BUTTON_X2MASK `test` c) ButtonX2]+     return (Event ts+                   (MouseMotionEvent+                      (MouseMotionEventData w+                                            (fromNumber b)+                                            buttons+                                            (P (V2 d e))+                                            (V2 f g))))+  where mask `test` x =+          if mask .&. x /= 0+             then Just+             else const Nothing+convertRaw (Raw.MouseButtonEvent t ts a b c _ e f g) =+  do w <- getWindowFromID a+     let motion+           | t == Raw.SDL_MOUSEBUTTONUP = Released+           | t == Raw.SDL_MOUSEBUTTONDOWN = Pressed+           | otherwise = error "convertRaw: Unexpected mouse button motion"+     return (Event ts+                   (MouseButtonEvent+                      (MouseButtonEventData w+                                            motion+                                            (fromNumber b)+                                            (fromNumber c)+                                            e+                                            (P (V2 f g)))))+convertRaw (Raw.MouseWheelEvent _ ts a b c d e) =+  do w <- getWindowFromID a+     return (Event ts+                   (MouseWheelEvent+                      (MouseWheelEventData w+                                           (fromNumber b)+                                           (V2 c d)+                                           (fromNumber e))))+convertRaw (Raw.JoyAxisEvent _ ts a b c) =+  return (Event ts (JoyAxisEvent (JoyAxisEventData a b c)))+convertRaw (Raw.JoyBallEvent _ ts a b c d) =+  return (Event ts+                (JoyBallEvent+                   (JoyBallEventData a+                                     b+                                     (V2 c d))))+convertRaw (Raw.JoyHatEvent _ ts a b c) =+  return (Event ts+                (JoyHatEvent+                   (JoyHatEventData a+                                    b+                                    (fromNumber c))))+convertRaw (Raw.JoyButtonEvent _ ts a b c) =+  return (Event ts (JoyButtonEvent (JoyButtonEventData a b (fromNumber c))))+convertRaw (Raw.JoyDeviceEvent t ts a) =+  return (Event ts (JoyDeviceEvent (JoyDeviceEventData (fromNumber t) a)))+convertRaw (Raw.ControllerAxisEvent _ ts a b c) =+  return (Event ts (ControllerAxisEvent (ControllerAxisEventData a b c)))+convertRaw (Raw.ControllerButtonEvent t ts a b _) =+  return (Event ts +           (ControllerButtonEvent+             (ControllerButtonEventData a +                                        (fromNumber $ fromIntegral b)+                                        (fromNumber t))))+convertRaw (Raw.ControllerDeviceEvent t ts a) =+  return (Event ts (ControllerDeviceEvent (ControllerDeviceEventData (fromNumber t) a)))+convertRaw (Raw.AudioDeviceEvent Raw.SDL_AUDIODEVICEADDED ts a b) =+  return (Event ts (AudioDeviceEvent (AudioDeviceEventData True a (b /= 0))))+convertRaw (Raw.AudioDeviceEvent Raw.SDL_AUDIODEVICEREMOVED ts a b) =+  return (Event ts (AudioDeviceEvent (AudioDeviceEventData False a (b /= 0))))+convertRaw Raw.AudioDeviceEvent{} =+  error "convertRaw: Unknown audio device motion"+convertRaw (Raw.QuitEvent _ ts) =+  return (Event ts QuitEvent)+convertRaw (Raw.UserEvent t ts a b c d) =+  do w <- getWindowFromID a+     return (Event ts (UserEvent (UserEventData t w b c d)))+convertRaw (Raw.SysWMEvent _ ts a) =+  return (Event ts (SysWMEvent (SysWMEventData a)))+convertRaw (Raw.TouchFingerEvent t ts a b c d e f g) =+  do let touchFingerEvent motion = TouchFingerEvent+                                     (TouchFingerEventData a+                                                           b+                                                           motion+                                                           (P (V2 c d))+                                                           g)+     let touchFingerMotionEvent = TouchFingerMotionEvent+                                    (TouchFingerMotionEventData a+                                                                b+                                                                (P (V2 c d))+                                                                (V2 e f)+                                                                g)+     case t of+       Raw.SDL_FINGERDOWN   -> return (Event ts (touchFingerEvent Pressed))+       Raw.SDL_FINGERUP     -> return (Event ts (touchFingerEvent Released))+       Raw.SDL_FINGERMOTION -> return (Event ts touchFingerMotionEvent)+       _                    -> error "convertRaw: Unexpected touch finger event"+convertRaw (Raw.MultiGestureEvent _ ts a b c d e f) =+  return (Event ts+                (MultiGestureEvent+                   (MultiGestureEventData a+                                          b+                                          c+                                          (P (V2 d e))+                                          f)))+convertRaw (Raw.DollarGestureEvent _ ts a b c d e f) =+  return (Event ts+                (DollarGestureEvent+                   (DollarGestureEventData a+                                           b+                                           c+                                           d+                                           (P (V2 e f)))))+convertRaw (Raw.DropEvent _ ts a) =+  return (Event ts (DropEvent (DropEventData a)))+convertRaw (Raw.ClipboardUpdateEvent _ ts) =+  return (Event ts ClipboardUpdateEvent)+convertRaw (Raw.UnknownEvent t ts) =+  return (Event ts (UnknownEvent (UnknownEventData t)))++-- | Poll for currently pending events. You can only call this function in the thread that set the video mode.+pollEvent :: MonadIO m => m (Maybe Event)+pollEvent = liftIO $ alloca $ \e -> do+  n <- Raw.pollEvent e+  if n == 0+     then return Nothing+     else fmap Just (peek e >>= convertRaw)++-- | Clear the event queue by polling for all pending events.+pollEvents :: (Functor m, MonadIO m) => m [Event]+pollEvents =+  do e <- pollEvent+     case e of+       Nothing -> return []+       Just e' -> (e' :) <$> pollEvents++-- | Run a monadic computation, accumulating over all known 'Event's.+--+-- This can be useful when used with a state monad, allowing you to fold all events together.+mapEvents :: MonadIO m => (Event -> m ()) -> m ()+mapEvents h = do+  event' <- pollEvent+  case event' of+    Just event -> h event >> mapEvents h+    Nothing -> return ()++-- | Wait indefinitely for the next available event.+waitEvent :: MonadIO m => m Event+waitEvent = liftIO $ alloca $ \e -> do+  throwIfNeg_ "SDL.Events.waitEvent" "SDL_WaitEvent" $+    Raw.waitEvent e+  peek e >>= convertRaw++-- | Wait until the specified timeout for the next available amount.+waitEventTimeout :: MonadIO m+                 => CInt -- ^ The maximum amount of time to wait, in milliseconds.+                 -> m (Maybe Event)+waitEventTimeout timeout = liftIO $ alloca $ \e -> do+  n <- Raw.waitEventTimeout e timeout+  if n == 0+     then return Nothing+     else fmap Just (peek e >>= convertRaw)++-- | A user defined event structure that has been registered with SDL.+--+-- Use 'registerEvent', below, to obtain an instance.+data RegisteredEventType a =+  RegisteredEventType {pushRegisteredEvent :: a -> IO EventPushResult+                      ,getRegisteredEvent :: Event -> IO (Maybe a)+                      }++-- | A record used to convert between SDL Events and user-defined data structures.+--+-- Used for 'registerEvent', below.+data RegisteredEventData =+  RegisteredEventData {registeredEventWindow :: !(Maybe Window)+                       -- ^ The associated 'Window'.+                      ,registeredEventCode :: !Int32+                       -- ^ User defined event code.+                      ,registeredEventData1 :: !(Ptr ())+                       -- ^ User defined data pointer.+                      ,registeredEventData2 :: !(Ptr ())+                       -- ^ User defined data pointer.+                      }+  deriving (Eq,Ord,Generic,Show,Typeable)++-- | A registered event with no associated data.+--+-- This is a resonable baseline to modify for converting to+-- 'RegisteredEventData'.+emptyRegisteredEvent :: RegisteredEventData+emptyRegisteredEvent = RegisteredEventData Nothing 0 nullPtr nullPtr++-- | Possible results of an attempted push of an event to the queue.+data EventPushResult = EventPushSuccess | EventPushFiltered | EventPushFailure Text+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++-- | Register a new event type with SDL.+--+-- Provide functions that convert between 'UserEventData' and your structure.+-- You can then use 'pushRegisteredEvent' to add a custom event of the+-- registered type to the queue, and 'getRegisteredEvent' to test for such+-- events in the main loop.+registerEvent :: MonadIO m+              => (RegisteredEventData -> Timestamp -> IO (Maybe a))+              -> (a -> IO RegisteredEventData)+              -> m (Maybe (RegisteredEventType a))+registerEvent registeredEventDataToEvent eventToRegisteredEventData = do+  typ <- Raw.registerEvents 1+  if typ == maxBound+  then return Nothing+  else+    let pushEv ev = do+          RegisteredEventData mWin code d1 d2 <- eventToRegisteredEventData ev+          windowID <- case mWin of+            Just (Window w) -> Raw.getWindowID w+            Nothing         -> return 0+          -- timestamp will be filled in by SDL+          let rawEvent = Raw.UserEvent typ 0 windowID code d1 d2+          liftIO . alloca $ \eventPtr -> do+            poke eventPtr rawEvent+            pushResult <- Raw.pushEvent eventPtr+            case pushResult of+              1 -> return $ EventPushSuccess+              0 -> return $ EventPushFiltered+              _ -> EventPushFailure <$> getError++        getEv (Event ts (UserEvent (UserEventData typ mWin code d1 d2))) =+          registeredEventDataToEvent (RegisteredEventData mWin code d1 d2) ts+        getEv _ = return Nothing++    in return . Just $ RegisteredEventType pushEv getEv++-- | Pump the event loop, gathering events from the input devices.+--+-- This function updates the event queue and internal input device state.+--+-- This should only be run in the thread that initialized the video subsystem, and for extra safety, you should consider only doing those things on the main thread in any case.+--+-- 'pumpEvents' gathers all the pending input information from devices and places it in the event queue. Without calls to 'pumpEvents' no events would ever be placed on the queue. Often the need for calls to 'pumpEvents' is hidden from the user since 'pollEvent' and 'waitEvent' implicitly call 'pumpEvents'. However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call 'pumpEvents' to force an event queue update.+--+-- See @<https://wiki.libsdl.org/SDL_PumpEvents SDL_PumpEvents>@ for C documentation.+pumpEvents :: MonadIO m => m ()+pumpEvents = Raw.pumpEvents++-- | An 'EventWatchCallback' can process and respond to an event+-- when it is added to the event queue.+type EventWatchCallback = Event -> IO ()+newtype EventWatch = EventWatch {runEventWatchRemoval :: IO ()}++-- | Trigger an 'EventWatchCallback' when an event is added to the SDL+-- event queue.+--+-- See @<https://wiki.libsdl.org/SDL_AddEventWatch>@ for C documentation.+addEventWatch :: MonadIO m => EventWatchCallback -> m EventWatch+addEventWatch callback = liftIO $ do+  rawFilter <- Raw.mkEventFilter wrappedCb+  Raw.addEventWatch rawFilter nullPtr+  return (EventWatch $ auxRemove rawFilter)+  where+    wrappedCb :: Ptr () -> Ptr Raw.Event -> IO CInt+    wrappedCb _ evPtr = 0 <$ (callback =<< convertRaw =<< peek evPtr)++    auxRemove :: Raw.EventFilter -> IO ()+    auxRemove rawFilter = do+      Raw.delEventWatch rawFilter nullPtr+      freeHaskellFunPtr rawFilter++-- | Remove an 'EventWatch'.+--+-- See @<https://wiki.libsdl.org/SDL_DelEventWatch>@ for C documentation.+delEventWatch :: MonadIO m => EventWatch -> m ()+delEventWatch = liftIO . runEventWatchRemoval++-- | Checks raw Windows for null references.+getWindowFromID :: MonadIO m => Word32 -> m (Maybe Window)+getWindowFromID id = do+  rawWindow <- Raw.getWindowFromID id+  return $ if rawWindow == nullPtr then Nothing else Just $ Window rawWindow
src/SDL/Exception.hs view
@@ -1,45 +1,45 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-
-module SDL.Exception
-  ( SDLException(..)
-  ) where
-
-import Control.Exception
-import Data.Data (Data)
-import Data.Text (Text)
-import Data.Typeable (Typeable)
-import GHC.Generics (Generic)
-
--- | Error details about a failure to call an SDL routine. Almost all functions in this library have the
--- ability to produce exceptions of this type. Inspection should help you learn more about what has
--- gone wrong.
-data SDLException
-  = -- | A call to a low-level SDL C function failed unexpectedly.
-    SDLCallFailed
-    {sdlExceptionCaller :: !Text
-     -- ^ The Haskell routine that was trying to call a C function
-    ,sdlFunction :: !Text
-     -- ^ The C function that was called and produced an error
-    ,sdlExceptionError :: !Text
-    -- ^ SDL's understanding of what has gone wrong
-    }
-  | -- | An SDL C function was called with an unexpected argument.
-    SDLUnexpectedArgument
-    {sdlExceptionCaller :: !Text
-     -- ^ The Haskell routine that was trying to call a C function
-    ,sdlFunction :: !Text
-     -- ^ The C function that was called and produced an error
-    ,sdlUnknownValue :: !String
-     -- ^ The argument that SDL failed to understand
-    }
-  | -- | A hint was attempted to be set, but SDL does not know about this hint.
-    SDLUnknownHintValue
-    {sdlHint :: !String
-     -- ^ The hint that could not be set
-    ,sdlUnknownValue :: !String
-     -- ^ The value that could not be set
-    }
-  deriving (Data,Eq,Generic,Ord,Read,Show,Typeable)
-
-instance Exception SDLException
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}++module SDL.Exception+  ( SDLException(..)+  ) where++import Control.Exception+import Data.Data (Data)+import Data.Text (Text)+import Data.Typeable (Typeable)+import GHC.Generics (Generic)++-- | Error details about a failure to call an SDL routine. Almost all functions in this library have the+-- ability to produce exceptions of this type. Inspection should help you learn more about what has+-- gone wrong.+data SDLException+  = -- | A call to a low-level SDL C function failed unexpectedly.+    SDLCallFailed+    {sdlExceptionCaller :: !Text+     -- ^ The Haskell routine that was trying to call a C function+    ,sdlFunction :: !Text+     -- ^ The C function that was called and produced an error+    ,sdlExceptionError :: !Text+    -- ^ SDL's understanding of what has gone wrong+    }+  | -- | An SDL C function was called with an unexpected argument.+    SDLUnexpectedArgument+    {sdlExceptionCaller :: !Text+     -- ^ The Haskell routine that was trying to call a C function+    ,sdlFunction :: !Text+     -- ^ The C function that was called and produced an error+    ,sdlUnknownValue :: !String+     -- ^ The argument that SDL failed to understand+    }+  | -- | A hint was attempted to be set, but SDL does not know about this hint.+    SDLUnknownHintValue+    {sdlHint :: !String+     -- ^ The hint that could not be set+    ,sdlUnknownValue :: !String+     -- ^ The value that could not be set+    }+  deriving (Data,Eq,Generic,Ord,Read,Show,Typeable)++instance Exception SDLException
src/SDL/Filesystem.hs view
@@ -1,51 +1,51 @@-{-# LANGUAGE CPP#-}
-{-# LANGUAGE OverloadedStrings #-}
-
-module SDL.Filesystem
-  ( -- * Filesystem Paths
-    getBasePath
-  , getPrefPath
-) where
-
-import Control.Exception
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Text (Text)
-import Foreign.Marshal.Alloc
-import SDL.Internal.Exception
-import qualified Data.ByteString as BS
-import qualified Data.Text.Encoding as Text
-import qualified SDL.Raw.Filesystem as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
--- | An absolute path to the application data directory.
---
--- The path is guaranteed to end with a path separator.
---
--- Throws 'SDLException' on failure, or if the platform does not implement this
--- functionality.
-getBasePath :: MonadIO m => m Text
-getBasePath = liftIO $ mask_ $ do
-  cpath <- throwIfNull "SDL.Filesystem.getBasePath" "SDL_GetBasePath"
-    Raw.getBasePath
-  finally (Text.decodeUtf8 <$> BS.packCString cpath) (free cpath)
-
--- | A path to a unique per user and per application directory for the given
--- organization and application name, intended for writing preferences and
--- other personal files.
---
--- The path is guaranteed to end with a path separator.
---
--- You should assume the path returned by this function is the only safe place
--- to write files to.
---
--- Throws 'SDLException' on failure.
-getPrefPath :: MonadIO m => Text -> Text -> m Text
-getPrefPath organization application = liftIO $ mask_ $ do
-  cpath <- throwIfNull "SDL.Filesystem.getPrefPath" "SDL_GetPrefPath" $
-    BS.useAsCString (Text.encodeUtf8 organization) $ \org ->
-      BS.useAsCString (Text.encodeUtf8 application) $ \app ->
-        Raw.getPrefPath org app
-  finally (Text.decodeUtf8 <$> BS.packCString cpath) (free cpath)
+{-# LANGUAGE CPP#-}+{-# LANGUAGE OverloadedStrings #-}++module SDL.Filesystem+  ( -- * Filesystem Paths+    getBasePath+  , getPrefPath+) where++import Control.Exception+import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Text (Text)+import Foreign.Marshal.Alloc+import SDL.Internal.Exception+import qualified Data.ByteString as BS+import qualified Data.Text.Encoding as Text+import qualified SDL.Raw.Filesystem as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++-- | An absolute path to the application data directory.+--+-- The path is guaranteed to end with a path separator.+--+-- Throws 'SDLException' on failure, or if the platform does not implement this+-- functionality.+getBasePath :: MonadIO m => m Text+getBasePath = liftIO $ mask_ $ do+  cpath <- throwIfNull "SDL.Filesystem.getBasePath" "SDL_GetBasePath"+    Raw.getBasePath+  finally (Text.decodeUtf8 <$> BS.packCString cpath) (free cpath)++-- | A path to a unique per user and per application directory for the given+-- organization and application name, intended for writing preferences and+-- other personal files.+--+-- The path is guaranteed to end with a path separator.+--+-- You should assume the path returned by this function is the only safe place+-- to write files to.+--+-- Throws 'SDLException' on failure.+getPrefPath :: MonadIO m => Text -> Text -> m Text+getPrefPath organization application = liftIO $ mask_ $ do+  cpath <- throwIfNull "SDL.Filesystem.getPrefPath" "SDL_GetPrefPath" $+    BS.useAsCString (Text.encodeUtf8 organization) $ \org ->+      BS.useAsCString (Text.encodeUtf8 application) $ \app ->+        Raw.getPrefPath org app+  finally (Text.decodeUtf8 <$> BS.packCString cpath) (free cpath)
src/SDL/Init.hs view
@@ -1,77 +1,77 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-
-module SDL.Init
-  ( initialize
-  , initializeAll
-  , InitFlag(..)
-  , quit
-  , version
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Bitmask (foldFlags)
-import Data.Data (Data)
-import Data.Typeable
-import Data.Word
-import Foreign.Marshal.Alloc
-import Foreign.Storable
-import GHC.Generics
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import qualified SDL.Raw as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Data.Foldable
-#endif
-
-data InitFlag
-  = InitTimer
-  | InitAudio
-  | InitVideo
-  | InitJoystick
-  | InitHaptic
-  | InitGameController
-  | InitEvents
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance ToNumber InitFlag Word32 where
-  toNumber InitTimer = Raw.SDL_INIT_TIMER
-  toNumber InitAudio = Raw.SDL_INIT_AUDIO
-  toNumber InitVideo = Raw.SDL_INIT_VIDEO
-  toNumber InitJoystick = Raw.SDL_INIT_JOYSTICK
-  toNumber InitHaptic = Raw.SDL_INIT_HAPTIC
-  toNumber InitGameController = Raw.SDL_INIT_GAMECONTROLLER
-  toNumber InitEvents = Raw.SDL_INIT_EVENTS
-
--- | Initializes SDL and the given subsystems. Do not call any SDL functions
--- prior to this one, unless otherwise documented that you may do so.
---
--- You may call this function again with additional subsystems to initialize.
---
--- Throws 'SDLEx.SDLException' if initialization fails.
-initialize :: (Foldable f, Functor m, MonadIO m) => f InitFlag -> m ()
-initialize flags =
-  throwIfNeg_ "SDL.Init.init" "SDL_Init" $
-    Raw.init (foldFlags toNumber flags)
-
--- | Equivalent to @'initialize' ['minBound' .. 'maxBound']@.
-initializeAll :: (Functor m, MonadIO m) => m ()
-initializeAll = initialize [minBound .. maxBound]
-
--- | Quit and shutdown SDL, freeing any resources that may have been in use.
--- Do not call any SDL functions after you've called this function, unless
--- otherwise documented that you may do so.
-quit :: MonadIO m => m ()
-quit = Raw.quit
-
--- | The major, minor, and patch versions of the SDL library linked with.
--- Does not require initialization.
-version :: (Integral a, MonadIO m) => m (a, a, a)
-version = liftIO $ do
-  Raw.Version major minor patch <- alloca $ \v -> Raw.getVersion v >> peek v
-  return (fromIntegral major, fromIntegral minor, fromIntegral patch)
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}++module SDL.Init+  ( initialize+  , initializeAll+  , InitFlag(..)+  , quit+  , version+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Bitmask (foldFlags)+import Data.Data (Data)+import Data.Typeable+import Data.Word+import Foreign.Marshal.Alloc+import Foreign.Storable+import GHC.Generics+import SDL.Internal.Exception+import SDL.Internal.Numbered+import qualified SDL.Raw as Raw++#if !MIN_VERSION_base(4,8,0)+import Data.Foldable+#endif++data InitFlag+  = InitTimer+  | InitAudio+  | InitVideo+  | InitJoystick+  | InitHaptic+  | InitGameController+  | InitEvents+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance ToNumber InitFlag Word32 where+  toNumber InitTimer = Raw.SDL_INIT_TIMER+  toNumber InitAudio = Raw.SDL_INIT_AUDIO+  toNumber InitVideo = Raw.SDL_INIT_VIDEO+  toNumber InitJoystick = Raw.SDL_INIT_JOYSTICK+  toNumber InitHaptic = Raw.SDL_INIT_HAPTIC+  toNumber InitGameController = Raw.SDL_INIT_GAMECONTROLLER+  toNumber InitEvents = Raw.SDL_INIT_EVENTS++-- | Initializes SDL and the given subsystems. Do not call any SDL functions+-- prior to this one, unless otherwise documented that you may do so.+--+-- You may call this function again with additional subsystems to initialize.+--+-- Throws 'SDLEx.SDLException' if initialization fails.+initialize :: (Foldable f, Functor m, MonadIO m) => f InitFlag -> m ()+initialize flags =+  throwIfNeg_ "SDL.Init.init" "SDL_Init" $+    Raw.init (foldFlags toNumber flags)++-- | Equivalent to @'initialize' ['minBound' .. 'maxBound']@.+initializeAll :: (Functor m, MonadIO m) => m ()+initializeAll = initialize [minBound .. maxBound]++-- | Quit and shutdown SDL, freeing any resources that may have been in use.+-- Do not call any SDL functions after you've called this function, unless+-- otherwise documented that you may do so.+quit :: MonadIO m => m ()+quit = Raw.quit++-- | The major, minor, and patch versions of the SDL library linked with.+-- Does not require initialization.+version :: (Integral a, MonadIO m) => m (a, a, a)+version = liftIO $ do+  Raw.Version major minor patch <- alloca $ \v -> Raw.getVersion v >> peek v+  return (fromIntegral major, fromIntegral minor, fromIntegral patch)
src/SDL/Input.hs view
@@ -1,10 +1,10 @@-module SDL.Input
-  ( module SDL.Input.Joystick
-  , module SDL.Input.Keyboard
-  , module SDL.Input.Mouse
-  ) where
-
-
-import SDL.Input.Joystick
-import SDL.Input.Keyboard
-import SDL.Input.Mouse
+module SDL.Input+  ( module SDL.Input.Joystick+  , module SDL.Input.Keyboard+  , module SDL.Input.Mouse+  ) where+++import SDL.Input.Joystick+import SDL.Input.Keyboard+import SDL.Input.Mouse
src/SDL/Input/GameController.hs view
@@ -1,83 +1,83 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE PatternSynonyms #-}
-
-module SDL.Input.GameController
-  ( ControllerButton(..)
-  , ControllerButtonState(..)
-  , ControllerDeviceConnection(..)
-  ) where
-
-import Data.Data (Data)
-import Data.Typeable
-import Data.Word
-import GHC.Generics (Generic)
-import GHC.Int (Int32)
-import SDL.Internal.Numbered
-import qualified SDL.Raw as Raw
-
--- | Identifies a gamepad button.
-data ControllerButton
-  = ControllerButtonInvalid
-  | ControllerButtonA
-  | ControllerButtonB
-  | ControllerButtonX
-  | ControllerButtonY
-  | ControllerButtonBack
-  | ControllerButtonGuide
-  | ControllerButtonStart
-  | ControllerButtonLeftStick
-  | ControllerButtonRightStick
-  | ControllerButtonLeftShoulder
-  | ControllerButtonRightShoulder
-  | ControllerButtonDpadUp
-  | ControllerButtonDpadDown
-  | ControllerButtonDpadLeft
-  | ControllerButtonDpadRight
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber ControllerButton Int32 where
-  fromNumber n = case n of
-    Raw.SDL_CONTROLLER_BUTTON_A -> ControllerButtonA
-    Raw.SDL_CONTROLLER_BUTTON_B -> ControllerButtonB
-    Raw.SDL_CONTROLLER_BUTTON_X -> ControllerButtonX
-    Raw.SDL_CONTROLLER_BUTTON_Y -> ControllerButtonY
-    Raw.SDL_CONTROLLER_BUTTON_BACK -> ControllerButtonBack
-    Raw.SDL_CONTROLLER_BUTTON_GUIDE -> ControllerButtonGuide
-    Raw.SDL_CONTROLLER_BUTTON_START -> ControllerButtonStart
-    Raw.SDL_CONTROLLER_BUTTON_LEFTSTICK -> ControllerButtonLeftStick
-    Raw.SDL_CONTROLLER_BUTTON_RIGHTSTICK -> ControllerButtonRightStick
-    Raw.SDL_CONTROLLER_BUTTON_LEFTSHOULDER -> ControllerButtonLeftShoulder
-    Raw.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER -> ControllerButtonRightShoulder
-    Raw.SDL_CONTROLLER_BUTTON_DPAD_UP -> ControllerButtonDpadUp
-    Raw.SDL_CONTROLLER_BUTTON_DPAD_DOWN -> ControllerButtonDpadDown
-    Raw.SDL_CONTROLLER_BUTTON_DPAD_LEFT -> ControllerButtonDpadLeft
-    Raw.SDL_CONTROLLER_BUTTON_DPAD_RIGHT -> ControllerButtonDpadRight
-    _ -> ControllerButtonInvalid
-
--- | Identifies the state of a controller button.
-data ControllerButtonState
-  = ControllerButtonPressed
-  | ControllerButtonReleased
-  | ControllerButtonInvalidState
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber ControllerButtonState Word32 where
-  fromNumber n = case n of
-    Raw.SDL_CONTROLLERBUTTONDOWN -> ControllerButtonPressed
-    Raw.SDL_CONTROLLERBUTTONUP -> ControllerButtonReleased
-    _ -> ControllerButtonInvalidState
-
--- | Identified whether the game controller was added, removed, or remapped.
-data ControllerDeviceConnection
-  = ControllerDeviceAdded
-  | ControllerDeviceRemoved
-  | ControllerDeviceRemapped
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber ControllerDeviceConnection Word32 where
-  fromNumber n = case n of
-    Raw.SDL_CONTROLLERDEVICEADDED -> ControllerDeviceAdded
-    Raw.SDL_CONTROLLERDEVICEREMOVED -> ControllerDeviceRemoved
-    _ -> ControllerDeviceRemapped
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE PatternSynonyms #-}++module SDL.Input.GameController+  ( ControllerButton(..)+  , ControllerButtonState(..)+  , ControllerDeviceConnection(..)+  ) where++import Data.Data (Data)+import Data.Typeable+import Data.Word+import GHC.Generics (Generic)+import GHC.Int (Int32)+import SDL.Internal.Numbered+import qualified SDL.Raw as Raw++-- | Identifies a gamepad button.+data ControllerButton+  = ControllerButtonInvalid+  | ControllerButtonA+  | ControllerButtonB+  | ControllerButtonX+  | ControllerButtonY+  | ControllerButtonBack+  | ControllerButtonGuide+  | ControllerButtonStart+  | ControllerButtonLeftStick+  | ControllerButtonRightStick+  | ControllerButtonLeftShoulder+  | ControllerButtonRightShoulder+  | ControllerButtonDpadUp+  | ControllerButtonDpadDown+  | ControllerButtonDpadLeft+  | ControllerButtonDpadRight+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber ControllerButton Int32 where+  fromNumber n = case n of+    Raw.SDL_CONTROLLER_BUTTON_A -> ControllerButtonA+    Raw.SDL_CONTROLLER_BUTTON_B -> ControllerButtonB+    Raw.SDL_CONTROLLER_BUTTON_X -> ControllerButtonX+    Raw.SDL_CONTROLLER_BUTTON_Y -> ControllerButtonY+    Raw.SDL_CONTROLLER_BUTTON_BACK -> ControllerButtonBack+    Raw.SDL_CONTROLLER_BUTTON_GUIDE -> ControllerButtonGuide+    Raw.SDL_CONTROLLER_BUTTON_START -> ControllerButtonStart+    Raw.SDL_CONTROLLER_BUTTON_LEFTSTICK -> ControllerButtonLeftStick+    Raw.SDL_CONTROLLER_BUTTON_RIGHTSTICK -> ControllerButtonRightStick+    Raw.SDL_CONTROLLER_BUTTON_LEFTSHOULDER -> ControllerButtonLeftShoulder+    Raw.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER -> ControllerButtonRightShoulder+    Raw.SDL_CONTROLLER_BUTTON_DPAD_UP -> ControllerButtonDpadUp+    Raw.SDL_CONTROLLER_BUTTON_DPAD_DOWN -> ControllerButtonDpadDown+    Raw.SDL_CONTROLLER_BUTTON_DPAD_LEFT -> ControllerButtonDpadLeft+    Raw.SDL_CONTROLLER_BUTTON_DPAD_RIGHT -> ControllerButtonDpadRight+    _ -> ControllerButtonInvalid++-- | Identifies the state of a controller button.+data ControllerButtonState+  = ControllerButtonPressed+  | ControllerButtonReleased+  | ControllerButtonInvalidState+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber ControllerButtonState Word32 where+  fromNumber n = case n of+    Raw.SDL_CONTROLLERBUTTONDOWN -> ControllerButtonPressed+    Raw.SDL_CONTROLLERBUTTONUP -> ControllerButtonReleased+    _ -> ControllerButtonInvalidState++-- | Identified whether the game controller was added, removed, or remapped.+data ControllerDeviceConnection+  = ControllerDeviceAdded+  | ControllerDeviceRemoved+  | ControllerDeviceRemapped+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber ControllerDeviceConnection Word32 where+  fromNumber n = case n of+    Raw.SDL_CONTROLLERDEVICEADDED -> ControllerDeviceAdded+    Raw.SDL_CONTROLLERDEVICEREMOVED -> ControllerDeviceRemoved+    _ -> ControllerDeviceRemapped
src/SDL/Input/Joystick.hs view
@@ -1,219 +1,219 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-
-module SDL.Input.Joystick
-  ( numJoysticks
-  , availableJoysticks
-  , JoystickDevice(..)
-
-  , openJoystick
-  , closeJoystick
-
-  , getJoystickID
-  , Joystick
-  , JoyButtonState(..)
-  , buttonPressed
-  , ballDelta
-  , axisPosition
-  , numAxes
-  , numButtons
-  , numBalls
-  , JoyHatPosition(..)
-  , getHat
-  , numHats
-  , JoyDeviceConnection(..)
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Data (Data)
-import Data.Int
-import Data.Text (Text)
-import Data.Traversable (for)
-import Data.Typeable
-import Data.Word
-import Foreign.C.Types
-import Foreign.Marshal.Alloc
-import Foreign.Storable
-import GHC.Generics (Generic)
-import SDL.Vect
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import SDL.Internal.Types
-import qualified Data.ByteString as BS
-import qualified Data.Text.Encoding as Text
-import qualified Data.Vector as V
-import qualified SDL.Raw as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
--- | A description of joystick that can be opened using 'openJoystick'. To retrieve a list of
--- connected joysticks, use 'availableJoysticks'.
-data JoystickDevice = JoystickDevice
-  { joystickDeviceName :: Text
-  , joystickDeviceId :: CInt
-  } deriving (Eq, Generic, Read, Ord, Show, Typeable)
-
--- | Identifies the state of a joystick button.
-data JoyButtonState = JoyButtonPressed | JoyButtonReleased
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber JoyButtonState Word8 where
-  fromNumber n = case n of
-    Raw.SDL_PRESSED -> JoyButtonPressed
-    Raw.SDL_RELEASED -> JoyButtonReleased
-    _ -> JoyButtonReleased
-
--- | Count the number of joysticks attached to the system.
---
--- See @<https://wiki.libsdl.org/SDL_NumJoysticks SDL_NumJoysticks>@ for C documentation.
-numJoysticks :: MonadIO m => m (CInt)
-numJoysticks = throwIfNeg "SDL.Input.Joystick.availableJoysticks" "SDL_NumJoysticks" Raw.numJoysticks
-
--- | Enumerate all connected joysticks, retrieving a description of each.
-availableJoysticks :: MonadIO m => m (V.Vector JoystickDevice)
-availableJoysticks = liftIO $ do
-  n <- numJoysticks
-  fmap (V.fromList) $
-    for [0 .. (n - 1)] $ \i -> do
-      cstr <-
-        throwIfNull "SDL.Input.Joystick.availableJoysticks" "SDL_JoystickNameForIndex" $
-          Raw.joystickNameForIndex i
-      name <- Text.decodeUtf8 <$> BS.packCString cstr
-      return (JoystickDevice name i)
-
--- | Open a joystick so that you can start receiving events from interaction with this joystick.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickOpen SDL_JoystickOpen>@ for C documentation.
-openJoystick :: (Functor m,MonadIO m)
-             => JoystickDevice -- ^ The device to open. Use 'availableJoysticks' to find 'JoystickDevices's
-             -> m Joystick
-openJoystick (JoystickDevice _ x) =
-  fmap Joystick $
-  throwIfNull "SDL.Input.Joystick.openJoystick" "SDL_OpenJoystick" $
-  Raw.joystickOpen x
-
--- | Close a joystick previously opened with 'openJoystick'.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickClose SDL_JoystickClose>@ for C documentation.
-closeJoystick :: MonadIO m => Joystick -> m ()
-closeJoystick (Joystick j) = Raw.joystickClose j
-
--- | Get the instance ID of an opened joystick. The instance ID is used to identify the joystick
--- in future SDL events.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickInstanceID SDL_JoystickInstanceID>@ for C documentation.
-getJoystickID :: MonadIO m => Joystick -> m (Int32)
-getJoystickID (Joystick j) =
-  throwIfNeg "SDL.Input.Joystick.getJoystickID" "SDL_JoystickInstanceID" $
-  Raw.joystickInstanceID j
-
--- | Determine if a given button is currently held.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickGetButton SDL_JoystickGetButton>@ for C documentation.
-buttonPressed :: (Functor m, MonadIO m)
-              => Joystick
-              -> CInt -- ^ The index of the button. You can use 'numButtons' to determine how many buttons a given joystick has.
-              -> m Bool
-buttonPressed (Joystick j) buttonIndex = (== 1) <$> Raw.joystickGetButton j buttonIndex
-
--- | Get the ball axis change since the last poll.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickGetBall SDL_JoystickGetBall>@ for C documentation.
-ballDelta :: MonadIO m
-          => Joystick
-          -> CInt -- ^ The index of the joystick ball. You can use 'numBalls' to determine how many balls a given joystick has.
-          -> m (V2 CInt)
-ballDelta (Joystick j) ballIndex = liftIO $
-  alloca $ \xptr ->
-  alloca $ \yptr -> do
-    throwIfNeg_ "SDL.Input.Joystick.ballDelta" "SDL_JoystickGetBall" $
-      Raw.joystickGetBall j ballIndex xptr yptr
-
-    V2 <$> peek xptr <*> peek yptr
-
--- | Get the current state of an axis control on a joystick.
---
--- Returns a 16-bit signed integer representing the current position of the axis. The state is a value ranging from -32768 to 32767.
---
--- On most modern joysticks the x-axis is usually represented by axis 0 and the y-axis by axis 1. The value returned by 'axisPosition' is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.
---
--- Some joysticks use axes 2 and 3 for extra buttons.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickGetAxis SDL_JoystickGetAxis>@ for C documentation.
-axisPosition :: MonadIO m => Joystick -> CInt -> m Int16
-axisPosition (Joystick j) axisIndex = Raw.joystickGetAxis j axisIndex
-
--- | Get the number of general axis controls on a joystick.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickNumAxes SDL_JoystickNumAxes>@ for C documentation.
-numAxes :: (MonadIO m) => Joystick -> m CInt
-numAxes (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numAxis" "SDL_JoystickNumAxes" (Raw.joystickNumAxes j)
-
--- | Get the number of buttons on a joystick.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickNumButtons SDL_JoystickNumButtons>@ for C documentation.
-numButtons :: (MonadIO m) => Joystick -> m CInt
-numButtons (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numButtons" "SDL_JoystickNumButtons" (Raw.joystickNumButtons j)
-
--- | Get the number of trackballs on a joystick.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickNumBalls SDL_JoystickNumBalls>@ for C documentation.
-numBalls :: (MonadIO m) => Joystick -> m CInt
-numBalls (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numBalls" "SDL_JoystickNumBalls" (Raw.joystickNumBalls j)
-
--- | Identifies the state of the POV hat on a joystick.
-data JoyHatPosition
-  = HatCentered  -- ^ Centered position
-  | HatUp        -- ^ Up position
-  | HatRight     -- ^ Right position
-  | HatDown      -- ^ Down position
-  | HatLeft      -- ^ Left position
-  | HatRightUp   -- ^ Right-up position
-  | HatRightDown -- ^ Right-down position
-  | HatLeftUp    -- ^ Left-up position
-  | HatLeftDown  -- ^ Left-down position
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber JoyHatPosition Word8 where
-  fromNumber n = case n of
-    Raw.SDL_HAT_CENTERED -> HatCentered
-    Raw.SDL_HAT_UP -> HatUp
-    Raw.SDL_HAT_RIGHT -> HatRight
-    Raw.SDL_HAT_DOWN -> HatDown
-    Raw.SDL_HAT_LEFT -> HatLeft
-    Raw.SDL_HAT_RIGHTUP -> HatRightUp
-    Raw.SDL_HAT_RIGHTDOWN -> HatRightDown
-    Raw.SDL_HAT_LEFTUP -> HatLeftUp
-    Raw.SDL_HAT_LEFTDOWN -> HatLeftDown
-    _ -> HatCentered
-
--- | Get current position of a POV hat on a joystick.
---
--- See @<https://wiki.libsdl.org/SDL_JoystickGetHat SDL_JoystickGetHat>@ for C documentation.
-getHat :: (Functor m, MonadIO m)
-       => Joystick
-       -> CInt -- ^ The index of the POV hat. You can use 'numHats' to determine how many POV hats a given joystick has.
-       -> m JoyHatPosition
-getHat (Joystick j) hatIndex = fromNumber <$> Raw.joystickGetHat j hatIndex
-
--- | Get the number of POV hats on a joystick.
---
--- See @<https://wiki.libsdl.org/https://wiki.libsdl.org/SDL_JoystickNumHats SDL_JoystickNumHats>@ for C documentation.
-numHats :: (MonadIO m) => Joystick -> m CInt
-numHats (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numHats" "SDL_JoystickNumHats" (Raw.joystickNumHats j)
-
--- | Identifies whether a joystick has been connected or disconnected.
-data JoyDeviceConnection = JoyDeviceAdded | JoyDeviceRemoved
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber JoyDeviceConnection Word32 where
-  fromNumber n = case n of
-    Raw.SDL_JOYDEVICEADDED -> JoyDeviceAdded
-    Raw.SDL_JOYDEVICEREMOVED -> JoyDeviceRemoved
-    _ -> JoyDeviceAdded
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}++module SDL.Input.Joystick+  ( numJoysticks+  , availableJoysticks+  , JoystickDevice(..)++  , openJoystick+  , closeJoystick++  , getJoystickID+  , Joystick+  , JoyButtonState(..)+  , buttonPressed+  , ballDelta+  , axisPosition+  , numAxes+  , numButtons+  , numBalls+  , JoyHatPosition(..)+  , getHat+  , numHats+  , JoyDeviceConnection(..)+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Data (Data)+import Data.Int+import Data.Text (Text)+import Data.Traversable (for)+import Data.Typeable+import Data.Word+import Foreign.C.Types+import Foreign.Marshal.Alloc+import Foreign.Storable+import GHC.Generics (Generic)+import SDL.Vect+import SDL.Internal.Exception+import SDL.Internal.Numbered+import SDL.Internal.Types+import qualified Data.ByteString as BS+import qualified Data.Text.Encoding as Text+import qualified Data.Vector as V+import qualified SDL.Raw as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++-- | A description of joystick that can be opened using 'openJoystick'. To retrieve a list of+-- connected joysticks, use 'availableJoysticks'.+data JoystickDevice = JoystickDevice+  { joystickDeviceName :: Text+  , joystickDeviceId :: CInt+  } deriving (Eq, Generic, Read, Ord, Show, Typeable)++-- | Identifies the state of a joystick button.+data JoyButtonState = JoyButtonPressed | JoyButtonReleased+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber JoyButtonState Word8 where+  fromNumber n = case n of+    Raw.SDL_PRESSED -> JoyButtonPressed+    Raw.SDL_RELEASED -> JoyButtonReleased+    _ -> JoyButtonReleased++-- | Count the number of joysticks attached to the system.+--+-- See @<https://wiki.libsdl.org/SDL_NumJoysticks SDL_NumJoysticks>@ for C documentation.+numJoysticks :: MonadIO m => m (CInt)+numJoysticks = throwIfNeg "SDL.Input.Joystick.availableJoysticks" "SDL_NumJoysticks" Raw.numJoysticks++-- | Enumerate all connected joysticks, retrieving a description of each.+availableJoysticks :: MonadIO m => m (V.Vector JoystickDevice)+availableJoysticks = liftIO $ do+  n <- numJoysticks+  fmap (V.fromList) $+    for [0 .. (n - 1)] $ \i -> do+      cstr <-+        throwIfNull "SDL.Input.Joystick.availableJoysticks" "SDL_JoystickNameForIndex" $+          Raw.joystickNameForIndex i+      name <- Text.decodeUtf8 <$> BS.packCString cstr+      return (JoystickDevice name i)++-- | Open a joystick so that you can start receiving events from interaction with this joystick.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickOpen SDL_JoystickOpen>@ for C documentation.+openJoystick :: (Functor m,MonadIO m)+             => JoystickDevice -- ^ The device to open. Use 'availableJoysticks' to find 'JoystickDevices's+             -> m Joystick+openJoystick (JoystickDevice _ x) =+  fmap Joystick $+  throwIfNull "SDL.Input.Joystick.openJoystick" "SDL_OpenJoystick" $+  Raw.joystickOpen x++-- | Close a joystick previously opened with 'openJoystick'.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickClose SDL_JoystickClose>@ for C documentation.+closeJoystick :: MonadIO m => Joystick -> m ()+closeJoystick (Joystick j) = Raw.joystickClose j++-- | Get the instance ID of an opened joystick. The instance ID is used to identify the joystick+-- in future SDL events.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickInstanceID SDL_JoystickInstanceID>@ for C documentation.+getJoystickID :: MonadIO m => Joystick -> m (Int32)+getJoystickID (Joystick j) =+  throwIfNeg "SDL.Input.Joystick.getJoystickID" "SDL_JoystickInstanceID" $+  Raw.joystickInstanceID j++-- | Determine if a given button is currently held.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickGetButton SDL_JoystickGetButton>@ for C documentation.+buttonPressed :: (Functor m, MonadIO m)+              => Joystick+              -> CInt -- ^ The index of the button. You can use 'numButtons' to determine how many buttons a given joystick has.+              -> m Bool+buttonPressed (Joystick j) buttonIndex = (== 1) <$> Raw.joystickGetButton j buttonIndex++-- | Get the ball axis change since the last poll.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickGetBall SDL_JoystickGetBall>@ for C documentation.+ballDelta :: MonadIO m+          => Joystick+          -> CInt -- ^ The index of the joystick ball. You can use 'numBalls' to determine how many balls a given joystick has.+          -> m (V2 CInt)+ballDelta (Joystick j) ballIndex = liftIO $+  alloca $ \xptr ->+  alloca $ \yptr -> do+    throwIfNeg_ "SDL.Input.Joystick.ballDelta" "SDL_JoystickGetBall" $+      Raw.joystickGetBall j ballIndex xptr yptr++    V2 <$> peek xptr <*> peek yptr++-- | Get the current state of an axis control on a joystick.+--+-- Returns a 16-bit signed integer representing the current position of the axis. The state is a value ranging from -32768 to 32767.+--+-- On most modern joysticks the x-axis is usually represented by axis 0 and the y-axis by axis 1. The value returned by 'axisPosition' is a signed integer (-32768 to 32767) representing the current position of the axis. It may be necessary to impose certain tolerances on these values to account for jitter.+--+-- Some joysticks use axes 2 and 3 for extra buttons.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickGetAxis SDL_JoystickGetAxis>@ for C documentation.+axisPosition :: MonadIO m => Joystick -> CInt -> m Int16+axisPosition (Joystick j) axisIndex = Raw.joystickGetAxis j axisIndex++-- | Get the number of general axis controls on a joystick.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickNumAxes SDL_JoystickNumAxes>@ for C documentation.+numAxes :: (MonadIO m) => Joystick -> m CInt+numAxes (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numAxis" "SDL_JoystickNumAxes" (Raw.joystickNumAxes j)++-- | Get the number of buttons on a joystick.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickNumButtons SDL_JoystickNumButtons>@ for C documentation.+numButtons :: (MonadIO m) => Joystick -> m CInt+numButtons (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numButtons" "SDL_JoystickNumButtons" (Raw.joystickNumButtons j)++-- | Get the number of trackballs on a joystick.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickNumBalls SDL_JoystickNumBalls>@ for C documentation.+numBalls :: (MonadIO m) => Joystick -> m CInt+numBalls (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numBalls" "SDL_JoystickNumBalls" (Raw.joystickNumBalls j)++-- | Identifies the state of the POV hat on a joystick.+data JoyHatPosition+  = HatCentered  -- ^ Centered position+  | HatUp        -- ^ Up position+  | HatRight     -- ^ Right position+  | HatDown      -- ^ Down position+  | HatLeft      -- ^ Left position+  | HatRightUp   -- ^ Right-up position+  | HatRightDown -- ^ Right-down position+  | HatLeftUp    -- ^ Left-up position+  | HatLeftDown  -- ^ Left-down position+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber JoyHatPosition Word8 where+  fromNumber n = case n of+    Raw.SDL_HAT_CENTERED -> HatCentered+    Raw.SDL_HAT_UP -> HatUp+    Raw.SDL_HAT_RIGHT -> HatRight+    Raw.SDL_HAT_DOWN -> HatDown+    Raw.SDL_HAT_LEFT -> HatLeft+    Raw.SDL_HAT_RIGHTUP -> HatRightUp+    Raw.SDL_HAT_RIGHTDOWN -> HatRightDown+    Raw.SDL_HAT_LEFTUP -> HatLeftUp+    Raw.SDL_HAT_LEFTDOWN -> HatLeftDown+    _ -> HatCentered++-- | Get current position of a POV hat on a joystick.+--+-- See @<https://wiki.libsdl.org/SDL_JoystickGetHat SDL_JoystickGetHat>@ for C documentation.+getHat :: (Functor m, MonadIO m)+       => Joystick+       -> CInt -- ^ The index of the POV hat. You can use 'numHats' to determine how many POV hats a given joystick has.+       -> m JoyHatPosition+getHat (Joystick j) hatIndex = fromNumber <$> Raw.joystickGetHat j hatIndex++-- | Get the number of POV hats on a joystick.+--+-- See @<https://wiki.libsdl.org/https://wiki.libsdl.org/SDL_JoystickNumHats SDL_JoystickNumHats>@ for C documentation.+numHats :: (MonadIO m) => Joystick -> m CInt+numHats (Joystick j) = liftIO $ throwIfNeg "SDL.Input.Joystick.numHats" "SDL_JoystickNumHats" (Raw.joystickNumHats j)++-- | Identifies whether a joystick has been connected or disconnected.+data JoyDeviceConnection = JoyDeviceAdded | JoyDeviceRemoved+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber JoyDeviceConnection Word32 where+  fromNumber n = case n of+    Raw.SDL_JOYDEVICEADDED -> JoyDeviceAdded+    Raw.SDL_JOYDEVICEREMOVED -> JoyDeviceRemoved+    _ -> JoyDeviceAdded
src/SDL/Input/Keyboard.hs view
@@ -1,166 +1,166 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-
-module SDL.Input.Keyboard
-  ( -- * Keyboard Modifiers
-    getModState
-  , KeyModifier(..)
-
-  , getKeyboardState
-
-  -- * Text Input
-  , startTextInput
-  , stopTextInput
-
-  -- * Screen Keyboard
-  , hasScreenKeyboardSupport
-  , isScreenKeyboardShown
-
-  -- * Scancodes
-  , getScancodeName
-  , Scancode(..)
-
-  -- * Keycodes
-  , Keycode(..)
-
-  -- * Keysym
-  , Keysym(..)
-
-  -- * Keycodes and Scancodes
-  , module SDL.Input.Keyboard.Codes
-) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Bits
-import Data.Data (Data)
-import Data.Typeable
-import Data.Word
-import Foreign.C.String
-import Foreign.Marshal.Alloc
-import Foreign.Marshal.Array
-import Foreign.Storable
-import GHC.Generics (Generic)
-import SDL.Input.Keyboard.Codes
-import SDL.Internal.Numbered
-import SDL.Internal.Types
-import qualified Data.Vector as V
-import qualified SDL.Raw.Enum as Raw
-import qualified SDL.Raw.Event as Raw
-import qualified SDL.Raw.Types as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
--- | Get the current key modifier state for the keyboard. The key modifier state is a mask special keys that are held down.
---
--- See @<https://wiki.libsdl.org/SDL_GetModState SDL_GetModState>@ for C documentation.
-getModState :: (Functor m, MonadIO m) => m KeyModifier
-getModState = fromNumber <$> Raw.getModState
-
--- | Information about which keys are currently held down. Use 'getModState' to generate this information.
-data KeyModifier = KeyModifier
-  { keyModifierLeftShift  :: Bool
-  , keyModifierRightShift :: Bool
-  , keyModifierLeftCtrl   :: Bool
-  , keyModifierRightCtrl  :: Bool
-  , keyModifierLeftAlt    :: Bool
-  , keyModifierRightAlt   :: Bool
-  , keyModifierLeftGUI    :: Bool
-  , keyModifierRightGUI   :: Bool
-  , keyModifierNumLock    :: Bool
-  , keyModifierCapsLock   :: Bool
-  , keyModifierAltGr      :: Bool
-  } deriving (Data, Eq, Ord, Read, Generic, Show, Typeable)
-
-instance FromNumber KeyModifier Word32 where
-  fromNumber m' = let m = m' in KeyModifier
-    { keyModifierLeftShift  = m .&. Raw.KMOD_LSHIFT > 0
-    , keyModifierRightShift = m .&. Raw.KMOD_RSHIFT > 0
-    , keyModifierLeftCtrl   = m .&. Raw.KMOD_LCTRL  > 0
-    , keyModifierRightCtrl  = m .&. Raw.KMOD_RCTRL  > 0
-    , keyModifierLeftAlt    = m .&. Raw.KMOD_LALT   > 0
-    , keyModifierRightAlt   = m .&. Raw.KMOD_RALT   > 0
-    , keyModifierLeftGUI    = m .&. Raw.KMOD_LGUI   > 0
-    , keyModifierRightGUI   = m .&. Raw.KMOD_RGUI   > 0
-    , keyModifierNumLock    = m .&. Raw.KMOD_NUM    > 0
-    , keyModifierCapsLock   = m .&. Raw.KMOD_CAPS   > 0
-    , keyModifierAltGr      = m .&. Raw.KMOD_MODE   > 0
-    }
-
-instance ToNumber KeyModifier Word32 where
-  toNumber m = foldr (.|.) 0
-    [ if keyModifierLeftShift m  then Raw.KMOD_LSHIFT else 0
-    , if keyModifierRightShift m then Raw.KMOD_RSHIFT else 0
-    , if keyModifierLeftCtrl m   then Raw.KMOD_LCTRL  else 0
-    , if keyModifierRightCtrl m  then Raw.KMOD_RCTRL  else 0
-    , if keyModifierLeftAlt m    then Raw.KMOD_LALT   else 0
-    , if keyModifierRightAlt m   then Raw.KMOD_RALT   else 0
-    , if keyModifierLeftGUI m    then Raw.KMOD_LGUI   else 0
-    , if keyModifierRightGUI m   then Raw.KMOD_RGUI   else 0
-    , if keyModifierNumLock m    then Raw.KMOD_NUM    else 0
-    , if keyModifierCapsLock m   then Raw.KMOD_CAPS   else 0
-    , if keyModifierAltGr m      then Raw.KMOD_MODE   else 0
-    ]
-
--- | Set the rectangle used to type text inputs and start accepting text input
--- events.
---
--- See @<https://wiki.libsdl.org/SDL_StartTextInput SDL_StartTextInput>@ for C documentation.
-startTextInput :: MonadIO m => Raw.Rect -> m ()
-startTextInput rect = liftIO $ do
-  alloca $ \ptr -> do
-    poke ptr rect
-    Raw.setTextInputRect ptr
-  Raw.startTextInput
-
--- | Stop receiving any text input events.
---
--- See @<https://wiki.libsdl.org/SDL_StopTextInput SDL_StopTextInput>@ for C documentation.
-stopTextInput :: MonadIO m => m ()
-stopTextInput = Raw.stopTextInput
-
--- | Check whether the platform has screen keyboard support.
---
--- See @<https://wiki.libsdl.org/SDL_HasScreenKeyboardSupport SDL_HasScreenKeyboardSupport>@ for C documentation.
-hasScreenKeyboardSupport :: MonadIO m => m Bool
-hasScreenKeyboardSupport = Raw.hasScreenKeyboardSupport
-
--- | Check whether the screen keyboard is shown for the given window.
---
--- See @<https://wiki.libsdl.org/SDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown>@ for C documentation.
-isScreenKeyboardShown :: MonadIO m => Window -> m Bool
-isScreenKeyboardShown (Window w) = Raw.isScreenKeyboardShown w
-
--- | Get a human-readable name for a scancode. If the scancode doesn't have a name this function returns the empty string.
---
--- See @<https://wiki.libsdl.org/SDL_GetScancodeName SDL_GetScancodeName>@ for C documentation.
-getScancodeName :: MonadIO m => Scancode -> m String
-getScancodeName scancode = liftIO $ do
-  name <- Raw.getScancodeName $ toNumber scancode
-  peekCString name
-
--- | Information about a key press or key release event.
-data Keysym = Keysym
-  { keysymScancode :: Scancode
-    -- ^ The keyboard 'Scancode'
-  , keysymKeycode  :: Keycode
-    -- ^ SDL's virtual key representation for this key
-  , keysymModifier :: KeyModifier
-    -- ^ A set of modifiers that were held at the time this data was generated
-  } deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Get a snapshot of the current state of the keyboard.
---
--- This computation generates a mapping from 'Scancode' to 'Bool' - evaluating the function at specific 'Scancode's will inform you as to whether or not that key was held down when 'getKeyboardState' was called.
---
--- See @<https://wiki.libsdl.org/SDL_GetKeyboardState SDL_GetKeyboardState>@ for C documentation.
-getKeyboardState :: MonadIO m => m (Scancode -> Bool)
-getKeyboardState = liftIO $ do
-  alloca $ \nkeys -> do
-    keyptr <- Raw.getKeyboardState nkeys
-    n <- peek nkeys
-    keys <- V.fromList <$> peekArray (fromIntegral n) keyptr
-    return $ \scancode -> 1 == keys V.! fromIntegral (toNumber scancode)
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}++module SDL.Input.Keyboard+  ( -- * Keyboard Modifiers+    getModState+  , KeyModifier(..)++  , getKeyboardState++  -- * Text Input+  , startTextInput+  , stopTextInput++  -- * Screen Keyboard+  , hasScreenKeyboardSupport+  , isScreenKeyboardShown++  -- * Scancodes+  , getScancodeName+  , Scancode(..)++  -- * Keycodes+  , Keycode(..)++  -- * Keysym+  , Keysym(..)++  -- * Keycodes and Scancodes+  , module SDL.Input.Keyboard.Codes+) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Bits+import Data.Data (Data)+import Data.Typeable+import Data.Word+import Foreign.C.String+import Foreign.Marshal.Alloc+import Foreign.Marshal.Array+import Foreign.Storable+import GHC.Generics (Generic)+import SDL.Input.Keyboard.Codes+import SDL.Internal.Numbered+import SDL.Internal.Types+import qualified Data.Vector as V+import qualified SDL.Raw.Enum as Raw+import qualified SDL.Raw.Event as Raw+import qualified SDL.Raw.Types as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++-- | Get the current key modifier state for the keyboard. The key modifier state is a mask special keys that are held down.+--+-- See @<https://wiki.libsdl.org/SDL_GetModState SDL_GetModState>@ for C documentation.+getModState :: (Functor m, MonadIO m) => m KeyModifier+getModState = fromNumber <$> Raw.getModState++-- | Information about which keys are currently held down. Use 'getModState' to generate this information.+data KeyModifier = KeyModifier+  { keyModifierLeftShift  :: Bool+  , keyModifierRightShift :: Bool+  , keyModifierLeftCtrl   :: Bool+  , keyModifierRightCtrl  :: Bool+  , keyModifierLeftAlt    :: Bool+  , keyModifierRightAlt   :: Bool+  , keyModifierLeftGUI    :: Bool+  , keyModifierRightGUI   :: Bool+  , keyModifierNumLock    :: Bool+  , keyModifierCapsLock   :: Bool+  , keyModifierAltGr      :: Bool+  } deriving (Data, Eq, Ord, Read, Generic, Show, Typeable)++instance FromNumber KeyModifier Word32 where+  fromNumber m' = let m = m' in KeyModifier+    { keyModifierLeftShift  = m .&. Raw.KMOD_LSHIFT > 0+    , keyModifierRightShift = m .&. Raw.KMOD_RSHIFT > 0+    , keyModifierLeftCtrl   = m .&. Raw.KMOD_LCTRL  > 0+    , keyModifierRightCtrl  = m .&. Raw.KMOD_RCTRL  > 0+    , keyModifierLeftAlt    = m .&. Raw.KMOD_LALT   > 0+    , keyModifierRightAlt   = m .&. Raw.KMOD_RALT   > 0+    , keyModifierLeftGUI    = m .&. Raw.KMOD_LGUI   > 0+    , keyModifierRightGUI   = m .&. Raw.KMOD_RGUI   > 0+    , keyModifierNumLock    = m .&. Raw.KMOD_NUM    > 0+    , keyModifierCapsLock   = m .&. Raw.KMOD_CAPS   > 0+    , keyModifierAltGr      = m .&. Raw.KMOD_MODE   > 0+    }++instance ToNumber KeyModifier Word32 where+  toNumber m = foldr (.|.) 0+    [ if keyModifierLeftShift m  then Raw.KMOD_LSHIFT else 0+    , if keyModifierRightShift m then Raw.KMOD_RSHIFT else 0+    , if keyModifierLeftCtrl m   then Raw.KMOD_LCTRL  else 0+    , if keyModifierRightCtrl m  then Raw.KMOD_RCTRL  else 0+    , if keyModifierLeftAlt m    then Raw.KMOD_LALT   else 0+    , if keyModifierRightAlt m   then Raw.KMOD_RALT   else 0+    , if keyModifierLeftGUI m    then Raw.KMOD_LGUI   else 0+    , if keyModifierRightGUI m   then Raw.KMOD_RGUI   else 0+    , if keyModifierNumLock m    then Raw.KMOD_NUM    else 0+    , if keyModifierCapsLock m   then Raw.KMOD_CAPS   else 0+    , if keyModifierAltGr m      then Raw.KMOD_MODE   else 0+    ]++-- | Set the rectangle used to type text inputs and start accepting text input+-- events.+--+-- See @<https://wiki.libsdl.org/SDL_StartTextInput SDL_StartTextInput>@ for C documentation.+startTextInput :: MonadIO m => Raw.Rect -> m ()+startTextInput rect = liftIO $ do+  alloca $ \ptr -> do+    poke ptr rect+    Raw.setTextInputRect ptr+  Raw.startTextInput++-- | Stop receiving any text input events.+--+-- See @<https://wiki.libsdl.org/SDL_StopTextInput SDL_StopTextInput>@ for C documentation.+stopTextInput :: MonadIO m => m ()+stopTextInput = Raw.stopTextInput++-- | Check whether the platform has screen keyboard support.+--+-- See @<https://wiki.libsdl.org/SDL_HasScreenKeyboardSupport SDL_HasScreenKeyboardSupport>@ for C documentation.+hasScreenKeyboardSupport :: MonadIO m => m Bool+hasScreenKeyboardSupport = Raw.hasScreenKeyboardSupport++-- | Check whether the screen keyboard is shown for the given window.+--+-- See @<https://wiki.libsdl.org/SDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown>@ for C documentation.+isScreenKeyboardShown :: MonadIO m => Window -> m Bool+isScreenKeyboardShown (Window w) = Raw.isScreenKeyboardShown w++-- | Get a human-readable name for a scancode. If the scancode doesn't have a name this function returns the empty string.+--+-- See @<https://wiki.libsdl.org/SDL_GetScancodeName SDL_GetScancodeName>@ for C documentation.+getScancodeName :: MonadIO m => Scancode -> m String+getScancodeName scancode = liftIO $ do+  name <- Raw.getScancodeName $ toNumber scancode+  peekCString name++-- | Information about a key press or key release event.+data Keysym = Keysym+  { keysymScancode :: Scancode+    -- ^ The keyboard 'Scancode'+  , keysymKeycode  :: Keycode+    -- ^ SDL's virtual key representation for this key+  , keysymModifier :: KeyModifier+    -- ^ A set of modifiers that were held at the time this data was generated+  } deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++-- | Get a snapshot of the current state of the keyboard.+--+-- This computation generates a mapping from 'Scancode' to 'Bool' - evaluating the function at specific 'Scancode's will inform you as to whether or not that key was held down when 'getKeyboardState' was called.+--+-- See @<https://wiki.libsdl.org/SDL_GetKeyboardState SDL_GetKeyboardState>@ for C documentation.+getKeyboardState :: MonadIO m => m (Scancode -> Bool)+getKeyboardState = liftIO $ do+  alloca $ \nkeys -> do+    keyptr <- Raw.getKeyboardState nkeys+    n <- peek nkeys+    keys <- V.fromList <$> peekArray (fromIntegral n) keyptr+    return $ \scancode -> 1 == keys V.! fromIntegral (toNumber scancode)
src/SDL/Input/Keyboard/Codes.hs view
@@ -1,1011 +1,1011 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE PatternSynonyms #-}
-
-{-|
-
-An enumeration of scancodes and keycodes, allowing you to pattern match on keyboard keys.
-
-This module uses a relatively new GHC feature called @PatternSynonyms@ in order to provide pattern
-matches over the underlying 'Scancode' or 'Keycode'. We do this so that you are also able to
-work with vendor-specific or otherwise unknown codes.
-
--}
-
-module SDL.Input.Keyboard.Codes
-       (-- * Scancodes
-        -- | Scancodes are codes that correspond to the physical position of a key, independent of the current keyboard layout.
-        -- Scancodes are meant to be layout-independent. Think of this as \"the user pressed the Q key as it would be on a US QWERTY keyboard\" regardless of whether this is actually a European keyboard or a Dvorak keyboard or whatever. The scancode is always the same key position.
-        -- 'Scancode' makes sense when you want key presses based on their location on a keyboard - for example, the traditional \"WASD\" layout used in first-person shooters.
-        Scancode(..),
-        pattern ScancodeUnknown,
-        pattern ScancodeA,
-        pattern ScancodeB,
-        pattern ScancodeC,
-        pattern ScancodeD,
-        pattern ScancodeE,
-        pattern ScancodeF,
-        pattern ScancodeG,
-        pattern ScancodeH,
-        pattern ScancodeI,
-        pattern ScancodeJ,
-        pattern ScancodeK,
-        pattern ScancodeL,
-        pattern ScancodeM,
-        pattern ScancodeN,
-        pattern ScancodeO,
-        pattern ScancodeP,
-        pattern ScancodeQ,
-        pattern ScancodeR,
-        pattern ScancodeS,
-        pattern ScancodeT,
-        pattern ScancodeU,
-        pattern ScancodeV,
-        pattern ScancodeW,
-        pattern ScancodeX,
-        pattern ScancodeY,
-        pattern ScancodeZ,
-        pattern Scancode1,
-        pattern Scancode2,
-        pattern Scancode3,
-        pattern Scancode4,
-        pattern Scancode5,
-        pattern Scancode6,
-        pattern Scancode7,
-        pattern Scancode8,
-        pattern Scancode9,
-        pattern Scancode0,
-        pattern ScancodeReturn,
-        pattern ScancodeEscape,
-        pattern ScancodeBackspace,
-        pattern ScancodeTab,
-        pattern ScancodeSpace,
-        pattern ScancodeMinus,
-        pattern ScancodeEquals,
-        pattern ScancodeLeftBracket,
-        pattern ScancodeRightBracket,
-        pattern ScancodeBackslash,
-        pattern ScancodeNonUSHash,
-        pattern ScancodeSemicolon,
-        pattern ScancodeApostrophe,
-        pattern ScancodeGrave,
-        pattern ScancodeComma,
-        pattern ScancodePeriod,
-        pattern ScancodeSlash,
-        pattern ScancodeCapsLock,
-        pattern ScancodeF1,
-        pattern ScancodeF2,
-        pattern ScancodeF3,
-        pattern ScancodeF4,
-        pattern ScancodeF5,
-        pattern ScancodeF6,
-        pattern ScancodeF7,
-        pattern ScancodeF8,
-        pattern ScancodeF9,
-        pattern ScancodeF10,
-        pattern ScancodeF11,
-        pattern ScancodeF12,
-        pattern ScancodePrintScreen,
-        pattern ScancodeScrollLock,
-        pattern ScancodePause,
-        pattern ScancodeInsert,
-        pattern ScancodeHome,
-        pattern ScancodePageUp,
-        pattern ScancodeDelete,
-        pattern ScancodeEnd,
-        pattern ScancodePageDown,
-        pattern ScancodeRight,
-        pattern ScancodeLeft,
-        pattern ScancodeDown,
-        pattern ScancodeUp,
-        pattern ScancodeNumLockClear,
-        pattern ScancodeKPDivide,
-        pattern ScancodeKPMultiply,
-        pattern ScancodeKPMinus,
-        pattern ScancodeKPPlus,
-        pattern ScancodeKPEnter,
-        pattern ScancodeKP1,
-        pattern ScancodeKP2,
-        pattern ScancodeKP3,
-        pattern ScancodeKP4,
-        pattern ScancodeKP5,
-        pattern ScancodeKP6,
-        pattern ScancodeKP7,
-        pattern ScancodeKP8,
-        pattern ScancodeKP9,
-        pattern ScancodeKP0,
-        pattern ScancodeKPPeriod,
-        pattern ScancodeNonUSBackslash,
-        pattern ScancodeApplication,
-        pattern ScancodePower,
-        pattern ScancodeKPEquals,
-        pattern ScancodeF13,
-        pattern ScancodeF14,
-        pattern ScancodeF15,
-        pattern ScancodeF16,
-        pattern ScancodeF17,
-        pattern ScancodeF18,
-        pattern ScancodeF19,
-        pattern ScancodeF20,
-        pattern ScancodeF21,
-        pattern ScancodeF22,
-        pattern ScancodeF23,
-        pattern ScancodeF24,
-        pattern ScancodeExecute,
-        pattern ScancodeHelp,
-        pattern ScancodeMenu,
-        pattern ScancodeSelect,
-        pattern ScancodeStop,
-        pattern ScancodeAgain,
-        pattern ScancodeUndo,
-        pattern ScancodeCut,
-        pattern ScancodeCopy,
-        pattern ScancodePaste,
-        pattern ScancodeFind,
-        pattern ScancodeMute,
-        pattern ScancodeVolumeUp,
-        pattern ScancodeVolumeDown,
-        pattern ScancodeKPComma,
-        pattern ScancodeKPEqualsAS400,
-        pattern ScancodeInternational1,
-        pattern ScancodeInternational2,
-        pattern ScancodeInternational3,
-        pattern ScancodeInternational4,
-        pattern ScancodeInternational5,
-        pattern ScancodeInternational6,
-        pattern ScancodeInternational7,
-        pattern ScancodeInternational8,
-        pattern ScancodeInternational9,
-        pattern ScancodeLang1,
-        pattern ScancodeLang2,
-        pattern ScancodeLang3,
-        pattern ScancodeLang4,
-        pattern ScancodeLang5,
-        pattern ScancodeLang6,
-        pattern ScancodeLang7,
-        pattern ScancodeLang8,
-        pattern ScancodeLang9,
-        pattern ScancodeAltErase,
-        pattern ScancodeSysReq,
-        pattern ScancodeCancel,
-        pattern ScancodeClear,
-        pattern ScancodePrior,
-        pattern ScancodeReturn2,
-        pattern ScancodeSeparator,
-        pattern ScancodeOut,
-        pattern ScancodeOper,
-        pattern ScancodeClearAgain,
-        pattern ScancodeCrSel,
-        pattern ScancodeExSel,
-        pattern ScancodeKP00,
-        pattern ScancodeKP000,
-        pattern ScancodeThousandsSeparator,
-        pattern ScancodeDecimalSeparator,
-        pattern ScancodeCurrencyUnit,
-        pattern ScancodeCurrencySubunit,
-        pattern ScancodeLeftParen,
-        pattern ScancodeRightParen,
-        pattern ScancodeLeftBrace,
-        pattern ScancodeRightBrace,
-        pattern ScancodeKPTab,
-        pattern ScancodeKPBackspace,
-        pattern ScancodeKPA,
-        pattern ScancodeKPB,
-        pattern ScancodeKPC,
-        pattern ScancodeKPD,
-        pattern ScancodeKPE,
-        pattern ScancodeKPF,
-        pattern ScancodeKPXOR,
-        pattern ScancodeKPPower,
-        pattern ScancodeKPPercent,
-        pattern ScancodeKPLess,
-        pattern ScancodeKPGreater,
-        pattern ScancodeKPAmpersand,
-        pattern ScancodeKPDblAmpersand,
-        pattern ScancodeKPVerticalBar,
-        pattern ScancodeKPDblVerticalBar,
-        pattern ScancodeKPColon,
-        pattern ScancodeKPHash,
-        pattern ScancodeKPSpace,
-        pattern ScancodeKPAt,
-        pattern ScancodeKPExclam,
-        pattern ScancodeKPMemStore,
-        pattern ScancodeKPMemRecall,
-        pattern ScancodeKPMemClear,
-        pattern ScancodeKPMemAdd,
-        pattern ScancodeKPMemSubtract,
-        pattern ScancodeKPMemMultiply,
-        pattern ScancodeKPMemDivide,
-        pattern ScancodeKPPlusMinus,
-        pattern ScancodeKPClear,
-        pattern ScancodeKPClearEntry,
-        pattern ScancodeKPBinary,
-        pattern ScancodeKPOctal,
-        pattern ScancodeKPDecimal,
-        pattern ScancodeKPHexadecimal,
-        pattern ScancodeLCtrl,
-        pattern ScancodeLShift,
-        pattern ScancodeLAlt,
-        pattern ScancodeLGUI,
-        pattern ScancodeRCtrl,
-        pattern ScancodeRShift,
-        pattern ScancodeRAlt,
-        pattern ScancodeRGUI,
-        pattern ScancodeMode,
-        pattern ScancodeAudioNext,
-        pattern ScancodeAudioPrev,
-        pattern ScancodeAudioStop,
-        pattern ScancodeAudioPlay,
-        pattern ScancodeAudioMute,
-        pattern ScancodeMediaSelect,
-        pattern ScancodeWWW,
-        pattern ScancodeMail,
-        pattern ScancodeCalculator,
-        pattern ScancodeComputer,
-        pattern ScancodeACSearch,
-        pattern ScancodeACHome,
-        pattern ScancodeACBack,
-        pattern ScancodeACForward,
-        pattern ScancodeACStop,
-        pattern ScancodeACRefresh,
-        pattern ScancodeACBookmarks,
-        pattern ScancodeBrightnessDown,
-        pattern ScancodeBrightnessUp,
-        pattern ScancodeDisplaySwitch,
-        pattern ScancodeKBDIllumToggle,
-        pattern ScancodeKBDIllumDown,
-        pattern ScancodeKBDIllumUp,
-        pattern ScancodeEject,
-        pattern ScancodeSleep,
-        pattern ScancodeApp1,
-        pattern ScancodeApp2,
-
-        -- * Keycode
-        -- | Keycodes are layout-dependent codes, in that the code you receive can change for the same physical key depending on the users keyboard layout.
-        -- Think of this as "the user pressed the key that is labelled 'Q' on a specific keyboard."
-        -- 'Keycode' makes sense when you are anticipating the user to press either keys that match some mneumonic, or they are entering text.
-        Keycode(..),
-        pattern KeycodeUnknown,
-        pattern KeycodeReturn,
-        pattern KeycodeEscape,
-        pattern KeycodeBackspace,
-        pattern KeycodeTab,
-        pattern KeycodeSpace,
-        pattern KeycodeExclaim,
-        pattern KeycodeQuoteDbl,
-        pattern KeycodeHash,
-        pattern KeycodePercent,
-        pattern KeycodeDollar,
-        pattern KeycodeAmpersand,
-        pattern KeycodeQuote,
-        pattern KeycodeLeftParen,
-        pattern KeycodeRightParen,
-        pattern KeycodeAsterisk,
-        pattern KeycodePlus,
-        pattern KeycodeComma,
-        pattern KeycodeMinus,
-        pattern KeycodePeriod,
-        pattern KeycodeSlash,
-        pattern Keycode0,
-        pattern Keycode1,
-        pattern Keycode2,
-        pattern Keycode3,
-        pattern Keycode4,
-        pattern Keycode5,
-        pattern Keycode6,
-        pattern Keycode7,
-        pattern Keycode8,
-        pattern Keycode9,
-        pattern KeycodeColon,
-        pattern KeycodeSemicolon,
-        pattern KeycodeLess,
-        pattern KeycodeEquals,
-        pattern KeycodeGreater,
-        pattern KeycodeQuestion,
-        pattern KeycodeAt,
-        pattern KeycodeLeftBracket,
-        pattern KeycodeBackslash,
-        pattern KeycodeRightBracket,
-        pattern KeycodeCaret,
-        pattern KeycodeUnderscore,
-        pattern KeycodeBackquote,
-        pattern KeycodeA,
-        pattern KeycodeB,
-        pattern KeycodeC,
-        pattern KeycodeD,
-        pattern KeycodeE,
-        pattern KeycodeF,
-        pattern KeycodeG,
-        pattern KeycodeH,
-        pattern KeycodeI,
-        pattern KeycodeJ,
-        pattern KeycodeK,
-        pattern KeycodeL,
-        pattern KeycodeM,
-        pattern KeycodeN,
-        pattern KeycodeO,
-        pattern KeycodeP,
-        pattern KeycodeQ,
-        pattern KeycodeR,
-        pattern KeycodeS,
-        pattern KeycodeT,
-        pattern KeycodeU,
-        pattern KeycodeV,
-        pattern KeycodeW,
-        pattern KeycodeX,
-        pattern KeycodeY,
-        pattern KeycodeZ,
-        pattern KeycodeCapsLock,
-        pattern KeycodeF1,
-        pattern KeycodeF2,
-        pattern KeycodeF3,
-        pattern KeycodeF4,
-        pattern KeycodeF5,
-        pattern KeycodeF6,
-        pattern KeycodeF7,
-        pattern KeycodeF8,
-        pattern KeycodeF9,
-        pattern KeycodeF10,
-        pattern KeycodeF11,
-        pattern KeycodeF12,
-        pattern KeycodePrintScreen,
-        pattern KeycodeScrollLock,
-        pattern KeycodePause,
-        pattern KeycodeInsert,
-        pattern KeycodeHome,
-        pattern KeycodePageUp,
-        pattern KeycodeDelete,
-        pattern KeycodeEnd,
-        pattern KeycodePageDown,
-        pattern KeycodeRight,
-        pattern KeycodeLeft,
-        pattern KeycodeDown,
-        pattern KeycodeUp,
-        pattern KeycodeNumLockClear,
-        pattern KeycodeKPDivide,
-        pattern KeycodeKPMultiply,
-        pattern KeycodeKPMinus,
-        pattern KeycodeKPPlus,
-        pattern KeycodeKPEnter,
-        pattern KeycodeKP1,
-        pattern KeycodeKP2,
-        pattern KeycodeKP3,
-        pattern KeycodeKP4,
-        pattern KeycodeKP5,
-        pattern KeycodeKP6,
-        pattern KeycodeKP7,
-        pattern KeycodeKP8,
-        pattern KeycodeKP9,
-        pattern KeycodeKP0,
-        pattern KeycodeKPPeriod,
-        pattern KeycodeApplication,
-        pattern KeycodePower,
-        pattern KeycodeKPEquals,
-        pattern KeycodeF13,
-        pattern KeycodeF14,
-        pattern KeycodeF15,
-        pattern KeycodeF16,
-        pattern KeycodeF17,
-        pattern KeycodeF18,
-        pattern KeycodeF19,
-        pattern KeycodeF20,
-        pattern KeycodeF21,
-        pattern KeycodeF22,
-        pattern KeycodeF23,
-        pattern KeycodeF24,
-        pattern KeycodeExecute,
-        pattern KeycodeHelp,
-        pattern KeycodeMenu,
-        pattern KeycodeSelect,
-        pattern KeycodeStop,
-        pattern KeycodeAgain,
-        pattern KeycodeUndo,
-        pattern KeycodeCut,
-        pattern KeycodeCopy,
-        pattern KeycodePaste,
-        pattern KeycodeFind,
-        pattern KeycodeMute,
-        pattern KeycodeVolumeUp,
-        pattern KeycodeVolumeDown,
-        pattern KeycodeKPComma,
-        pattern KeycodeKPEqualsAS400,
-        pattern KeycodeAltErase,
-        pattern KeycodeSysReq,
-        pattern KeycodeCancel,
-        pattern KeycodeClear,
-        pattern KeycodePrior,
-        pattern KeycodeReturn2,
-        pattern KeycodeSeparator,
-        pattern KeycodeOut,
-        pattern KeycodeOper,
-        pattern KeycodeClearAgain,
-        pattern KeycodeCrSel,
-        pattern KeycodeExSel,
-        pattern KeycodeKP00,
-        pattern KeycodeKP000,
-        pattern KeycodeThousandsSeparator,
-        pattern KeycodeDecimalSeparator,
-        pattern KeycodeCurrencyUnit,
-        pattern KeycodeCurrencySubunit,
-        pattern KeycodeKPLeftParen,
-        pattern KeycodeKPRightParen,
-        pattern KeycodeKPLeftBrace,
-        pattern KeycodeKPRightBrace,
-        pattern KeycodeKPTab,
-        pattern KeycodeKPBackspace,
-        pattern KeycodeKPA,
-        pattern KeycodeKPB,
-        pattern KeycodeKPC,
-        pattern KeycodeKPD,
-        pattern KeycodeKPE,
-        pattern KeycodeKPF,
-        pattern KeycodeKPXor,
-        pattern KeycodeKPPower,
-        pattern KeycodeKPPercent,
-        pattern KeycodeKPLess,
-        pattern KeycodeKPGreater,
-        pattern KeycodeKPAmpersand,
-        pattern KeycodeKPDblAmpersand,
-        pattern KeycodeKPVerticalBar,
-        pattern KeycodeKPDblVerticalBar,
-        pattern KeycodeKPColon,
-        pattern KeycodeKPHash,
-        pattern KeycodeKPSpace,
-        pattern KeycodeKPAt,
-        pattern KeycodeKPExclam,
-        pattern KeycodeKPMemStore,
-        pattern KeycodeKPMemRecall,
-        pattern KeycodeKPMemClear,
-        pattern KeycodeKPMemAdd,
-        pattern KeycodeKPMemSubtract,
-        pattern KeycodeKPMemMultiply,
-        pattern KeycodeKPMemDivide,
-        pattern KeycodeKPPlusMinus,
-        pattern KeycodeKPClear,
-        pattern KeycodeKPClearEntry,
-        pattern KeycodeKPBinary,
-        pattern KeycodeKPOctal,
-        pattern KeycodeKPDecimal,
-        pattern KeycodeKPHexadecimal,
-        pattern KeycodeLCtrl,
-        pattern KeycodeLShift,
-        pattern KeycodeLAlt,
-        pattern KeycodeLGUI,
-        pattern KeycodeRCtrl,
-        pattern KeycodeRShift,
-        pattern KeycodeRAlt,
-        pattern KeycodeRGUI,
-        pattern KeycodeMode,
-        pattern KeycodeAudioNext,
-        pattern KeycodeAudioPrev,
-        pattern KeycodeAudioStop,
-        pattern KeycodeAudioPlay,
-        pattern KeycodeAudioMute,
-        pattern KeycodeMediaSelect,
-        pattern KeycodeWWW,
-        pattern KeycodeMail,
-        pattern KeycodeCalculator,
-        pattern KeycodeComputer,
-        pattern KeycodeACSearch,
-        pattern KeycodeACHome,
-        pattern KeycodeACBack,
-        pattern KeycodeACForward,
-        pattern KeycodeACStop,
-        pattern KeycodeACRefresh,
-        pattern KeycodeACBookmarks,
-        pattern KeycodeBrightnessDown,
-        pattern KeycodeBrightnessUp,
-        pattern KeycodeDisplaySwitch,
-        pattern KeycodeKbdIllumToggle,
-        pattern KeycodeKbdIllumDown,
-        pattern KeycodeKbdIllumUp,
-        pattern KeycodeEject,
-        pattern KeycodeSleep)
-
-       where
-
-import GHC.Generics (Generic)
-import Data.Data (Data)
-import Data.Int
-import Data.Typeable
-import Data.Word
-import SDL.Internal.Numbered
-import qualified SDL.Raw.Enum as Raw
-
-newtype Scancode = Scancode { unwrapScancode :: Word32 }
-  deriving (Bounded, Data, Eq, Ord, Read, Generic, Show, Typeable)
-
-pattern ScancodeUnknown = Scancode Raw.SDL_SCANCODE_UNKNOWN
-pattern ScancodeA = Scancode Raw.SDL_SCANCODE_A
-pattern ScancodeB = Scancode Raw.SDL_SCANCODE_B
-pattern ScancodeC = Scancode Raw.SDL_SCANCODE_C
-pattern ScancodeD = Scancode Raw.SDL_SCANCODE_D
-pattern ScancodeE = Scancode Raw.SDL_SCANCODE_E
-pattern ScancodeF = Scancode Raw.SDL_SCANCODE_F
-pattern ScancodeG = Scancode Raw.SDL_SCANCODE_G
-pattern ScancodeH = Scancode Raw.SDL_SCANCODE_H
-pattern ScancodeI = Scancode Raw.SDL_SCANCODE_I
-pattern ScancodeJ = Scancode Raw.SDL_SCANCODE_J
-pattern ScancodeK = Scancode Raw.SDL_SCANCODE_K
-pattern ScancodeL = Scancode Raw.SDL_SCANCODE_L
-pattern ScancodeM = Scancode Raw.SDL_SCANCODE_M
-pattern ScancodeN = Scancode Raw.SDL_SCANCODE_N
-pattern ScancodeO = Scancode Raw.SDL_SCANCODE_O
-pattern ScancodeP = Scancode Raw.SDL_SCANCODE_P
-pattern ScancodeQ = Scancode Raw.SDL_SCANCODE_Q
-pattern ScancodeR = Scancode Raw.SDL_SCANCODE_R
-pattern ScancodeS = Scancode Raw.SDL_SCANCODE_S
-pattern ScancodeT = Scancode Raw.SDL_SCANCODE_T
-pattern ScancodeU = Scancode Raw.SDL_SCANCODE_U
-pattern ScancodeV = Scancode Raw.SDL_SCANCODE_V
-pattern ScancodeW = Scancode Raw.SDL_SCANCODE_W
-pattern ScancodeX = Scancode Raw.SDL_SCANCODE_X
-pattern ScancodeY = Scancode Raw.SDL_SCANCODE_Y
-pattern ScancodeZ = Scancode Raw.SDL_SCANCODE_Z
-pattern Scancode1 = Scancode Raw.SDL_SCANCODE_1
-pattern Scancode2 = Scancode Raw.SDL_SCANCODE_2
-pattern Scancode3 = Scancode Raw.SDL_SCANCODE_3
-pattern Scancode4 = Scancode Raw.SDL_SCANCODE_4
-pattern Scancode5 = Scancode Raw.SDL_SCANCODE_5
-pattern Scancode6 = Scancode Raw.SDL_SCANCODE_6
-pattern Scancode7 = Scancode Raw.SDL_SCANCODE_7
-pattern Scancode8 = Scancode Raw.SDL_SCANCODE_8
-pattern Scancode9 = Scancode Raw.SDL_SCANCODE_9
-pattern Scancode0 = Scancode Raw.SDL_SCANCODE_0
-pattern ScancodeReturn = Scancode Raw.SDL_SCANCODE_RETURN
-pattern ScancodeEscape = Scancode Raw.SDL_SCANCODE_ESCAPE
-pattern ScancodeBackspace = Scancode Raw.SDL_SCANCODE_BACKSPACE
-pattern ScancodeTab = Scancode Raw.SDL_SCANCODE_TAB
-pattern ScancodeSpace = Scancode Raw.SDL_SCANCODE_SPACE
-pattern ScancodeMinus = Scancode Raw.SDL_SCANCODE_MINUS
-pattern ScancodeEquals = Scancode Raw.SDL_SCANCODE_EQUALS
-pattern ScancodeLeftBracket = Scancode Raw.SDL_SCANCODE_LEFTBRACKET
-pattern ScancodeRightBracket = Scancode Raw.SDL_SCANCODE_RIGHTBRACKET
-pattern ScancodeBackslash = Scancode Raw.SDL_SCANCODE_BACKSLASH
-pattern ScancodeNonUSHash = Scancode Raw.SDL_SCANCODE_NONUSHASH
-pattern ScancodeSemicolon = Scancode Raw.SDL_SCANCODE_SEMICOLON
-pattern ScancodeApostrophe = Scancode Raw.SDL_SCANCODE_APOSTROPHE
-pattern ScancodeGrave = Scancode Raw.SDL_SCANCODE_GRAVE
-pattern ScancodeComma = Scancode Raw.SDL_SCANCODE_COMMA
-pattern ScancodePeriod = Scancode Raw.SDL_SCANCODE_PERIOD
-pattern ScancodeSlash = Scancode Raw.SDL_SCANCODE_SLASH
-pattern ScancodeCapsLock = Scancode Raw.SDL_SCANCODE_CAPSLOCK
-pattern ScancodeF1 = Scancode Raw.SDL_SCANCODE_F1
-pattern ScancodeF2 = Scancode Raw.SDL_SCANCODE_F2
-pattern ScancodeF3 = Scancode Raw.SDL_SCANCODE_F3
-pattern ScancodeF4 = Scancode Raw.SDL_SCANCODE_F4
-pattern ScancodeF5 = Scancode Raw.SDL_SCANCODE_F5
-pattern ScancodeF6 = Scancode Raw.SDL_SCANCODE_F6
-pattern ScancodeF7 = Scancode Raw.SDL_SCANCODE_F7
-pattern ScancodeF8 = Scancode Raw.SDL_SCANCODE_F8
-pattern ScancodeF9 = Scancode Raw.SDL_SCANCODE_F9
-pattern ScancodeF10 = Scancode Raw.SDL_SCANCODE_F10
-pattern ScancodeF11 = Scancode Raw.SDL_SCANCODE_F11
-pattern ScancodeF12 = Scancode Raw.SDL_SCANCODE_F12
-pattern ScancodePrintScreen = Scancode Raw.SDL_SCANCODE_PRINTSCREEN
-pattern ScancodeScrollLock = Scancode Raw.SDL_SCANCODE_SCROLLLOCK
-pattern ScancodePause = Scancode Raw.SDL_SCANCODE_PAUSE
-pattern ScancodeInsert = Scancode Raw.SDL_SCANCODE_INSERT
-pattern ScancodeHome = Scancode Raw.SDL_SCANCODE_HOME
-pattern ScancodePageUp = Scancode Raw.SDL_SCANCODE_PAGEUP
-pattern ScancodeDelete = Scancode Raw.SDL_SCANCODE_DELETE
-pattern ScancodeEnd = Scancode Raw.SDL_SCANCODE_END
-pattern ScancodePageDown = Scancode Raw.SDL_SCANCODE_PAGEDOWN
-pattern ScancodeRight = Scancode Raw.SDL_SCANCODE_RIGHT
-pattern ScancodeLeft = Scancode Raw.SDL_SCANCODE_LEFT
-pattern ScancodeDown = Scancode Raw.SDL_SCANCODE_DOWN
-pattern ScancodeUp = Scancode Raw.SDL_SCANCODE_UP
-pattern ScancodeNumLockClear = Scancode Raw.SDL_SCANCODE_NUMLOCKCLEAR
-pattern ScancodeKPDivide = Scancode Raw.SDL_SCANCODE_KP_DIVIDE
-pattern ScancodeKPMultiply = Scancode Raw.SDL_SCANCODE_KP_MULTIPLY
-pattern ScancodeKPMinus = Scancode Raw.SDL_SCANCODE_KP_MINUS
-pattern ScancodeKPPlus = Scancode Raw.SDL_SCANCODE_KP_PLUS
-pattern ScancodeKPEnter = Scancode Raw.SDL_SCANCODE_KP_ENTER
-pattern ScancodeKP1 = Scancode Raw.SDL_SCANCODE_KP_1
-pattern ScancodeKP2 = Scancode Raw.SDL_SCANCODE_KP_2
-pattern ScancodeKP3 = Scancode Raw.SDL_SCANCODE_KP_3
-pattern ScancodeKP4 = Scancode Raw.SDL_SCANCODE_KP_4
-pattern ScancodeKP5 = Scancode Raw.SDL_SCANCODE_KP_5
-pattern ScancodeKP6 = Scancode Raw.SDL_SCANCODE_KP_6
-pattern ScancodeKP7 = Scancode Raw.SDL_SCANCODE_KP_7
-pattern ScancodeKP8 = Scancode Raw.SDL_SCANCODE_KP_8
-pattern ScancodeKP9 = Scancode Raw.SDL_SCANCODE_KP_9
-pattern ScancodeKP0 = Scancode Raw.SDL_SCANCODE_KP_0
-pattern ScancodeKPPeriod = Scancode Raw.SDL_SCANCODE_KP_PERIOD
-pattern ScancodeNonUSBackslash = Scancode Raw.SDL_SCANCODE_NONUSBACKSLASH
-pattern ScancodeApplication = Scancode Raw.SDL_SCANCODE_APPLICATION
-pattern ScancodePower = Scancode Raw.SDL_SCANCODE_POWER
-pattern ScancodeKPEquals = Scancode Raw.SDL_SCANCODE_KP_EQUALS
-pattern ScancodeF13 = Scancode Raw.SDL_SCANCODE_F13
-pattern ScancodeF14 = Scancode Raw.SDL_SCANCODE_F14
-pattern ScancodeF15 = Scancode Raw.SDL_SCANCODE_F15
-pattern ScancodeF16 = Scancode Raw.SDL_SCANCODE_F16
-pattern ScancodeF17 = Scancode Raw.SDL_SCANCODE_F17
-pattern ScancodeF18 = Scancode Raw.SDL_SCANCODE_F18
-pattern ScancodeF19 = Scancode Raw.SDL_SCANCODE_F19
-pattern ScancodeF20 = Scancode Raw.SDL_SCANCODE_F20
-pattern ScancodeF21 = Scancode Raw.SDL_SCANCODE_F21
-pattern ScancodeF22 = Scancode Raw.SDL_SCANCODE_F22
-pattern ScancodeF23 = Scancode Raw.SDL_SCANCODE_F23
-pattern ScancodeF24 = Scancode Raw.SDL_SCANCODE_F24
-pattern ScancodeExecute = Scancode Raw.SDL_SCANCODE_EXECUTE
-pattern ScancodeHelp = Scancode Raw.SDL_SCANCODE_HELP
-pattern ScancodeMenu = Scancode Raw.SDL_SCANCODE_MENU
-pattern ScancodeSelect = Scancode Raw.SDL_SCANCODE_SELECT
-pattern ScancodeStop = Scancode Raw.SDL_SCANCODE_STOP
-pattern ScancodeAgain = Scancode Raw.SDL_SCANCODE_AGAIN
-pattern ScancodeUndo = Scancode Raw.SDL_SCANCODE_UNDO
-pattern ScancodeCut = Scancode Raw.SDL_SCANCODE_CUT
-pattern ScancodeCopy = Scancode Raw.SDL_SCANCODE_COPY
-pattern ScancodePaste = Scancode Raw.SDL_SCANCODE_PASTE
-pattern ScancodeFind = Scancode Raw.SDL_SCANCODE_FIND
-pattern ScancodeMute = Scancode Raw.SDL_SCANCODE_MUTE
-pattern ScancodeVolumeUp = Scancode Raw.SDL_SCANCODE_VOLUMEUP
-pattern ScancodeVolumeDown = Scancode Raw.SDL_SCANCODE_VOLUMEDOWN
-pattern ScancodeKPComma = Scancode Raw.SDL_SCANCODE_KP_COMMA
-pattern ScancodeKPEqualsAS400 = Scancode Raw.SDL_SCANCODE_KP_EQUALSAS400
-pattern ScancodeInternational1 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL1
-pattern ScancodeInternational2 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL2
-pattern ScancodeInternational3 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL3
-pattern ScancodeInternational4 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL4
-pattern ScancodeInternational5 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL5
-pattern ScancodeInternational6 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL6
-pattern ScancodeInternational7 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL7
-pattern ScancodeInternational8 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL8
-pattern ScancodeInternational9 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL9
-pattern ScancodeLang1 = Scancode Raw.SDL_SCANCODE_LANG1
-pattern ScancodeLang2 = Scancode Raw.SDL_SCANCODE_LANG2
-pattern ScancodeLang3 = Scancode Raw.SDL_SCANCODE_LANG3
-pattern ScancodeLang4 = Scancode Raw.SDL_SCANCODE_LANG4
-pattern ScancodeLang5 = Scancode Raw.SDL_SCANCODE_LANG5
-pattern ScancodeLang6 = Scancode Raw.SDL_SCANCODE_LANG6
-pattern ScancodeLang7 = Scancode Raw.SDL_SCANCODE_LANG7
-pattern ScancodeLang8 = Scancode Raw.SDL_SCANCODE_LANG8
-pattern ScancodeLang9 = Scancode Raw.SDL_SCANCODE_LANG9
-pattern ScancodeAltErase = Scancode Raw.SDL_SCANCODE_ALTERASE
-pattern ScancodeSysReq = Scancode Raw.SDL_SCANCODE_SYSREQ
-pattern ScancodeCancel = Scancode Raw.SDL_SCANCODE_CANCEL
-pattern ScancodeClear = Scancode Raw.SDL_SCANCODE_CLEAR
-pattern ScancodePrior = Scancode Raw.SDL_SCANCODE_PRIOR
-pattern ScancodeReturn2 = Scancode Raw.SDL_SCANCODE_RETURN2
-pattern ScancodeSeparator = Scancode Raw.SDL_SCANCODE_SEPARATOR
-pattern ScancodeOut = Scancode Raw.SDL_SCANCODE_OUT
-pattern ScancodeOper = Scancode Raw.SDL_SCANCODE_OPER
-pattern ScancodeClearAgain = Scancode Raw.SDL_SCANCODE_CLEARAGAIN
-pattern ScancodeCrSel = Scancode Raw.SDL_SCANCODE_CRSEL
-pattern ScancodeExSel = Scancode Raw.SDL_SCANCODE_EXSEL
-pattern ScancodeKP00 = Scancode Raw.SDL_SCANCODE_KP_00
-pattern ScancodeKP000 = Scancode Raw.SDL_SCANCODE_KP_000
-pattern ScancodeThousandsSeparator = Scancode Raw.SDL_SCANCODE_THOUSANDSSEPARATOR
-pattern ScancodeDecimalSeparator = Scancode Raw.SDL_SCANCODE_DECIMALSEPARATOR
-pattern ScancodeCurrencyUnit = Scancode Raw.SDL_SCANCODE_CURRENCYUNIT
-pattern ScancodeCurrencySubunit = Scancode Raw.SDL_SCANCODE_CURRENCYSUBUNIT
-pattern ScancodeLeftParen = Scancode Raw.SDL_SCANCODE_KP_LEFTPAREN
-pattern ScancodeRightParen = Scancode Raw.SDL_SCANCODE_KP_RIGHTPAREN
-pattern ScancodeLeftBrace = Scancode Raw.SDL_SCANCODE_KP_LEFTBRACE
-pattern ScancodeRightBrace = Scancode Raw.SDL_SCANCODE_KP_RIGHTBRACE
-pattern ScancodeKPTab = Scancode Raw.SDL_SCANCODE_KP_TAB
-pattern ScancodeKPBackspace = Scancode Raw.SDL_SCANCODE_KP_BACKSPACE
-pattern ScancodeKPA = Scancode Raw.SDL_SCANCODE_KP_A
-pattern ScancodeKPB = Scancode Raw.SDL_SCANCODE_KP_B
-pattern ScancodeKPC = Scancode Raw.SDL_SCANCODE_KP_C
-pattern ScancodeKPD = Scancode Raw.SDL_SCANCODE_KP_D
-pattern ScancodeKPE = Scancode Raw.SDL_SCANCODE_KP_E
-pattern ScancodeKPF = Scancode Raw.SDL_SCANCODE_KP_F
-pattern ScancodeKPXOR = Scancode Raw.SDL_SCANCODE_KP_XOR
-pattern ScancodeKPPower = Scancode Raw.SDL_SCANCODE_KP_POWER
-pattern ScancodeKPPercent = Scancode Raw.SDL_SCANCODE_KP_PERCENT
-pattern ScancodeKPLess = Scancode Raw.SDL_SCANCODE_KP_LESS
-pattern ScancodeKPGreater = Scancode Raw.SDL_SCANCODE_KP_GREATER
-pattern ScancodeKPAmpersand = Scancode Raw.SDL_SCANCODE_KP_AMPERSAND
-pattern ScancodeKPDblAmpersand = Scancode Raw.SDL_SCANCODE_KP_DBLAMPERSAND
-pattern ScancodeKPVerticalBar = Scancode Raw.SDL_SCANCODE_KP_VERTICALBAR
-pattern ScancodeKPDblVerticalBar = Scancode Raw.SDL_SCANCODE_KP_DBLVERTICALBAR
-pattern ScancodeKPColon = Scancode Raw.SDL_SCANCODE_KP_COLON
-pattern ScancodeKPHash = Scancode Raw.SDL_SCANCODE_KP_HASH
-pattern ScancodeKPSpace = Scancode Raw.SDL_SCANCODE_KP_SPACE
-pattern ScancodeKPAt = Scancode Raw.SDL_SCANCODE_KP_AT
-pattern ScancodeKPExclam = Scancode Raw.SDL_SCANCODE_KP_EXCLAM
-pattern ScancodeKPMemStore = Scancode Raw.SDL_SCANCODE_KP_MEMSTORE
-pattern ScancodeKPMemRecall = Scancode Raw.SDL_SCANCODE_KP_MEMRECALL
-pattern ScancodeKPMemClear = Scancode Raw.SDL_SCANCODE_KP_MEMCLEAR
-pattern ScancodeKPMemAdd = Scancode Raw.SDL_SCANCODE_KP_MEMADD
-pattern ScancodeKPMemSubtract = Scancode Raw.SDL_SCANCODE_KP_MEMSUBTRACT
-pattern ScancodeKPMemMultiply = Scancode Raw.SDL_SCANCODE_KP_MEMMULTIPLY
-pattern ScancodeKPMemDivide = Scancode Raw.SDL_SCANCODE_KP_MEMDIVIDE
-pattern ScancodeKPPlusMinus = Scancode Raw.SDL_SCANCODE_KP_PLUSMINUS
-pattern ScancodeKPClear = Scancode Raw.SDL_SCANCODE_KP_CLEAR
-pattern ScancodeKPClearEntry = Scancode Raw.SDL_SCANCODE_KP_CLEARENTRY
-pattern ScancodeKPBinary = Scancode Raw.SDL_SCANCODE_KP_BINARY
-pattern ScancodeKPOctal = Scancode Raw.SDL_SCANCODE_KP_OCTAL
-pattern ScancodeKPDecimal = Scancode Raw.SDL_SCANCODE_KP_DECIMAL
-pattern ScancodeKPHexadecimal = Scancode Raw.SDL_SCANCODE_KP_HEXADECIMAL
-pattern ScancodeLCtrl = Scancode Raw.SDL_SCANCODE_LCTRL
-pattern ScancodeLShift = Scancode Raw.SDL_SCANCODE_LSHIFT
-pattern ScancodeLAlt = Scancode Raw.SDL_SCANCODE_LALT
-pattern ScancodeLGUI = Scancode Raw.SDL_SCANCODE_LGUI
-pattern ScancodeRCtrl = Scancode Raw.SDL_SCANCODE_RCTRL
-pattern ScancodeRShift = Scancode Raw.SDL_SCANCODE_RSHIFT
-pattern ScancodeRAlt = Scancode Raw.SDL_SCANCODE_RALT
-pattern ScancodeRGUI = Scancode Raw.SDL_SCANCODE_RGUI
-pattern ScancodeMode = Scancode Raw.SDL_SCANCODE_MODE
-pattern ScancodeAudioNext = Scancode Raw.SDL_SCANCODE_AUDIONEXT
-pattern ScancodeAudioPrev = Scancode Raw.SDL_SCANCODE_AUDIOPREV
-pattern ScancodeAudioStop = Scancode Raw.SDL_SCANCODE_AUDIOSTOP
-pattern ScancodeAudioPlay = Scancode Raw.SDL_SCANCODE_AUDIOPLAY
-pattern ScancodeAudioMute = Scancode Raw.SDL_SCANCODE_AUDIOMUTE
-pattern ScancodeMediaSelect = Scancode Raw.SDL_SCANCODE_MEDIASELECT
-pattern ScancodeWWW = Scancode Raw.SDL_SCANCODE_WWW
-pattern ScancodeMail = Scancode Raw.SDL_SCANCODE_MAIL
-pattern ScancodeCalculator = Scancode Raw.SDL_SCANCODE_CALCULATOR
-pattern ScancodeComputer = Scancode Raw.SDL_SCANCODE_COMPUTER
-pattern ScancodeACSearch = Scancode Raw.SDL_SCANCODE_AC_SEARCH
-pattern ScancodeACHome = Scancode Raw.SDL_SCANCODE_AC_HOME
-pattern ScancodeACBack = Scancode Raw.SDL_SCANCODE_AC_BACK
-pattern ScancodeACForward = Scancode Raw.SDL_SCANCODE_AC_FORWARD
-pattern ScancodeACStop = Scancode Raw.SDL_SCANCODE_AC_STOP
-pattern ScancodeACRefresh = Scancode Raw.SDL_SCANCODE_AC_REFRESH
-pattern ScancodeACBookmarks = Scancode Raw.SDL_SCANCODE_AC_BOOKMARKS
-pattern ScancodeBrightnessDown = Scancode Raw.SDL_SCANCODE_BRIGHTNESSDOWN
-pattern ScancodeBrightnessUp = Scancode Raw.SDL_SCANCODE_BRIGHTNESSUP
-pattern ScancodeDisplaySwitch = Scancode Raw.SDL_SCANCODE_DISPLAYSWITCH
-pattern ScancodeKBDIllumToggle = Scancode Raw.SDL_SCANCODE_KBDILLUMTOGGLE
-pattern ScancodeKBDIllumDown = Scancode Raw.SDL_SCANCODE_KBDILLUMDOWN
-pattern ScancodeKBDIllumUp = Scancode Raw.SDL_SCANCODE_KBDILLUMUP
-pattern ScancodeEject = Scancode Raw.SDL_SCANCODE_EJECT
-pattern ScancodeSleep = Scancode Raw.SDL_SCANCODE_SLEEP
-pattern ScancodeApp1 = Scancode Raw.SDL_SCANCODE_APP1
-pattern ScancodeApp2 = Scancode Raw.SDL_SCANCODE_APP2
-
-instance FromNumber Scancode Word32 where
-  fromNumber = Scancode
-
-instance ToNumber Scancode Word32 where
-  toNumber = unwrapScancode
-
-newtype Keycode = Keycode { unwrapKeycode :: Int32 }
-  deriving (Bounded, Data, Eq, Ord, Read, Generic, Show, Typeable)
-
-pattern KeycodeUnknown = Keycode Raw.SDLK_UNKNOWN
-pattern KeycodeReturn = Keycode Raw.SDLK_RETURN
-pattern KeycodeEscape = Keycode Raw.SDLK_ESCAPE
-pattern KeycodeBackspace = Keycode Raw.SDLK_BACKSPACE
-pattern KeycodeTab = Keycode Raw.SDLK_TAB
-pattern KeycodeSpace = Keycode Raw.SDLK_SPACE
-pattern KeycodeExclaim = Keycode Raw.SDLK_EXCLAIM
-pattern KeycodeQuoteDbl = Keycode Raw.SDLK_QUOTEDBL
-pattern KeycodeHash = Keycode Raw.SDLK_HASH
-pattern KeycodePercent = Keycode Raw.SDLK_PERCENT
-pattern KeycodeDollar = Keycode Raw.SDLK_DOLLAR
-pattern KeycodeAmpersand = Keycode Raw.SDLK_AMPERSAND
-pattern KeycodeQuote = Keycode Raw.SDLK_QUOTE
-pattern KeycodeLeftParen = Keycode Raw.SDLK_LEFTPAREN
-pattern KeycodeRightParen = Keycode Raw.SDLK_RIGHTPAREN
-pattern KeycodeAsterisk = Keycode Raw.SDLK_ASTERISK
-pattern KeycodePlus = Keycode Raw.SDLK_PLUS
-pattern KeycodeComma = Keycode Raw.SDLK_COMMA
-pattern KeycodeMinus = Keycode Raw.SDLK_MINUS
-pattern KeycodePeriod = Keycode Raw.SDLK_PERIOD
-pattern KeycodeSlash = Keycode Raw.SDLK_SLASH
-pattern Keycode0 = Keycode Raw.SDLK_0
-pattern Keycode1 = Keycode Raw.SDLK_1
-pattern Keycode2 = Keycode Raw.SDLK_2
-pattern Keycode3 = Keycode Raw.SDLK_3
-pattern Keycode4 = Keycode Raw.SDLK_4
-pattern Keycode5 = Keycode Raw.SDLK_5
-pattern Keycode6 = Keycode Raw.SDLK_6
-pattern Keycode7 = Keycode Raw.SDLK_7
-pattern Keycode8 = Keycode Raw.SDLK_8
-pattern Keycode9 = Keycode Raw.SDLK_9
-pattern KeycodeColon = Keycode Raw.SDLK_COLON
-pattern KeycodeSemicolon = Keycode Raw.SDLK_SEMICOLON
-pattern KeycodeLess = Keycode Raw.SDLK_LESS
-pattern KeycodeEquals = Keycode Raw.SDLK_EQUALS
-pattern KeycodeGreater = Keycode Raw.SDLK_GREATER
-pattern KeycodeQuestion = Keycode Raw.SDLK_QUESTION
-pattern KeycodeAt = Keycode Raw.SDLK_AT
-pattern KeycodeLeftBracket = Keycode Raw.SDLK_LEFTBRACKET
-pattern KeycodeBackslash = Keycode Raw.SDLK_BACKSLASH
-pattern KeycodeRightBracket = Keycode Raw.SDLK_RIGHTBRACKET
-pattern KeycodeCaret = Keycode Raw.SDLK_CARET
-pattern KeycodeUnderscore = Keycode Raw.SDLK_UNDERSCORE
-pattern KeycodeBackquote = Keycode Raw.SDLK_BACKQUOTE
-pattern KeycodeA = Keycode Raw.SDLK_a
-pattern KeycodeB = Keycode Raw.SDLK_b
-pattern KeycodeC = Keycode Raw.SDLK_c
-pattern KeycodeD = Keycode Raw.SDLK_d
-pattern KeycodeE = Keycode Raw.SDLK_e
-pattern KeycodeF = Keycode Raw.SDLK_f
-pattern KeycodeG = Keycode Raw.SDLK_g
-pattern KeycodeH = Keycode Raw.SDLK_h
-pattern KeycodeI = Keycode Raw.SDLK_i
-pattern KeycodeJ = Keycode Raw.SDLK_j
-pattern KeycodeK = Keycode Raw.SDLK_k
-pattern KeycodeL = Keycode Raw.SDLK_l
-pattern KeycodeM = Keycode Raw.SDLK_m
-pattern KeycodeN = Keycode Raw.SDLK_n
-pattern KeycodeO = Keycode Raw.SDLK_o
-pattern KeycodeP = Keycode Raw.SDLK_p
-pattern KeycodeQ = Keycode Raw.SDLK_q
-pattern KeycodeR = Keycode Raw.SDLK_r
-pattern KeycodeS = Keycode Raw.SDLK_s
-pattern KeycodeT = Keycode Raw.SDLK_t
-pattern KeycodeU = Keycode Raw.SDLK_u
-pattern KeycodeV = Keycode Raw.SDLK_v
-pattern KeycodeW = Keycode Raw.SDLK_w
-pattern KeycodeX = Keycode Raw.SDLK_x
-pattern KeycodeY = Keycode Raw.SDLK_y
-pattern KeycodeZ = Keycode Raw.SDLK_z
-pattern KeycodeCapsLock = Keycode Raw.SDLK_CAPSLOCK
-pattern KeycodeF1 = Keycode Raw.SDLK_F1
-pattern KeycodeF2 = Keycode Raw.SDLK_F2
-pattern KeycodeF3 = Keycode Raw.SDLK_F3
-pattern KeycodeF4 = Keycode Raw.SDLK_F4
-pattern KeycodeF5 = Keycode Raw.SDLK_F5
-pattern KeycodeF6 = Keycode Raw.SDLK_F6
-pattern KeycodeF7 = Keycode Raw.SDLK_F7
-pattern KeycodeF8 = Keycode Raw.SDLK_F8
-pattern KeycodeF9 = Keycode Raw.SDLK_F9
-pattern KeycodeF10 = Keycode Raw.SDLK_F10
-pattern KeycodeF11 = Keycode Raw.SDLK_F11
-pattern KeycodeF12 = Keycode Raw.SDLK_F12
-pattern KeycodePrintScreen = Keycode Raw.SDLK_PRINTSCREEN
-pattern KeycodeScrollLock = Keycode Raw.SDLK_SCROLLLOCK
-pattern KeycodePause = Keycode Raw.SDLK_PAUSE
-pattern KeycodeInsert = Keycode Raw.SDLK_INSERT
-pattern KeycodeHome = Keycode Raw.SDLK_HOME
-pattern KeycodePageUp = Keycode Raw.SDLK_PAGEUP
-pattern KeycodeDelete = Keycode Raw.SDLK_DELETE
-pattern KeycodeEnd = Keycode Raw.SDLK_END
-pattern KeycodePageDown = Keycode Raw.SDLK_PAGEDOWN
-pattern KeycodeRight = Keycode Raw.SDLK_RIGHT
-pattern KeycodeLeft = Keycode Raw.SDLK_LEFT
-pattern KeycodeDown = Keycode Raw.SDLK_DOWN
-pattern KeycodeUp = Keycode Raw.SDLK_UP
-pattern KeycodeNumLockClear = Keycode Raw.SDLK_NUMLOCKCLEAR
-pattern KeycodeKPDivide = Keycode Raw.SDLK_KP_DIVIDE
-pattern KeycodeKPMultiply = Keycode Raw.SDLK_KP_MULTIPLY
-pattern KeycodeKPMinus = Keycode Raw.SDLK_KP_MINUS
-pattern KeycodeKPPlus = Keycode Raw.SDLK_KP_PLUS
-pattern KeycodeKPEnter = Keycode Raw.SDLK_KP_ENTER
-pattern KeycodeKP1 = Keycode Raw.SDLK_KP_1
-pattern KeycodeKP2 = Keycode Raw.SDLK_KP_2
-pattern KeycodeKP3 = Keycode Raw.SDLK_KP_3
-pattern KeycodeKP4 = Keycode Raw.SDLK_KP_4
-pattern KeycodeKP5 = Keycode Raw.SDLK_KP_5
-pattern KeycodeKP6 = Keycode Raw.SDLK_KP_6
-pattern KeycodeKP7 = Keycode Raw.SDLK_KP_7
-pattern KeycodeKP8 = Keycode Raw.SDLK_KP_8
-pattern KeycodeKP9 = Keycode Raw.SDLK_KP_9
-pattern KeycodeKP0 = Keycode Raw.SDLK_KP_0
-pattern KeycodeKPPeriod = Keycode Raw.SDLK_KP_PERIOD
-pattern KeycodeApplication = Keycode Raw.SDLK_APPLICATION
-pattern KeycodePower = Keycode Raw.SDLK_POWER
-pattern KeycodeKPEquals = Keycode Raw.SDLK_KP_EQUALS
-pattern KeycodeF13 = Keycode Raw.SDLK_F13
-pattern KeycodeF14 = Keycode Raw.SDLK_F14
-pattern KeycodeF15 = Keycode Raw.SDLK_F15
-pattern KeycodeF16 = Keycode Raw.SDLK_F16
-pattern KeycodeF17 = Keycode Raw.SDLK_F17
-pattern KeycodeF18 = Keycode Raw.SDLK_F18
-pattern KeycodeF19 = Keycode Raw.SDLK_F19
-pattern KeycodeF20 = Keycode Raw.SDLK_F20
-pattern KeycodeF21 = Keycode Raw.SDLK_F21
-pattern KeycodeF22 = Keycode Raw.SDLK_F22
-pattern KeycodeF23 = Keycode Raw.SDLK_F23
-pattern KeycodeF24 = Keycode Raw.SDLK_F24
-pattern KeycodeExecute = Keycode Raw.SDLK_EXECUTE
-pattern KeycodeHelp = Keycode Raw.SDLK_HELP
-pattern KeycodeMenu = Keycode Raw.SDLK_MENU
-pattern KeycodeSelect = Keycode Raw.SDLK_SELECT
-pattern KeycodeStop = Keycode Raw.SDLK_STOP
-pattern KeycodeAgain = Keycode Raw.SDLK_AGAIN
-pattern KeycodeUndo = Keycode Raw.SDLK_UNDO
-pattern KeycodeCut = Keycode Raw.SDLK_CUT
-pattern KeycodeCopy = Keycode Raw.SDLK_COPY
-pattern KeycodePaste = Keycode Raw.SDLK_PASTE
-pattern KeycodeFind = Keycode Raw.SDLK_FIND
-pattern KeycodeMute = Keycode Raw.SDLK_MUTE
-pattern KeycodeVolumeUp = Keycode Raw.SDLK_VOLUMEUP
-pattern KeycodeVolumeDown = Keycode Raw.SDLK_VOLUMEDOWN
-pattern KeycodeKPComma = Keycode Raw.SDLK_KP_COMMA
-pattern KeycodeKPEqualsAS400 = Keycode Raw.SDLK_KP_EQUALSAS400
-pattern KeycodeAltErase = Keycode Raw.SDLK_ALTERASE
-pattern KeycodeSysReq = Keycode Raw.SDLK_SYSREQ
-pattern KeycodeCancel = Keycode Raw.SDLK_CANCEL
-pattern KeycodeClear = Keycode Raw.SDLK_CLEAR
-pattern KeycodePrior = Keycode Raw.SDLK_PRIOR
-pattern KeycodeReturn2 = Keycode Raw.SDLK_RETURN2
-pattern KeycodeSeparator = Keycode Raw.SDLK_SEPARATOR
-pattern KeycodeOut = Keycode Raw.SDLK_OUT
-pattern KeycodeOper = Keycode Raw.SDLK_OPER
-pattern KeycodeClearAgain = Keycode Raw.SDLK_CLEARAGAIN
-pattern KeycodeCrSel = Keycode Raw.SDLK_CRSEL
-pattern KeycodeExSel = Keycode Raw.SDLK_EXSEL
-pattern KeycodeKP00 = Keycode Raw.SDLK_KP_00
-pattern KeycodeKP000 = Keycode Raw.SDLK_KP_000
-pattern KeycodeThousandsSeparator = Keycode Raw.SDLK_THOUSANDSSEPARATOR
-pattern KeycodeDecimalSeparator = Keycode Raw.SDLK_DECIMALSEPARATOR
-pattern KeycodeCurrencyUnit = Keycode Raw.SDLK_CURRENCYUNIT
-pattern KeycodeCurrencySubunit = Keycode Raw.SDLK_CURRENCYSUBUNIT
-pattern KeycodeKPLeftParen = Keycode Raw.SDLK_KP_LEFTPAREN
-pattern KeycodeKPRightParen = Keycode Raw.SDLK_KP_RIGHTPAREN
-pattern KeycodeKPLeftBrace = Keycode Raw.SDLK_KP_LEFTBRACE
-pattern KeycodeKPRightBrace = Keycode Raw.SDLK_KP_RIGHTBRACE
-pattern KeycodeKPTab = Keycode Raw.SDLK_KP_TAB
-pattern KeycodeKPBackspace = Keycode Raw.SDLK_KP_BACKSPACE
-pattern KeycodeKPA = Keycode Raw.SDLK_KP_A
-pattern KeycodeKPB = Keycode Raw.SDLK_KP_B
-pattern KeycodeKPC = Keycode Raw.SDLK_KP_C
-pattern KeycodeKPD = Keycode Raw.SDLK_KP_D
-pattern KeycodeKPE = Keycode Raw.SDLK_KP_E
-pattern KeycodeKPF = Keycode Raw.SDLK_KP_F
-pattern KeycodeKPXor = Keycode Raw.SDLK_KP_XOR
-pattern KeycodeKPPower = Keycode Raw.SDLK_KP_POWER
-pattern KeycodeKPPercent = Keycode Raw.SDLK_KP_PERCENT
-pattern KeycodeKPLess = Keycode Raw.SDLK_KP_LESS
-pattern KeycodeKPGreater = Keycode Raw.SDLK_KP_GREATER
-pattern KeycodeKPAmpersand = Keycode Raw.SDLK_KP_AMPERSAND
-pattern KeycodeKPDblAmpersand = Keycode Raw.SDLK_KP_DBLAMPERSAND
-pattern KeycodeKPVerticalBar = Keycode Raw.SDLK_KP_VERTICALBAR
-pattern KeycodeKPDblVerticalBar = Keycode Raw.SDLK_KP_DBLVERTICALBAR
-pattern KeycodeKPColon = Keycode Raw.SDLK_KP_COLON
-pattern KeycodeKPHash = Keycode Raw.SDLK_KP_HASH
-pattern KeycodeKPSpace = Keycode Raw.SDLK_KP_SPACE
-pattern KeycodeKPAt = Keycode Raw.SDLK_KP_AT
-pattern KeycodeKPExclam = Keycode Raw.SDLK_KP_EXCLAM
-pattern KeycodeKPMemStore = Keycode Raw.SDLK_KP_MEMSTORE
-pattern KeycodeKPMemRecall = Keycode Raw.SDLK_KP_MEMRECALL
-pattern KeycodeKPMemClear = Keycode Raw.SDLK_KP_MEMCLEAR
-pattern KeycodeKPMemAdd = Keycode Raw.SDLK_KP_MEMADD
-pattern KeycodeKPMemSubtract = Keycode Raw.SDLK_KP_MEMSUBTRACT
-pattern KeycodeKPMemMultiply = Keycode Raw.SDLK_KP_MEMMULTIPLY
-pattern KeycodeKPMemDivide = Keycode Raw.SDLK_KP_MEMDIVIDE
-pattern KeycodeKPPlusMinus = Keycode Raw.SDLK_KP_PLUSMINUS
-pattern KeycodeKPClear = Keycode Raw.SDLK_KP_CLEAR
-pattern KeycodeKPClearEntry = Keycode Raw.SDLK_KP_CLEARENTRY
-pattern KeycodeKPBinary = Keycode Raw.SDLK_KP_BINARY
-pattern KeycodeKPOctal = Keycode Raw.SDLK_KP_OCTAL
-pattern KeycodeKPDecimal = Keycode Raw.SDLK_KP_DECIMAL
-pattern KeycodeKPHexadecimal = Keycode Raw.SDLK_KP_HEXADECIMAL
-pattern KeycodeLCtrl = Keycode Raw.SDLK_LCTRL
-pattern KeycodeLShift = Keycode Raw.SDLK_LSHIFT
-pattern KeycodeLAlt = Keycode Raw.SDLK_LALT
-pattern KeycodeLGUI = Keycode Raw.SDLK_LGUI
-pattern KeycodeRCtrl = Keycode Raw.SDLK_RCTRL
-pattern KeycodeRShift = Keycode Raw.SDLK_RSHIFT
-pattern KeycodeRAlt = Keycode Raw.SDLK_RALT
-pattern KeycodeRGUI = Keycode Raw.SDLK_RGUI
-pattern KeycodeMode = Keycode Raw.SDLK_MODE
-pattern KeycodeAudioNext = Keycode Raw.SDLK_AUDIONEXT
-pattern KeycodeAudioPrev = Keycode Raw.SDLK_AUDIOPREV
-pattern KeycodeAudioStop = Keycode Raw.SDLK_AUDIOSTOP
-pattern KeycodeAudioPlay = Keycode Raw.SDLK_AUDIOPLAY
-pattern KeycodeAudioMute = Keycode Raw.SDLK_AUDIOMUTE
-pattern KeycodeMediaSelect = Keycode Raw.SDLK_MEDIASELECT
-pattern KeycodeWWW = Keycode Raw.SDLK_WWW
-pattern KeycodeMail = Keycode Raw.SDLK_MAIL
-pattern KeycodeCalculator = Keycode Raw.SDLK_CALCULATOR
-pattern KeycodeComputer = Keycode Raw.SDLK_COMPUTER
-pattern KeycodeACSearch = Keycode Raw.SDLK_AC_SEARCH
-pattern KeycodeACHome = Keycode Raw.SDLK_AC_HOME
-pattern KeycodeACBack = Keycode Raw.SDLK_AC_BACK
-pattern KeycodeACForward = Keycode Raw.SDLK_AC_FORWARD
-pattern KeycodeACStop = Keycode Raw.SDLK_AC_STOP
-pattern KeycodeACRefresh = Keycode Raw.SDLK_AC_REFRESH
-pattern KeycodeACBookmarks = Keycode Raw.SDLK_AC_BOOKMARKS
-pattern KeycodeBrightnessDown = Keycode Raw.SDLK_BRIGHTNESSDOWN
-pattern KeycodeBrightnessUp = Keycode Raw.SDLK_BRIGHTNESSUP
-pattern KeycodeDisplaySwitch = Keycode Raw.SDLK_DISPLAYSWITCH
-pattern KeycodeKbdIllumToggle = Keycode Raw.SDLK_KBDILLUMTOGGLE
-pattern KeycodeKbdIllumDown = Keycode Raw.SDLK_KBDILLUMDOWN
-pattern KeycodeKbdIllumUp = Keycode Raw.SDLK_KBDILLUMUP
-pattern KeycodeEject = Keycode Raw.SDLK_EJECT
-pattern KeycodeSleep = Keycode Raw.SDLK_SLEEP
-
-instance FromNumber Keycode Int32 where
-  fromNumber = Keycode
-
-instance ToNumber Keycode Int32 where
-  toNumber = unwrapKeycode
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE PatternSynonyms #-}++{-|++An enumeration of scancodes and keycodes, allowing you to pattern match on keyboard keys.++This module uses a relatively new GHC feature called @PatternSynonyms@ in order to provide pattern+matches over the underlying 'Scancode' or 'Keycode'. We do this so that you are also able to+work with vendor-specific or otherwise unknown codes.++-}++module SDL.Input.Keyboard.Codes+       (-- * Scancodes+        -- | Scancodes are codes that correspond to the physical position of a key, independent of the current keyboard layout.+        -- Scancodes are meant to be layout-independent. Think of this as \"the user pressed the Q key as it would be on a US QWERTY keyboard\" regardless of whether this is actually a European keyboard or a Dvorak keyboard or whatever. The scancode is always the same key position.+        -- 'Scancode' makes sense when you want key presses based on their location on a keyboard - for example, the traditional \"WASD\" layout used in first-person shooters.+        Scancode(..),+        pattern ScancodeUnknown,+        pattern ScancodeA,+        pattern ScancodeB,+        pattern ScancodeC,+        pattern ScancodeD,+        pattern ScancodeE,+        pattern ScancodeF,+        pattern ScancodeG,+        pattern ScancodeH,+        pattern ScancodeI,+        pattern ScancodeJ,+        pattern ScancodeK,+        pattern ScancodeL,+        pattern ScancodeM,+        pattern ScancodeN,+        pattern ScancodeO,+        pattern ScancodeP,+        pattern ScancodeQ,+        pattern ScancodeR,+        pattern ScancodeS,+        pattern ScancodeT,+        pattern ScancodeU,+        pattern ScancodeV,+        pattern ScancodeW,+        pattern ScancodeX,+        pattern ScancodeY,+        pattern ScancodeZ,+        pattern Scancode1,+        pattern Scancode2,+        pattern Scancode3,+        pattern Scancode4,+        pattern Scancode5,+        pattern Scancode6,+        pattern Scancode7,+        pattern Scancode8,+        pattern Scancode9,+        pattern Scancode0,+        pattern ScancodeReturn,+        pattern ScancodeEscape,+        pattern ScancodeBackspace,+        pattern ScancodeTab,+        pattern ScancodeSpace,+        pattern ScancodeMinus,+        pattern ScancodeEquals,+        pattern ScancodeLeftBracket,+        pattern ScancodeRightBracket,+        pattern ScancodeBackslash,+        pattern ScancodeNonUSHash,+        pattern ScancodeSemicolon,+        pattern ScancodeApostrophe,+        pattern ScancodeGrave,+        pattern ScancodeComma,+        pattern ScancodePeriod,+        pattern ScancodeSlash,+        pattern ScancodeCapsLock,+        pattern ScancodeF1,+        pattern ScancodeF2,+        pattern ScancodeF3,+        pattern ScancodeF4,+        pattern ScancodeF5,+        pattern ScancodeF6,+        pattern ScancodeF7,+        pattern ScancodeF8,+        pattern ScancodeF9,+        pattern ScancodeF10,+        pattern ScancodeF11,+        pattern ScancodeF12,+        pattern ScancodePrintScreen,+        pattern ScancodeScrollLock,+        pattern ScancodePause,+        pattern ScancodeInsert,+        pattern ScancodeHome,+        pattern ScancodePageUp,+        pattern ScancodeDelete,+        pattern ScancodeEnd,+        pattern ScancodePageDown,+        pattern ScancodeRight,+        pattern ScancodeLeft,+        pattern ScancodeDown,+        pattern ScancodeUp,+        pattern ScancodeNumLockClear,+        pattern ScancodeKPDivide,+        pattern ScancodeKPMultiply,+        pattern ScancodeKPMinus,+        pattern ScancodeKPPlus,+        pattern ScancodeKPEnter,+        pattern ScancodeKP1,+        pattern ScancodeKP2,+        pattern ScancodeKP3,+        pattern ScancodeKP4,+        pattern ScancodeKP5,+        pattern ScancodeKP6,+        pattern ScancodeKP7,+        pattern ScancodeKP8,+        pattern ScancodeKP9,+        pattern ScancodeKP0,+        pattern ScancodeKPPeriod,+        pattern ScancodeNonUSBackslash,+        pattern ScancodeApplication,+        pattern ScancodePower,+        pattern ScancodeKPEquals,+        pattern ScancodeF13,+        pattern ScancodeF14,+        pattern ScancodeF15,+        pattern ScancodeF16,+        pattern ScancodeF17,+        pattern ScancodeF18,+        pattern ScancodeF19,+        pattern ScancodeF20,+        pattern ScancodeF21,+        pattern ScancodeF22,+        pattern ScancodeF23,+        pattern ScancodeF24,+        pattern ScancodeExecute,+        pattern ScancodeHelp,+        pattern ScancodeMenu,+        pattern ScancodeSelect,+        pattern ScancodeStop,+        pattern ScancodeAgain,+        pattern ScancodeUndo,+        pattern ScancodeCut,+        pattern ScancodeCopy,+        pattern ScancodePaste,+        pattern ScancodeFind,+        pattern ScancodeMute,+        pattern ScancodeVolumeUp,+        pattern ScancodeVolumeDown,+        pattern ScancodeKPComma,+        pattern ScancodeKPEqualsAS400,+        pattern ScancodeInternational1,+        pattern ScancodeInternational2,+        pattern ScancodeInternational3,+        pattern ScancodeInternational4,+        pattern ScancodeInternational5,+        pattern ScancodeInternational6,+        pattern ScancodeInternational7,+        pattern ScancodeInternational8,+        pattern ScancodeInternational9,+        pattern ScancodeLang1,+        pattern ScancodeLang2,+        pattern ScancodeLang3,+        pattern ScancodeLang4,+        pattern ScancodeLang5,+        pattern ScancodeLang6,+        pattern ScancodeLang7,+        pattern ScancodeLang8,+        pattern ScancodeLang9,+        pattern ScancodeAltErase,+        pattern ScancodeSysReq,+        pattern ScancodeCancel,+        pattern ScancodeClear,+        pattern ScancodePrior,+        pattern ScancodeReturn2,+        pattern ScancodeSeparator,+        pattern ScancodeOut,+        pattern ScancodeOper,+        pattern ScancodeClearAgain,+        pattern ScancodeCrSel,+        pattern ScancodeExSel,+        pattern ScancodeKP00,+        pattern ScancodeKP000,+        pattern ScancodeThousandsSeparator,+        pattern ScancodeDecimalSeparator,+        pattern ScancodeCurrencyUnit,+        pattern ScancodeCurrencySubunit,+        pattern ScancodeLeftParen,+        pattern ScancodeRightParen,+        pattern ScancodeLeftBrace,+        pattern ScancodeRightBrace,+        pattern ScancodeKPTab,+        pattern ScancodeKPBackspace,+        pattern ScancodeKPA,+        pattern ScancodeKPB,+        pattern ScancodeKPC,+        pattern ScancodeKPD,+        pattern ScancodeKPE,+        pattern ScancodeKPF,+        pattern ScancodeKPXOR,+        pattern ScancodeKPPower,+        pattern ScancodeKPPercent,+        pattern ScancodeKPLess,+        pattern ScancodeKPGreater,+        pattern ScancodeKPAmpersand,+        pattern ScancodeKPDblAmpersand,+        pattern ScancodeKPVerticalBar,+        pattern ScancodeKPDblVerticalBar,+        pattern ScancodeKPColon,+        pattern ScancodeKPHash,+        pattern ScancodeKPSpace,+        pattern ScancodeKPAt,+        pattern ScancodeKPExclam,+        pattern ScancodeKPMemStore,+        pattern ScancodeKPMemRecall,+        pattern ScancodeKPMemClear,+        pattern ScancodeKPMemAdd,+        pattern ScancodeKPMemSubtract,+        pattern ScancodeKPMemMultiply,+        pattern ScancodeKPMemDivide,+        pattern ScancodeKPPlusMinus,+        pattern ScancodeKPClear,+        pattern ScancodeKPClearEntry,+        pattern ScancodeKPBinary,+        pattern ScancodeKPOctal,+        pattern ScancodeKPDecimal,+        pattern ScancodeKPHexadecimal,+        pattern ScancodeLCtrl,+        pattern ScancodeLShift,+        pattern ScancodeLAlt,+        pattern ScancodeLGUI,+        pattern ScancodeRCtrl,+        pattern ScancodeRShift,+        pattern ScancodeRAlt,+        pattern ScancodeRGUI,+        pattern ScancodeMode,+        pattern ScancodeAudioNext,+        pattern ScancodeAudioPrev,+        pattern ScancodeAudioStop,+        pattern ScancodeAudioPlay,+        pattern ScancodeAudioMute,+        pattern ScancodeMediaSelect,+        pattern ScancodeWWW,+        pattern ScancodeMail,+        pattern ScancodeCalculator,+        pattern ScancodeComputer,+        pattern ScancodeACSearch,+        pattern ScancodeACHome,+        pattern ScancodeACBack,+        pattern ScancodeACForward,+        pattern ScancodeACStop,+        pattern ScancodeACRefresh,+        pattern ScancodeACBookmarks,+        pattern ScancodeBrightnessDown,+        pattern ScancodeBrightnessUp,+        pattern ScancodeDisplaySwitch,+        pattern ScancodeKBDIllumToggle,+        pattern ScancodeKBDIllumDown,+        pattern ScancodeKBDIllumUp,+        pattern ScancodeEject,+        pattern ScancodeSleep,+        pattern ScancodeApp1,+        pattern ScancodeApp2,++        -- * Keycode+        -- | Keycodes are layout-dependent codes, in that the code you receive can change for the same physical key depending on the users keyboard layout.+        -- Think of this as "the user pressed the key that is labelled 'Q' on a specific keyboard."+        -- 'Keycode' makes sense when you are anticipating the user to press either keys that match some mneumonic, or they are entering text.+        Keycode(..),+        pattern KeycodeUnknown,+        pattern KeycodeReturn,+        pattern KeycodeEscape,+        pattern KeycodeBackspace,+        pattern KeycodeTab,+        pattern KeycodeSpace,+        pattern KeycodeExclaim,+        pattern KeycodeQuoteDbl,+        pattern KeycodeHash,+        pattern KeycodePercent,+        pattern KeycodeDollar,+        pattern KeycodeAmpersand,+        pattern KeycodeQuote,+        pattern KeycodeLeftParen,+        pattern KeycodeRightParen,+        pattern KeycodeAsterisk,+        pattern KeycodePlus,+        pattern KeycodeComma,+        pattern KeycodeMinus,+        pattern KeycodePeriod,+        pattern KeycodeSlash,+        pattern Keycode0,+        pattern Keycode1,+        pattern Keycode2,+        pattern Keycode3,+        pattern Keycode4,+        pattern Keycode5,+        pattern Keycode6,+        pattern Keycode7,+        pattern Keycode8,+        pattern Keycode9,+        pattern KeycodeColon,+        pattern KeycodeSemicolon,+        pattern KeycodeLess,+        pattern KeycodeEquals,+        pattern KeycodeGreater,+        pattern KeycodeQuestion,+        pattern KeycodeAt,+        pattern KeycodeLeftBracket,+        pattern KeycodeBackslash,+        pattern KeycodeRightBracket,+        pattern KeycodeCaret,+        pattern KeycodeUnderscore,+        pattern KeycodeBackquote,+        pattern KeycodeA,+        pattern KeycodeB,+        pattern KeycodeC,+        pattern KeycodeD,+        pattern KeycodeE,+        pattern KeycodeF,+        pattern KeycodeG,+        pattern KeycodeH,+        pattern KeycodeI,+        pattern KeycodeJ,+        pattern KeycodeK,+        pattern KeycodeL,+        pattern KeycodeM,+        pattern KeycodeN,+        pattern KeycodeO,+        pattern KeycodeP,+        pattern KeycodeQ,+        pattern KeycodeR,+        pattern KeycodeS,+        pattern KeycodeT,+        pattern KeycodeU,+        pattern KeycodeV,+        pattern KeycodeW,+        pattern KeycodeX,+        pattern KeycodeY,+        pattern KeycodeZ,+        pattern KeycodeCapsLock,+        pattern KeycodeF1,+        pattern KeycodeF2,+        pattern KeycodeF3,+        pattern KeycodeF4,+        pattern KeycodeF5,+        pattern KeycodeF6,+        pattern KeycodeF7,+        pattern KeycodeF8,+        pattern KeycodeF9,+        pattern KeycodeF10,+        pattern KeycodeF11,+        pattern KeycodeF12,+        pattern KeycodePrintScreen,+        pattern KeycodeScrollLock,+        pattern KeycodePause,+        pattern KeycodeInsert,+        pattern KeycodeHome,+        pattern KeycodePageUp,+        pattern KeycodeDelete,+        pattern KeycodeEnd,+        pattern KeycodePageDown,+        pattern KeycodeRight,+        pattern KeycodeLeft,+        pattern KeycodeDown,+        pattern KeycodeUp,+        pattern KeycodeNumLockClear,+        pattern KeycodeKPDivide,+        pattern KeycodeKPMultiply,+        pattern KeycodeKPMinus,+        pattern KeycodeKPPlus,+        pattern KeycodeKPEnter,+        pattern KeycodeKP1,+        pattern KeycodeKP2,+        pattern KeycodeKP3,+        pattern KeycodeKP4,+        pattern KeycodeKP5,+        pattern KeycodeKP6,+        pattern KeycodeKP7,+        pattern KeycodeKP8,+        pattern KeycodeKP9,+        pattern KeycodeKP0,+        pattern KeycodeKPPeriod,+        pattern KeycodeApplication,+        pattern KeycodePower,+        pattern KeycodeKPEquals,+        pattern KeycodeF13,+        pattern KeycodeF14,+        pattern KeycodeF15,+        pattern KeycodeF16,+        pattern KeycodeF17,+        pattern KeycodeF18,+        pattern KeycodeF19,+        pattern KeycodeF20,+        pattern KeycodeF21,+        pattern KeycodeF22,+        pattern KeycodeF23,+        pattern KeycodeF24,+        pattern KeycodeExecute,+        pattern KeycodeHelp,+        pattern KeycodeMenu,+        pattern KeycodeSelect,+        pattern KeycodeStop,+        pattern KeycodeAgain,+        pattern KeycodeUndo,+        pattern KeycodeCut,+        pattern KeycodeCopy,+        pattern KeycodePaste,+        pattern KeycodeFind,+        pattern KeycodeMute,+        pattern KeycodeVolumeUp,+        pattern KeycodeVolumeDown,+        pattern KeycodeKPComma,+        pattern KeycodeKPEqualsAS400,+        pattern KeycodeAltErase,+        pattern KeycodeSysReq,+        pattern KeycodeCancel,+        pattern KeycodeClear,+        pattern KeycodePrior,+        pattern KeycodeReturn2,+        pattern KeycodeSeparator,+        pattern KeycodeOut,+        pattern KeycodeOper,+        pattern KeycodeClearAgain,+        pattern KeycodeCrSel,+        pattern KeycodeExSel,+        pattern KeycodeKP00,+        pattern KeycodeKP000,+        pattern KeycodeThousandsSeparator,+        pattern KeycodeDecimalSeparator,+        pattern KeycodeCurrencyUnit,+        pattern KeycodeCurrencySubunit,+        pattern KeycodeKPLeftParen,+        pattern KeycodeKPRightParen,+        pattern KeycodeKPLeftBrace,+        pattern KeycodeKPRightBrace,+        pattern KeycodeKPTab,+        pattern KeycodeKPBackspace,+        pattern KeycodeKPA,+        pattern KeycodeKPB,+        pattern KeycodeKPC,+        pattern KeycodeKPD,+        pattern KeycodeKPE,+        pattern KeycodeKPF,+        pattern KeycodeKPXor,+        pattern KeycodeKPPower,+        pattern KeycodeKPPercent,+        pattern KeycodeKPLess,+        pattern KeycodeKPGreater,+        pattern KeycodeKPAmpersand,+        pattern KeycodeKPDblAmpersand,+        pattern KeycodeKPVerticalBar,+        pattern KeycodeKPDblVerticalBar,+        pattern KeycodeKPColon,+        pattern KeycodeKPHash,+        pattern KeycodeKPSpace,+        pattern KeycodeKPAt,+        pattern KeycodeKPExclam,+        pattern KeycodeKPMemStore,+        pattern KeycodeKPMemRecall,+        pattern KeycodeKPMemClear,+        pattern KeycodeKPMemAdd,+        pattern KeycodeKPMemSubtract,+        pattern KeycodeKPMemMultiply,+        pattern KeycodeKPMemDivide,+        pattern KeycodeKPPlusMinus,+        pattern KeycodeKPClear,+        pattern KeycodeKPClearEntry,+        pattern KeycodeKPBinary,+        pattern KeycodeKPOctal,+        pattern KeycodeKPDecimal,+        pattern KeycodeKPHexadecimal,+        pattern KeycodeLCtrl,+        pattern KeycodeLShift,+        pattern KeycodeLAlt,+        pattern KeycodeLGUI,+        pattern KeycodeRCtrl,+        pattern KeycodeRShift,+        pattern KeycodeRAlt,+        pattern KeycodeRGUI,+        pattern KeycodeMode,+        pattern KeycodeAudioNext,+        pattern KeycodeAudioPrev,+        pattern KeycodeAudioStop,+        pattern KeycodeAudioPlay,+        pattern KeycodeAudioMute,+        pattern KeycodeMediaSelect,+        pattern KeycodeWWW,+        pattern KeycodeMail,+        pattern KeycodeCalculator,+        pattern KeycodeComputer,+        pattern KeycodeACSearch,+        pattern KeycodeACHome,+        pattern KeycodeACBack,+        pattern KeycodeACForward,+        pattern KeycodeACStop,+        pattern KeycodeACRefresh,+        pattern KeycodeACBookmarks,+        pattern KeycodeBrightnessDown,+        pattern KeycodeBrightnessUp,+        pattern KeycodeDisplaySwitch,+        pattern KeycodeKbdIllumToggle,+        pattern KeycodeKbdIllumDown,+        pattern KeycodeKbdIllumUp,+        pattern KeycodeEject,+        pattern KeycodeSleep)++       where++import GHC.Generics (Generic)+import Data.Data (Data)+import Data.Int+import Data.Typeable+import Data.Word+import SDL.Internal.Numbered+import qualified SDL.Raw.Enum as Raw++newtype Scancode = Scancode { unwrapScancode :: Word32 }+  deriving (Bounded, Data, Eq, Ord, Read, Generic, Show, Typeable)++pattern ScancodeUnknown = Scancode Raw.SDL_SCANCODE_UNKNOWN+pattern ScancodeA = Scancode Raw.SDL_SCANCODE_A+pattern ScancodeB = Scancode Raw.SDL_SCANCODE_B+pattern ScancodeC = Scancode Raw.SDL_SCANCODE_C+pattern ScancodeD = Scancode Raw.SDL_SCANCODE_D+pattern ScancodeE = Scancode Raw.SDL_SCANCODE_E+pattern ScancodeF = Scancode Raw.SDL_SCANCODE_F+pattern ScancodeG = Scancode Raw.SDL_SCANCODE_G+pattern ScancodeH = Scancode Raw.SDL_SCANCODE_H+pattern ScancodeI = Scancode Raw.SDL_SCANCODE_I+pattern ScancodeJ = Scancode Raw.SDL_SCANCODE_J+pattern ScancodeK = Scancode Raw.SDL_SCANCODE_K+pattern ScancodeL = Scancode Raw.SDL_SCANCODE_L+pattern ScancodeM = Scancode Raw.SDL_SCANCODE_M+pattern ScancodeN = Scancode Raw.SDL_SCANCODE_N+pattern ScancodeO = Scancode Raw.SDL_SCANCODE_O+pattern ScancodeP = Scancode Raw.SDL_SCANCODE_P+pattern ScancodeQ = Scancode Raw.SDL_SCANCODE_Q+pattern ScancodeR = Scancode Raw.SDL_SCANCODE_R+pattern ScancodeS = Scancode Raw.SDL_SCANCODE_S+pattern ScancodeT = Scancode Raw.SDL_SCANCODE_T+pattern ScancodeU = Scancode Raw.SDL_SCANCODE_U+pattern ScancodeV = Scancode Raw.SDL_SCANCODE_V+pattern ScancodeW = Scancode Raw.SDL_SCANCODE_W+pattern ScancodeX = Scancode Raw.SDL_SCANCODE_X+pattern ScancodeY = Scancode Raw.SDL_SCANCODE_Y+pattern ScancodeZ = Scancode Raw.SDL_SCANCODE_Z+pattern Scancode1 = Scancode Raw.SDL_SCANCODE_1+pattern Scancode2 = Scancode Raw.SDL_SCANCODE_2+pattern Scancode3 = Scancode Raw.SDL_SCANCODE_3+pattern Scancode4 = Scancode Raw.SDL_SCANCODE_4+pattern Scancode5 = Scancode Raw.SDL_SCANCODE_5+pattern Scancode6 = Scancode Raw.SDL_SCANCODE_6+pattern Scancode7 = Scancode Raw.SDL_SCANCODE_7+pattern Scancode8 = Scancode Raw.SDL_SCANCODE_8+pattern Scancode9 = Scancode Raw.SDL_SCANCODE_9+pattern Scancode0 = Scancode Raw.SDL_SCANCODE_0+pattern ScancodeReturn = Scancode Raw.SDL_SCANCODE_RETURN+pattern ScancodeEscape = Scancode Raw.SDL_SCANCODE_ESCAPE+pattern ScancodeBackspace = Scancode Raw.SDL_SCANCODE_BACKSPACE+pattern ScancodeTab = Scancode Raw.SDL_SCANCODE_TAB+pattern ScancodeSpace = Scancode Raw.SDL_SCANCODE_SPACE+pattern ScancodeMinus = Scancode Raw.SDL_SCANCODE_MINUS+pattern ScancodeEquals = Scancode Raw.SDL_SCANCODE_EQUALS+pattern ScancodeLeftBracket = Scancode Raw.SDL_SCANCODE_LEFTBRACKET+pattern ScancodeRightBracket = Scancode Raw.SDL_SCANCODE_RIGHTBRACKET+pattern ScancodeBackslash = Scancode Raw.SDL_SCANCODE_BACKSLASH+pattern ScancodeNonUSHash = Scancode Raw.SDL_SCANCODE_NONUSHASH+pattern ScancodeSemicolon = Scancode Raw.SDL_SCANCODE_SEMICOLON+pattern ScancodeApostrophe = Scancode Raw.SDL_SCANCODE_APOSTROPHE+pattern ScancodeGrave = Scancode Raw.SDL_SCANCODE_GRAVE+pattern ScancodeComma = Scancode Raw.SDL_SCANCODE_COMMA+pattern ScancodePeriod = Scancode Raw.SDL_SCANCODE_PERIOD+pattern ScancodeSlash = Scancode Raw.SDL_SCANCODE_SLASH+pattern ScancodeCapsLock = Scancode Raw.SDL_SCANCODE_CAPSLOCK+pattern ScancodeF1 = Scancode Raw.SDL_SCANCODE_F1+pattern ScancodeF2 = Scancode Raw.SDL_SCANCODE_F2+pattern ScancodeF3 = Scancode Raw.SDL_SCANCODE_F3+pattern ScancodeF4 = Scancode Raw.SDL_SCANCODE_F4+pattern ScancodeF5 = Scancode Raw.SDL_SCANCODE_F5+pattern ScancodeF6 = Scancode Raw.SDL_SCANCODE_F6+pattern ScancodeF7 = Scancode Raw.SDL_SCANCODE_F7+pattern ScancodeF8 = Scancode Raw.SDL_SCANCODE_F8+pattern ScancodeF9 = Scancode Raw.SDL_SCANCODE_F9+pattern ScancodeF10 = Scancode Raw.SDL_SCANCODE_F10+pattern ScancodeF11 = Scancode Raw.SDL_SCANCODE_F11+pattern ScancodeF12 = Scancode Raw.SDL_SCANCODE_F12+pattern ScancodePrintScreen = Scancode Raw.SDL_SCANCODE_PRINTSCREEN+pattern ScancodeScrollLock = Scancode Raw.SDL_SCANCODE_SCROLLLOCK+pattern ScancodePause = Scancode Raw.SDL_SCANCODE_PAUSE+pattern ScancodeInsert = Scancode Raw.SDL_SCANCODE_INSERT+pattern ScancodeHome = Scancode Raw.SDL_SCANCODE_HOME+pattern ScancodePageUp = Scancode Raw.SDL_SCANCODE_PAGEUP+pattern ScancodeDelete = Scancode Raw.SDL_SCANCODE_DELETE+pattern ScancodeEnd = Scancode Raw.SDL_SCANCODE_END+pattern ScancodePageDown = Scancode Raw.SDL_SCANCODE_PAGEDOWN+pattern ScancodeRight = Scancode Raw.SDL_SCANCODE_RIGHT+pattern ScancodeLeft = Scancode Raw.SDL_SCANCODE_LEFT+pattern ScancodeDown = Scancode Raw.SDL_SCANCODE_DOWN+pattern ScancodeUp = Scancode Raw.SDL_SCANCODE_UP+pattern ScancodeNumLockClear = Scancode Raw.SDL_SCANCODE_NUMLOCKCLEAR+pattern ScancodeKPDivide = Scancode Raw.SDL_SCANCODE_KP_DIVIDE+pattern ScancodeKPMultiply = Scancode Raw.SDL_SCANCODE_KP_MULTIPLY+pattern ScancodeKPMinus = Scancode Raw.SDL_SCANCODE_KP_MINUS+pattern ScancodeKPPlus = Scancode Raw.SDL_SCANCODE_KP_PLUS+pattern ScancodeKPEnter = Scancode Raw.SDL_SCANCODE_KP_ENTER+pattern ScancodeKP1 = Scancode Raw.SDL_SCANCODE_KP_1+pattern ScancodeKP2 = Scancode Raw.SDL_SCANCODE_KP_2+pattern ScancodeKP3 = Scancode Raw.SDL_SCANCODE_KP_3+pattern ScancodeKP4 = Scancode Raw.SDL_SCANCODE_KP_4+pattern ScancodeKP5 = Scancode Raw.SDL_SCANCODE_KP_5+pattern ScancodeKP6 = Scancode Raw.SDL_SCANCODE_KP_6+pattern ScancodeKP7 = Scancode Raw.SDL_SCANCODE_KP_7+pattern ScancodeKP8 = Scancode Raw.SDL_SCANCODE_KP_8+pattern ScancodeKP9 = Scancode Raw.SDL_SCANCODE_KP_9+pattern ScancodeKP0 = Scancode Raw.SDL_SCANCODE_KP_0+pattern ScancodeKPPeriod = Scancode Raw.SDL_SCANCODE_KP_PERIOD+pattern ScancodeNonUSBackslash = Scancode Raw.SDL_SCANCODE_NONUSBACKSLASH+pattern ScancodeApplication = Scancode Raw.SDL_SCANCODE_APPLICATION+pattern ScancodePower = Scancode Raw.SDL_SCANCODE_POWER+pattern ScancodeKPEquals = Scancode Raw.SDL_SCANCODE_KP_EQUALS+pattern ScancodeF13 = Scancode Raw.SDL_SCANCODE_F13+pattern ScancodeF14 = Scancode Raw.SDL_SCANCODE_F14+pattern ScancodeF15 = Scancode Raw.SDL_SCANCODE_F15+pattern ScancodeF16 = Scancode Raw.SDL_SCANCODE_F16+pattern ScancodeF17 = Scancode Raw.SDL_SCANCODE_F17+pattern ScancodeF18 = Scancode Raw.SDL_SCANCODE_F18+pattern ScancodeF19 = Scancode Raw.SDL_SCANCODE_F19+pattern ScancodeF20 = Scancode Raw.SDL_SCANCODE_F20+pattern ScancodeF21 = Scancode Raw.SDL_SCANCODE_F21+pattern ScancodeF22 = Scancode Raw.SDL_SCANCODE_F22+pattern ScancodeF23 = Scancode Raw.SDL_SCANCODE_F23+pattern ScancodeF24 = Scancode Raw.SDL_SCANCODE_F24+pattern ScancodeExecute = Scancode Raw.SDL_SCANCODE_EXECUTE+pattern ScancodeHelp = Scancode Raw.SDL_SCANCODE_HELP+pattern ScancodeMenu = Scancode Raw.SDL_SCANCODE_MENU+pattern ScancodeSelect = Scancode Raw.SDL_SCANCODE_SELECT+pattern ScancodeStop = Scancode Raw.SDL_SCANCODE_STOP+pattern ScancodeAgain = Scancode Raw.SDL_SCANCODE_AGAIN+pattern ScancodeUndo = Scancode Raw.SDL_SCANCODE_UNDO+pattern ScancodeCut = Scancode Raw.SDL_SCANCODE_CUT+pattern ScancodeCopy = Scancode Raw.SDL_SCANCODE_COPY+pattern ScancodePaste = Scancode Raw.SDL_SCANCODE_PASTE+pattern ScancodeFind = Scancode Raw.SDL_SCANCODE_FIND+pattern ScancodeMute = Scancode Raw.SDL_SCANCODE_MUTE+pattern ScancodeVolumeUp = Scancode Raw.SDL_SCANCODE_VOLUMEUP+pattern ScancodeVolumeDown = Scancode Raw.SDL_SCANCODE_VOLUMEDOWN+pattern ScancodeKPComma = Scancode Raw.SDL_SCANCODE_KP_COMMA+pattern ScancodeKPEqualsAS400 = Scancode Raw.SDL_SCANCODE_KP_EQUALSAS400+pattern ScancodeInternational1 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL1+pattern ScancodeInternational2 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL2+pattern ScancodeInternational3 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL3+pattern ScancodeInternational4 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL4+pattern ScancodeInternational5 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL5+pattern ScancodeInternational6 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL6+pattern ScancodeInternational7 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL7+pattern ScancodeInternational8 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL8+pattern ScancodeInternational9 = Scancode Raw.SDL_SCANCODE_INTERNATIONAL9+pattern ScancodeLang1 = Scancode Raw.SDL_SCANCODE_LANG1+pattern ScancodeLang2 = Scancode Raw.SDL_SCANCODE_LANG2+pattern ScancodeLang3 = Scancode Raw.SDL_SCANCODE_LANG3+pattern ScancodeLang4 = Scancode Raw.SDL_SCANCODE_LANG4+pattern ScancodeLang5 = Scancode Raw.SDL_SCANCODE_LANG5+pattern ScancodeLang6 = Scancode Raw.SDL_SCANCODE_LANG6+pattern ScancodeLang7 = Scancode Raw.SDL_SCANCODE_LANG7+pattern ScancodeLang8 = Scancode Raw.SDL_SCANCODE_LANG8+pattern ScancodeLang9 = Scancode Raw.SDL_SCANCODE_LANG9+pattern ScancodeAltErase = Scancode Raw.SDL_SCANCODE_ALTERASE+pattern ScancodeSysReq = Scancode Raw.SDL_SCANCODE_SYSREQ+pattern ScancodeCancel = Scancode Raw.SDL_SCANCODE_CANCEL+pattern ScancodeClear = Scancode Raw.SDL_SCANCODE_CLEAR+pattern ScancodePrior = Scancode Raw.SDL_SCANCODE_PRIOR+pattern ScancodeReturn2 = Scancode Raw.SDL_SCANCODE_RETURN2+pattern ScancodeSeparator = Scancode Raw.SDL_SCANCODE_SEPARATOR+pattern ScancodeOut = Scancode Raw.SDL_SCANCODE_OUT+pattern ScancodeOper = Scancode Raw.SDL_SCANCODE_OPER+pattern ScancodeClearAgain = Scancode Raw.SDL_SCANCODE_CLEARAGAIN+pattern ScancodeCrSel = Scancode Raw.SDL_SCANCODE_CRSEL+pattern ScancodeExSel = Scancode Raw.SDL_SCANCODE_EXSEL+pattern ScancodeKP00 = Scancode Raw.SDL_SCANCODE_KP_00+pattern ScancodeKP000 = Scancode Raw.SDL_SCANCODE_KP_000+pattern ScancodeThousandsSeparator = Scancode Raw.SDL_SCANCODE_THOUSANDSSEPARATOR+pattern ScancodeDecimalSeparator = Scancode Raw.SDL_SCANCODE_DECIMALSEPARATOR+pattern ScancodeCurrencyUnit = Scancode Raw.SDL_SCANCODE_CURRENCYUNIT+pattern ScancodeCurrencySubunit = Scancode Raw.SDL_SCANCODE_CURRENCYSUBUNIT+pattern ScancodeLeftParen = Scancode Raw.SDL_SCANCODE_KP_LEFTPAREN+pattern ScancodeRightParen = Scancode Raw.SDL_SCANCODE_KP_RIGHTPAREN+pattern ScancodeLeftBrace = Scancode Raw.SDL_SCANCODE_KP_LEFTBRACE+pattern ScancodeRightBrace = Scancode Raw.SDL_SCANCODE_KP_RIGHTBRACE+pattern ScancodeKPTab = Scancode Raw.SDL_SCANCODE_KP_TAB+pattern ScancodeKPBackspace = Scancode Raw.SDL_SCANCODE_KP_BACKSPACE+pattern ScancodeKPA = Scancode Raw.SDL_SCANCODE_KP_A+pattern ScancodeKPB = Scancode Raw.SDL_SCANCODE_KP_B+pattern ScancodeKPC = Scancode Raw.SDL_SCANCODE_KP_C+pattern ScancodeKPD = Scancode Raw.SDL_SCANCODE_KP_D+pattern ScancodeKPE = Scancode Raw.SDL_SCANCODE_KP_E+pattern ScancodeKPF = Scancode Raw.SDL_SCANCODE_KP_F+pattern ScancodeKPXOR = Scancode Raw.SDL_SCANCODE_KP_XOR+pattern ScancodeKPPower = Scancode Raw.SDL_SCANCODE_KP_POWER+pattern ScancodeKPPercent = Scancode Raw.SDL_SCANCODE_KP_PERCENT+pattern ScancodeKPLess = Scancode Raw.SDL_SCANCODE_KP_LESS+pattern ScancodeKPGreater = Scancode Raw.SDL_SCANCODE_KP_GREATER+pattern ScancodeKPAmpersand = Scancode Raw.SDL_SCANCODE_KP_AMPERSAND+pattern ScancodeKPDblAmpersand = Scancode Raw.SDL_SCANCODE_KP_DBLAMPERSAND+pattern ScancodeKPVerticalBar = Scancode Raw.SDL_SCANCODE_KP_VERTICALBAR+pattern ScancodeKPDblVerticalBar = Scancode Raw.SDL_SCANCODE_KP_DBLVERTICALBAR+pattern ScancodeKPColon = Scancode Raw.SDL_SCANCODE_KP_COLON+pattern ScancodeKPHash = Scancode Raw.SDL_SCANCODE_KP_HASH+pattern ScancodeKPSpace = Scancode Raw.SDL_SCANCODE_KP_SPACE+pattern ScancodeKPAt = Scancode Raw.SDL_SCANCODE_KP_AT+pattern ScancodeKPExclam = Scancode Raw.SDL_SCANCODE_KP_EXCLAM+pattern ScancodeKPMemStore = Scancode Raw.SDL_SCANCODE_KP_MEMSTORE+pattern ScancodeKPMemRecall = Scancode Raw.SDL_SCANCODE_KP_MEMRECALL+pattern ScancodeKPMemClear = Scancode Raw.SDL_SCANCODE_KP_MEMCLEAR+pattern ScancodeKPMemAdd = Scancode Raw.SDL_SCANCODE_KP_MEMADD+pattern ScancodeKPMemSubtract = Scancode Raw.SDL_SCANCODE_KP_MEMSUBTRACT+pattern ScancodeKPMemMultiply = Scancode Raw.SDL_SCANCODE_KP_MEMMULTIPLY+pattern ScancodeKPMemDivide = Scancode Raw.SDL_SCANCODE_KP_MEMDIVIDE+pattern ScancodeKPPlusMinus = Scancode Raw.SDL_SCANCODE_KP_PLUSMINUS+pattern ScancodeKPClear = Scancode Raw.SDL_SCANCODE_KP_CLEAR+pattern ScancodeKPClearEntry = Scancode Raw.SDL_SCANCODE_KP_CLEARENTRY+pattern ScancodeKPBinary = Scancode Raw.SDL_SCANCODE_KP_BINARY+pattern ScancodeKPOctal = Scancode Raw.SDL_SCANCODE_KP_OCTAL+pattern ScancodeKPDecimal = Scancode Raw.SDL_SCANCODE_KP_DECIMAL+pattern ScancodeKPHexadecimal = Scancode Raw.SDL_SCANCODE_KP_HEXADECIMAL+pattern ScancodeLCtrl = Scancode Raw.SDL_SCANCODE_LCTRL+pattern ScancodeLShift = Scancode Raw.SDL_SCANCODE_LSHIFT+pattern ScancodeLAlt = Scancode Raw.SDL_SCANCODE_LALT+pattern ScancodeLGUI = Scancode Raw.SDL_SCANCODE_LGUI+pattern ScancodeRCtrl = Scancode Raw.SDL_SCANCODE_RCTRL+pattern ScancodeRShift = Scancode Raw.SDL_SCANCODE_RSHIFT+pattern ScancodeRAlt = Scancode Raw.SDL_SCANCODE_RALT+pattern ScancodeRGUI = Scancode Raw.SDL_SCANCODE_RGUI+pattern ScancodeMode = Scancode Raw.SDL_SCANCODE_MODE+pattern ScancodeAudioNext = Scancode Raw.SDL_SCANCODE_AUDIONEXT+pattern ScancodeAudioPrev = Scancode Raw.SDL_SCANCODE_AUDIOPREV+pattern ScancodeAudioStop = Scancode Raw.SDL_SCANCODE_AUDIOSTOP+pattern ScancodeAudioPlay = Scancode Raw.SDL_SCANCODE_AUDIOPLAY+pattern ScancodeAudioMute = Scancode Raw.SDL_SCANCODE_AUDIOMUTE+pattern ScancodeMediaSelect = Scancode Raw.SDL_SCANCODE_MEDIASELECT+pattern ScancodeWWW = Scancode Raw.SDL_SCANCODE_WWW+pattern ScancodeMail = Scancode Raw.SDL_SCANCODE_MAIL+pattern ScancodeCalculator = Scancode Raw.SDL_SCANCODE_CALCULATOR+pattern ScancodeComputer = Scancode Raw.SDL_SCANCODE_COMPUTER+pattern ScancodeACSearch = Scancode Raw.SDL_SCANCODE_AC_SEARCH+pattern ScancodeACHome = Scancode Raw.SDL_SCANCODE_AC_HOME+pattern ScancodeACBack = Scancode Raw.SDL_SCANCODE_AC_BACK+pattern ScancodeACForward = Scancode Raw.SDL_SCANCODE_AC_FORWARD+pattern ScancodeACStop = Scancode Raw.SDL_SCANCODE_AC_STOP+pattern ScancodeACRefresh = Scancode Raw.SDL_SCANCODE_AC_REFRESH+pattern ScancodeACBookmarks = Scancode Raw.SDL_SCANCODE_AC_BOOKMARKS+pattern ScancodeBrightnessDown = Scancode Raw.SDL_SCANCODE_BRIGHTNESSDOWN+pattern ScancodeBrightnessUp = Scancode Raw.SDL_SCANCODE_BRIGHTNESSUP+pattern ScancodeDisplaySwitch = Scancode Raw.SDL_SCANCODE_DISPLAYSWITCH+pattern ScancodeKBDIllumToggle = Scancode Raw.SDL_SCANCODE_KBDILLUMTOGGLE+pattern ScancodeKBDIllumDown = Scancode Raw.SDL_SCANCODE_KBDILLUMDOWN+pattern ScancodeKBDIllumUp = Scancode Raw.SDL_SCANCODE_KBDILLUMUP+pattern ScancodeEject = Scancode Raw.SDL_SCANCODE_EJECT+pattern ScancodeSleep = Scancode Raw.SDL_SCANCODE_SLEEP+pattern ScancodeApp1 = Scancode Raw.SDL_SCANCODE_APP1+pattern ScancodeApp2 = Scancode Raw.SDL_SCANCODE_APP2++instance FromNumber Scancode Word32 where+  fromNumber = Scancode++instance ToNumber Scancode Word32 where+  toNumber = unwrapScancode++newtype Keycode = Keycode { unwrapKeycode :: Int32 }+  deriving (Bounded, Data, Eq, Ord, Read, Generic, Show, Typeable)++pattern KeycodeUnknown = Keycode Raw.SDLK_UNKNOWN+pattern KeycodeReturn = Keycode Raw.SDLK_RETURN+pattern KeycodeEscape = Keycode Raw.SDLK_ESCAPE+pattern KeycodeBackspace = Keycode Raw.SDLK_BACKSPACE+pattern KeycodeTab = Keycode Raw.SDLK_TAB+pattern KeycodeSpace = Keycode Raw.SDLK_SPACE+pattern KeycodeExclaim = Keycode Raw.SDLK_EXCLAIM+pattern KeycodeQuoteDbl = Keycode Raw.SDLK_QUOTEDBL+pattern KeycodeHash = Keycode Raw.SDLK_HASH+pattern KeycodePercent = Keycode Raw.SDLK_PERCENT+pattern KeycodeDollar = Keycode Raw.SDLK_DOLLAR+pattern KeycodeAmpersand = Keycode Raw.SDLK_AMPERSAND+pattern KeycodeQuote = Keycode Raw.SDLK_QUOTE+pattern KeycodeLeftParen = Keycode Raw.SDLK_LEFTPAREN+pattern KeycodeRightParen = Keycode Raw.SDLK_RIGHTPAREN+pattern KeycodeAsterisk = Keycode Raw.SDLK_ASTERISK+pattern KeycodePlus = Keycode Raw.SDLK_PLUS+pattern KeycodeComma = Keycode Raw.SDLK_COMMA+pattern KeycodeMinus = Keycode Raw.SDLK_MINUS+pattern KeycodePeriod = Keycode Raw.SDLK_PERIOD+pattern KeycodeSlash = Keycode Raw.SDLK_SLASH+pattern Keycode0 = Keycode Raw.SDLK_0+pattern Keycode1 = Keycode Raw.SDLK_1+pattern Keycode2 = Keycode Raw.SDLK_2+pattern Keycode3 = Keycode Raw.SDLK_3+pattern Keycode4 = Keycode Raw.SDLK_4+pattern Keycode5 = Keycode Raw.SDLK_5+pattern Keycode6 = Keycode Raw.SDLK_6+pattern Keycode7 = Keycode Raw.SDLK_7+pattern Keycode8 = Keycode Raw.SDLK_8+pattern Keycode9 = Keycode Raw.SDLK_9+pattern KeycodeColon = Keycode Raw.SDLK_COLON+pattern KeycodeSemicolon = Keycode Raw.SDLK_SEMICOLON+pattern KeycodeLess = Keycode Raw.SDLK_LESS+pattern KeycodeEquals = Keycode Raw.SDLK_EQUALS+pattern KeycodeGreater = Keycode Raw.SDLK_GREATER+pattern KeycodeQuestion = Keycode Raw.SDLK_QUESTION+pattern KeycodeAt = Keycode Raw.SDLK_AT+pattern KeycodeLeftBracket = Keycode Raw.SDLK_LEFTBRACKET+pattern KeycodeBackslash = Keycode Raw.SDLK_BACKSLASH+pattern KeycodeRightBracket = Keycode Raw.SDLK_RIGHTBRACKET+pattern KeycodeCaret = Keycode Raw.SDLK_CARET+pattern KeycodeUnderscore = Keycode Raw.SDLK_UNDERSCORE+pattern KeycodeBackquote = Keycode Raw.SDLK_BACKQUOTE+pattern KeycodeA = Keycode Raw.SDLK_a+pattern KeycodeB = Keycode Raw.SDLK_b+pattern KeycodeC = Keycode Raw.SDLK_c+pattern KeycodeD = Keycode Raw.SDLK_d+pattern KeycodeE = Keycode Raw.SDLK_e+pattern KeycodeF = Keycode Raw.SDLK_f+pattern KeycodeG = Keycode Raw.SDLK_g+pattern KeycodeH = Keycode Raw.SDLK_h+pattern KeycodeI = Keycode Raw.SDLK_i+pattern KeycodeJ = Keycode Raw.SDLK_j+pattern KeycodeK = Keycode Raw.SDLK_k+pattern KeycodeL = Keycode Raw.SDLK_l+pattern KeycodeM = Keycode Raw.SDLK_m+pattern KeycodeN = Keycode Raw.SDLK_n+pattern KeycodeO = Keycode Raw.SDLK_o+pattern KeycodeP = Keycode Raw.SDLK_p+pattern KeycodeQ = Keycode Raw.SDLK_q+pattern KeycodeR = Keycode Raw.SDLK_r+pattern KeycodeS = Keycode Raw.SDLK_s+pattern KeycodeT = Keycode Raw.SDLK_t+pattern KeycodeU = Keycode Raw.SDLK_u+pattern KeycodeV = Keycode Raw.SDLK_v+pattern KeycodeW = Keycode Raw.SDLK_w+pattern KeycodeX = Keycode Raw.SDLK_x+pattern KeycodeY = Keycode Raw.SDLK_y+pattern KeycodeZ = Keycode Raw.SDLK_z+pattern KeycodeCapsLock = Keycode Raw.SDLK_CAPSLOCK+pattern KeycodeF1 = Keycode Raw.SDLK_F1+pattern KeycodeF2 = Keycode Raw.SDLK_F2+pattern KeycodeF3 = Keycode Raw.SDLK_F3+pattern KeycodeF4 = Keycode Raw.SDLK_F4+pattern KeycodeF5 = Keycode Raw.SDLK_F5+pattern KeycodeF6 = Keycode Raw.SDLK_F6+pattern KeycodeF7 = Keycode Raw.SDLK_F7+pattern KeycodeF8 = Keycode Raw.SDLK_F8+pattern KeycodeF9 = Keycode Raw.SDLK_F9+pattern KeycodeF10 = Keycode Raw.SDLK_F10+pattern KeycodeF11 = Keycode Raw.SDLK_F11+pattern KeycodeF12 = Keycode Raw.SDLK_F12+pattern KeycodePrintScreen = Keycode Raw.SDLK_PRINTSCREEN+pattern KeycodeScrollLock = Keycode Raw.SDLK_SCROLLLOCK+pattern KeycodePause = Keycode Raw.SDLK_PAUSE+pattern KeycodeInsert = Keycode Raw.SDLK_INSERT+pattern KeycodeHome = Keycode Raw.SDLK_HOME+pattern KeycodePageUp = Keycode Raw.SDLK_PAGEUP+pattern KeycodeDelete = Keycode Raw.SDLK_DELETE+pattern KeycodeEnd = Keycode Raw.SDLK_END+pattern KeycodePageDown = Keycode Raw.SDLK_PAGEDOWN+pattern KeycodeRight = Keycode Raw.SDLK_RIGHT+pattern KeycodeLeft = Keycode Raw.SDLK_LEFT+pattern KeycodeDown = Keycode Raw.SDLK_DOWN+pattern KeycodeUp = Keycode Raw.SDLK_UP+pattern KeycodeNumLockClear = Keycode Raw.SDLK_NUMLOCKCLEAR+pattern KeycodeKPDivide = Keycode Raw.SDLK_KP_DIVIDE+pattern KeycodeKPMultiply = Keycode Raw.SDLK_KP_MULTIPLY+pattern KeycodeKPMinus = Keycode Raw.SDLK_KP_MINUS+pattern KeycodeKPPlus = Keycode Raw.SDLK_KP_PLUS+pattern KeycodeKPEnter = Keycode Raw.SDLK_KP_ENTER+pattern KeycodeKP1 = Keycode Raw.SDLK_KP_1+pattern KeycodeKP2 = Keycode Raw.SDLK_KP_2+pattern KeycodeKP3 = Keycode Raw.SDLK_KP_3+pattern KeycodeKP4 = Keycode Raw.SDLK_KP_4+pattern KeycodeKP5 = Keycode Raw.SDLK_KP_5+pattern KeycodeKP6 = Keycode Raw.SDLK_KP_6+pattern KeycodeKP7 = Keycode Raw.SDLK_KP_7+pattern KeycodeKP8 = Keycode Raw.SDLK_KP_8+pattern KeycodeKP9 = Keycode Raw.SDLK_KP_9+pattern KeycodeKP0 = Keycode Raw.SDLK_KP_0+pattern KeycodeKPPeriod = Keycode Raw.SDLK_KP_PERIOD+pattern KeycodeApplication = Keycode Raw.SDLK_APPLICATION+pattern KeycodePower = Keycode Raw.SDLK_POWER+pattern KeycodeKPEquals = Keycode Raw.SDLK_KP_EQUALS+pattern KeycodeF13 = Keycode Raw.SDLK_F13+pattern KeycodeF14 = Keycode Raw.SDLK_F14+pattern KeycodeF15 = Keycode Raw.SDLK_F15+pattern KeycodeF16 = Keycode Raw.SDLK_F16+pattern KeycodeF17 = Keycode Raw.SDLK_F17+pattern KeycodeF18 = Keycode Raw.SDLK_F18+pattern KeycodeF19 = Keycode Raw.SDLK_F19+pattern KeycodeF20 = Keycode Raw.SDLK_F20+pattern KeycodeF21 = Keycode Raw.SDLK_F21+pattern KeycodeF22 = Keycode Raw.SDLK_F22+pattern KeycodeF23 = Keycode Raw.SDLK_F23+pattern KeycodeF24 = Keycode Raw.SDLK_F24+pattern KeycodeExecute = Keycode Raw.SDLK_EXECUTE+pattern KeycodeHelp = Keycode Raw.SDLK_HELP+pattern KeycodeMenu = Keycode Raw.SDLK_MENU+pattern KeycodeSelect = Keycode Raw.SDLK_SELECT+pattern KeycodeStop = Keycode Raw.SDLK_STOP+pattern KeycodeAgain = Keycode Raw.SDLK_AGAIN+pattern KeycodeUndo = Keycode Raw.SDLK_UNDO+pattern KeycodeCut = Keycode Raw.SDLK_CUT+pattern KeycodeCopy = Keycode Raw.SDLK_COPY+pattern KeycodePaste = Keycode Raw.SDLK_PASTE+pattern KeycodeFind = Keycode Raw.SDLK_FIND+pattern KeycodeMute = Keycode Raw.SDLK_MUTE+pattern KeycodeVolumeUp = Keycode Raw.SDLK_VOLUMEUP+pattern KeycodeVolumeDown = Keycode Raw.SDLK_VOLUMEDOWN+pattern KeycodeKPComma = Keycode Raw.SDLK_KP_COMMA+pattern KeycodeKPEqualsAS400 = Keycode Raw.SDLK_KP_EQUALSAS400+pattern KeycodeAltErase = Keycode Raw.SDLK_ALTERASE+pattern KeycodeSysReq = Keycode Raw.SDLK_SYSREQ+pattern KeycodeCancel = Keycode Raw.SDLK_CANCEL+pattern KeycodeClear = Keycode Raw.SDLK_CLEAR+pattern KeycodePrior = Keycode Raw.SDLK_PRIOR+pattern KeycodeReturn2 = Keycode Raw.SDLK_RETURN2+pattern KeycodeSeparator = Keycode Raw.SDLK_SEPARATOR+pattern KeycodeOut = Keycode Raw.SDLK_OUT+pattern KeycodeOper = Keycode Raw.SDLK_OPER+pattern KeycodeClearAgain = Keycode Raw.SDLK_CLEARAGAIN+pattern KeycodeCrSel = Keycode Raw.SDLK_CRSEL+pattern KeycodeExSel = Keycode Raw.SDLK_EXSEL+pattern KeycodeKP00 = Keycode Raw.SDLK_KP_00+pattern KeycodeKP000 = Keycode Raw.SDLK_KP_000+pattern KeycodeThousandsSeparator = Keycode Raw.SDLK_THOUSANDSSEPARATOR+pattern KeycodeDecimalSeparator = Keycode Raw.SDLK_DECIMALSEPARATOR+pattern KeycodeCurrencyUnit = Keycode Raw.SDLK_CURRENCYUNIT+pattern KeycodeCurrencySubunit = Keycode Raw.SDLK_CURRENCYSUBUNIT+pattern KeycodeKPLeftParen = Keycode Raw.SDLK_KP_LEFTPAREN+pattern KeycodeKPRightParen = Keycode Raw.SDLK_KP_RIGHTPAREN+pattern KeycodeKPLeftBrace = Keycode Raw.SDLK_KP_LEFTBRACE+pattern KeycodeKPRightBrace = Keycode Raw.SDLK_KP_RIGHTBRACE+pattern KeycodeKPTab = Keycode Raw.SDLK_KP_TAB+pattern KeycodeKPBackspace = Keycode Raw.SDLK_KP_BACKSPACE+pattern KeycodeKPA = Keycode Raw.SDLK_KP_A+pattern KeycodeKPB = Keycode Raw.SDLK_KP_B+pattern KeycodeKPC = Keycode Raw.SDLK_KP_C+pattern KeycodeKPD = Keycode Raw.SDLK_KP_D+pattern KeycodeKPE = Keycode Raw.SDLK_KP_E+pattern KeycodeKPF = Keycode Raw.SDLK_KP_F+pattern KeycodeKPXor = Keycode Raw.SDLK_KP_XOR+pattern KeycodeKPPower = Keycode Raw.SDLK_KP_POWER+pattern KeycodeKPPercent = Keycode Raw.SDLK_KP_PERCENT+pattern KeycodeKPLess = Keycode Raw.SDLK_KP_LESS+pattern KeycodeKPGreater = Keycode Raw.SDLK_KP_GREATER+pattern KeycodeKPAmpersand = Keycode Raw.SDLK_KP_AMPERSAND+pattern KeycodeKPDblAmpersand = Keycode Raw.SDLK_KP_DBLAMPERSAND+pattern KeycodeKPVerticalBar = Keycode Raw.SDLK_KP_VERTICALBAR+pattern KeycodeKPDblVerticalBar = Keycode Raw.SDLK_KP_DBLVERTICALBAR+pattern KeycodeKPColon = Keycode Raw.SDLK_KP_COLON+pattern KeycodeKPHash = Keycode Raw.SDLK_KP_HASH+pattern KeycodeKPSpace = Keycode Raw.SDLK_KP_SPACE+pattern KeycodeKPAt = Keycode Raw.SDLK_KP_AT+pattern KeycodeKPExclam = Keycode Raw.SDLK_KP_EXCLAM+pattern KeycodeKPMemStore = Keycode Raw.SDLK_KP_MEMSTORE+pattern KeycodeKPMemRecall = Keycode Raw.SDLK_KP_MEMRECALL+pattern KeycodeKPMemClear = Keycode Raw.SDLK_KP_MEMCLEAR+pattern KeycodeKPMemAdd = Keycode Raw.SDLK_KP_MEMADD+pattern KeycodeKPMemSubtract = Keycode Raw.SDLK_KP_MEMSUBTRACT+pattern KeycodeKPMemMultiply = Keycode Raw.SDLK_KP_MEMMULTIPLY+pattern KeycodeKPMemDivide = Keycode Raw.SDLK_KP_MEMDIVIDE+pattern KeycodeKPPlusMinus = Keycode Raw.SDLK_KP_PLUSMINUS+pattern KeycodeKPClear = Keycode Raw.SDLK_KP_CLEAR+pattern KeycodeKPClearEntry = Keycode Raw.SDLK_KP_CLEARENTRY+pattern KeycodeKPBinary = Keycode Raw.SDLK_KP_BINARY+pattern KeycodeKPOctal = Keycode Raw.SDLK_KP_OCTAL+pattern KeycodeKPDecimal = Keycode Raw.SDLK_KP_DECIMAL+pattern KeycodeKPHexadecimal = Keycode Raw.SDLK_KP_HEXADECIMAL+pattern KeycodeLCtrl = Keycode Raw.SDLK_LCTRL+pattern KeycodeLShift = Keycode Raw.SDLK_LSHIFT+pattern KeycodeLAlt = Keycode Raw.SDLK_LALT+pattern KeycodeLGUI = Keycode Raw.SDLK_LGUI+pattern KeycodeRCtrl = Keycode Raw.SDLK_RCTRL+pattern KeycodeRShift = Keycode Raw.SDLK_RSHIFT+pattern KeycodeRAlt = Keycode Raw.SDLK_RALT+pattern KeycodeRGUI = Keycode Raw.SDLK_RGUI+pattern KeycodeMode = Keycode Raw.SDLK_MODE+pattern KeycodeAudioNext = Keycode Raw.SDLK_AUDIONEXT+pattern KeycodeAudioPrev = Keycode Raw.SDLK_AUDIOPREV+pattern KeycodeAudioStop = Keycode Raw.SDLK_AUDIOSTOP+pattern KeycodeAudioPlay = Keycode Raw.SDLK_AUDIOPLAY+pattern KeycodeAudioMute = Keycode Raw.SDLK_AUDIOMUTE+pattern KeycodeMediaSelect = Keycode Raw.SDLK_MEDIASELECT+pattern KeycodeWWW = Keycode Raw.SDLK_WWW+pattern KeycodeMail = Keycode Raw.SDLK_MAIL+pattern KeycodeCalculator = Keycode Raw.SDLK_CALCULATOR+pattern KeycodeComputer = Keycode Raw.SDLK_COMPUTER+pattern KeycodeACSearch = Keycode Raw.SDLK_AC_SEARCH+pattern KeycodeACHome = Keycode Raw.SDLK_AC_HOME+pattern KeycodeACBack = Keycode Raw.SDLK_AC_BACK+pattern KeycodeACForward = Keycode Raw.SDLK_AC_FORWARD+pattern KeycodeACStop = Keycode Raw.SDLK_AC_STOP+pattern KeycodeACRefresh = Keycode Raw.SDLK_AC_REFRESH+pattern KeycodeACBookmarks = Keycode Raw.SDLK_AC_BOOKMARKS+pattern KeycodeBrightnessDown = Keycode Raw.SDLK_BRIGHTNESSDOWN+pattern KeycodeBrightnessUp = Keycode Raw.SDLK_BRIGHTNESSUP+pattern KeycodeDisplaySwitch = Keycode Raw.SDLK_DISPLAYSWITCH+pattern KeycodeKbdIllumToggle = Keycode Raw.SDLK_KBDILLUMTOGGLE+pattern KeycodeKbdIllumDown = Keycode Raw.SDLK_KBDILLUMDOWN+pattern KeycodeKbdIllumUp = Keycode Raw.SDLK_KBDILLUMUP+pattern KeycodeEject = Keycode Raw.SDLK_EJECT+pattern KeycodeSleep = Keycode Raw.SDLK_SLEEP++instance FromNumber Keycode Int32 where+  fromNumber = Keycode++instance ToNumber Keycode Int32 where+  toNumber = unwrapKeycode
src/SDL/Input/Mouse.hs view
@@ -1,259 +1,259 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-
-module SDL.Input.Mouse
-  ( -- * Relative Mouse Mode
-    LocationMode(..)
-  , setMouseLocationMode
-  , getMouseLocationMode
-
-    -- * Mouse and Touch Input
-  , MouseButton(..)
-  , MouseDevice(..)
-  , MouseScrollDirection(..)
-
-    -- * Mouse State
-  , getModalMouseLocation
-  , getAbsoluteMouseLocation
-  , getRelativeMouseLocation
-  , getMouseButtons
-
-    -- * Warping the Mouse
-  , WarpMouseOrigin(..)
-  , warpMouse
-
-    -- * Cursor Visibility
-  , cursorVisible
-
-    -- * Cursor Shape
-  , Cursor
-  , activeCursor
-  , createCursor
-  , freeCursor
-  , createColorCursor
-  ) where
-
-import Control.Monad (void)
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Bits
-import Data.Bool
-import Data.Data (Data)
-import Data.StateVar
-import Data.Typeable
-import Data.Word
-import Foreign.C
-import Foreign.Marshal.Alloc
-import Foreign.Ptr
-import Foreign.Storable
-import GHC.Generics (Generic)
-import SDL.Vect
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import SDL.Internal.Types (Window(Window))
-import SDL.Video.Renderer (Surface(Surface))
-import qualified Data.Vector.Storable as V
-import qualified SDL.Raw.Enum as Raw
-import qualified SDL.Raw.Event as Raw
-import qualified SDL.Raw.Types as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
-data LocationMode
-  = AbsoluteLocation
-  | RelativeLocation
-  deriving (Bounded, Data, Eq, Enum, Generic, Ord, Read, Show, Typeable)
-
--- | Sets the current relative mouse mode.
---
--- When relative mouse mode is enabled, cursor is hidden and mouse position
--- will not change. However, you will be delivered relative mouse position
--- change events.
-setMouseLocationMode :: (Functor m, MonadIO m) => LocationMode -> m LocationMode
-setMouseLocationMode mode =
-  Raw.setRelativeMouseMode (mode == RelativeLocation) >> getMouseLocationMode
-
--- | Check which mouse location mode is currently active.
-getMouseLocationMode :: MonadIO m => m LocationMode
-getMouseLocationMode = do
-  relativeMode <- Raw.getRelativeMouseMode
-  return $ if relativeMode then RelativeLocation else AbsoluteLocation
-
-data ModalLocation
-  = AbsoluteModalLocation (Point V2 CInt)
-  | RelativeModalLocation (V2 CInt)
-  deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Return proper mouse location depending on mouse mode
-getModalMouseLocation :: MonadIO m => m ModalLocation
-getModalMouseLocation = do
-  mode <- getMouseLocationMode
-  case mode of
-    AbsoluteLocation -> do
-      location <- getAbsoluteMouseLocation
-      return (AbsoluteModalLocation location)
-    RelativeLocation -> do
-      location <- getRelativeMouseLocation
-      return (RelativeModalLocation location)
-
-data MouseButton
-  = ButtonLeft
-  | ButtonMiddle
-  | ButtonRight
-  | ButtonX1
-  | ButtonX2
-  | ButtonExtra !Int -- ^ An unknown mouse button.
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber MouseButton Word8 where
-  fromNumber Raw.SDL_BUTTON_LEFT   = ButtonLeft
-  fromNumber Raw.SDL_BUTTON_MIDDLE = ButtonMiddle
-  fromNumber Raw.SDL_BUTTON_RIGHT  = ButtonRight
-  fromNumber Raw.SDL_BUTTON_X1     = ButtonX1
-  fromNumber Raw.SDL_BUTTON_X2     = ButtonX2
-  fromNumber buttonCode            = ButtonExtra $ fromIntegral buttonCode
-
-instance ToNumber MouseButton Word8 where
-  toNumber ButtonLeft      = Raw.SDL_BUTTON_LEFT
-  toNumber ButtonMiddle    = Raw.SDL_BUTTON_MIDDLE
-  toNumber ButtonRight     = Raw.SDL_BUTTON_RIGHT
-  toNumber ButtonX1        = Raw.SDL_BUTTON_X1
-  toNumber ButtonX2        = Raw.SDL_BUTTON_X2
-  toNumber (ButtonExtra i) = fromIntegral i
-
--- | Identifies what kind of mouse-like device this is.
-data MouseDevice
-  = Mouse !Int -- ^ An actual mouse. The number identifies which mouse.
-  | Touch      -- ^ Some sort of touch device.
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber MouseDevice Word32 where
-  fromNumber n' = case n' of
-    Raw.SDL_TOUCH_MOUSEID -> Touch
-    n -> Mouse $ fromIntegral n
-
--- | Identifies mouse scroll direction.
-data MouseScrollDirection
-  = ScrollNormal
-  | ScrollFlipped
-  deriving (Bounded, Data, Eq, Enum, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber MouseScrollDirection Word32 where
-  fromNumber n' = case n' of
-    Raw.SDL_MOUSEWHEEL_NORMAL -> ScrollNormal
-    Raw.SDL_MOUSEWHEEL_FLIPPED -> ScrollFlipped
-    _ -> ScrollNormal
-
-data WarpMouseOrigin
-  = WarpInWindow Window
-    -- ^ Move the mouse pointer within a given 'Window'.
-  | WarpCurrentFocus
-    -- ^ Move the mouse pointer within whichever 'Window' currently has focus.
-  | WarpGlobal
-    -- ^ Move the mouse pointer in global screen space.
-  deriving (Data, Eq, Generic, Ord, Show, Typeable)
-
--- | Move the current location of a mouse pointer. The 'WarpMouseOrigin' specifies the origin for the given warp coordinates.
-warpMouse :: MonadIO m => WarpMouseOrigin -> Point V2 CInt -> m ()
-warpMouse (WarpInWindow (Window w)) (P (V2 x y)) = Raw.warpMouseInWindow w x y
-warpMouse WarpCurrentFocus (P (V2 x y)) = Raw.warpMouseInWindow nullPtr x y
-warpMouse WarpGlobal (P (V2 x y)) = throwIfNeg_ "SDL.Mouse.warpMouse" "SDL_WarpMouseGlobal" $
-  Raw.warpMouseGlobal x y
-
--- | Get or set whether the cursor is currently visible.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_ShowCursor SDL_ShowCursor>@ and @<https://wiki.libsdl.org/SDL_HideCursor SDL_HideCursor>@ for C documentation.
-cursorVisible :: StateVar Bool
-cursorVisible = makeStateVar getCursorVisible setCursorVisible
-  where
-  -- The usage of 'void' is OK here - Raw.showCursor just returns the old state.
-  setCursorVisible :: (Functor m, MonadIO m) => Bool -> m ()
-  setCursorVisible True = void $ Raw.showCursor 1
-  setCursorVisible False = void $ Raw.showCursor 0
-
-  getCursorVisible :: (Functor m, MonadIO m) => m Bool
-  getCursorVisible = (== 1) <$> Raw.showCursor (-1)
-
--- | Retrieve the current location of the mouse, relative to the currently focused window.
-getAbsoluteMouseLocation :: MonadIO m => m (Point V2 CInt)
-getAbsoluteMouseLocation = liftIO $
-  alloca $ \x ->
-  alloca $ \y -> do
-    _ <- Raw.getMouseState x y -- We don't deal with button states here
-    P <$> (V2 <$> peek x <*> peek y)
-
--- | Retrieve mouse motion
-getRelativeMouseLocation :: MonadIO m => m (V2 CInt)
-getRelativeMouseLocation = liftIO $
-  alloca $ \x ->
-  alloca $ \y -> do
-    _ <- Raw.getRelativeMouseState x y
-    V2 <$> peek x <*> peek y
-
-
--- | Retrieve a mapping of which buttons are currently held down.
-getMouseButtons :: MonadIO m => m (MouseButton -> Bool)
-getMouseButtons = liftIO $
-  convert <$> Raw.getMouseState nullPtr nullPtr
-  where
-    convert w b = w `testBit` fromIntegral (toNumber b)
-
-newtype Cursor = Cursor { unwrapCursor :: Raw.Cursor }
-    deriving (Eq, Typeable)
-
--- | Get or set the currently active cursor. You can create new 'Cursor's with 'createCursor'.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetCursor SDL_SetCursor>@ and @<https://wiki.libsdl.org/SDL_GetCursor SDL_GetCursor>@ for C documentation.
-activeCursor :: StateVar Cursor
-activeCursor = makeStateVar getCursor setCursor
-  where
-  getCursor :: MonadIO m => m Cursor
-  getCursor = liftIO . fmap Cursor $
-      throwIfNull "SDL.Input.Mouse.getCursor" "SDL_getCursor"
-          Raw.getCursor
-
-  setCursor :: MonadIO m => Cursor -> m ()
-  setCursor = Raw.setCursor . unwrapCursor
-
--- | Create a cursor using the specified bitmap data and mask (in MSB format).
---
---
-createCursor :: MonadIO m
-             => V.Vector Bool -- ^ Whether this part of the cursor is black. Use 'False' for white and 'True' for black.
-             -> V.Vector Bool -- ^ Whether or not pixels are visible. Use 'True' for visible and 'False' for transparent.
-             -> V2 CInt -- ^ The width and height of the cursor.
-             -> Point V2 CInt -- ^ The X- and Y-axis location of the upper left corner of the cursor relative to the actual mouse position
-             -> m Cursor
-createCursor dta msk (V2 w h) (P (V2 hx hy)) =
-    liftIO . fmap Cursor $
-        throwIfNull "SDL.Input.Mouse.createCursor" "SDL_createCursor" $
-            V.unsafeWith (V.map (bool 0 1) dta) $ \unsafeDta ->
-            V.unsafeWith (V.map (bool 0 1) msk) $ \unsafeMsk ->
-                Raw.createCursor unsafeDta unsafeMsk w h hx hy
-
--- | Free a cursor created with 'createCursor' and 'createColorCusor'.
---
--- See @<https://wiki.libsdl.org/SDL_FreeCursor SDL_FreeCursor>@ for C documentation.
-freeCursor :: MonadIO m => Cursor -> m ()
-freeCursor = Raw.freeCursor . unwrapCursor
-
--- | Create a color cursor.
---
--- See @<https://wiki.libsdl.org/SDL_CreateColorCursor SDL_CreateColorCursor>@ for C documentation.
-createColorCursor :: MonadIO m
-                  => Surface
-                  -> Point V2 CInt -- ^ The location of the cursor hot spot
-                  -> m Cursor
-createColorCursor (Surface surfPtr _) (P (V2 hx hy)) =
-    liftIO . fmap Cursor $
-        throwIfNull "SDL.Input.Mouse.createColorCursor" "SDL_createColorCursor" $
-            Raw.createColorCursor surfPtr hx hy
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}++module SDL.Input.Mouse+  ( -- * Relative Mouse Mode+    LocationMode(..)+  , setMouseLocationMode+  , getMouseLocationMode++    -- * Mouse and Touch Input+  , MouseButton(..)+  , MouseDevice(..)+  , MouseScrollDirection(..)++    -- * Mouse State+  , getModalMouseLocation+  , getAbsoluteMouseLocation+  , getRelativeMouseLocation+  , getMouseButtons++    -- * Warping the Mouse+  , WarpMouseOrigin(..)+  , warpMouse++    -- * Cursor Visibility+  , cursorVisible++    -- * Cursor Shape+  , Cursor+  , activeCursor+  , createCursor+  , freeCursor+  , createColorCursor+  ) where++import Control.Monad (void)+import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Bits+import Data.Bool+import Data.Data (Data)+import Data.StateVar+import Data.Typeable+import Data.Word+import Foreign.C+import Foreign.Marshal.Alloc+import Foreign.Ptr+import Foreign.Storable+import GHC.Generics (Generic)+import SDL.Vect+import SDL.Internal.Exception+import SDL.Internal.Numbered+import SDL.Internal.Types (Window(Window))+import SDL.Video.Renderer (Surface(Surface))+import qualified Data.Vector.Storable as V+import qualified SDL.Raw.Enum as Raw+import qualified SDL.Raw.Event as Raw+import qualified SDL.Raw.Types as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++data LocationMode+  = AbsoluteLocation+  | RelativeLocation+  deriving (Bounded, Data, Eq, Enum, Generic, Ord, Read, Show, Typeable)++-- | Sets the current relative mouse mode.+--+-- When relative mouse mode is enabled, cursor is hidden and mouse position+-- will not change. However, you will be delivered relative mouse position+-- change events.+setMouseLocationMode :: (Functor m, MonadIO m) => LocationMode -> m LocationMode+setMouseLocationMode mode =+  Raw.setRelativeMouseMode (mode == RelativeLocation) >> getMouseLocationMode++-- | Check which mouse location mode is currently active.+getMouseLocationMode :: MonadIO m => m LocationMode+getMouseLocationMode = do+  relativeMode <- Raw.getRelativeMouseMode+  return $ if relativeMode then RelativeLocation else AbsoluteLocation++data ModalLocation+  = AbsoluteModalLocation (Point V2 CInt)+  | RelativeModalLocation (V2 CInt)+  deriving (Eq, Generic, Ord, Read, Show, Typeable)++-- | Return proper mouse location depending on mouse mode+getModalMouseLocation :: MonadIO m => m ModalLocation+getModalMouseLocation = do+  mode <- getMouseLocationMode+  case mode of+    AbsoluteLocation -> do+      location <- getAbsoluteMouseLocation+      return (AbsoluteModalLocation location)+    RelativeLocation -> do+      location <- getRelativeMouseLocation+      return (RelativeModalLocation location)++data MouseButton+  = ButtonLeft+  | ButtonMiddle+  | ButtonRight+  | ButtonX1+  | ButtonX2+  | ButtonExtra !Int -- ^ An unknown mouse button.+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber MouseButton Word8 where+  fromNumber Raw.SDL_BUTTON_LEFT   = ButtonLeft+  fromNumber Raw.SDL_BUTTON_MIDDLE = ButtonMiddle+  fromNumber Raw.SDL_BUTTON_RIGHT  = ButtonRight+  fromNumber Raw.SDL_BUTTON_X1     = ButtonX1+  fromNumber Raw.SDL_BUTTON_X2     = ButtonX2+  fromNumber buttonCode            = ButtonExtra $ fromIntegral buttonCode++instance ToNumber MouseButton Word8 where+  toNumber ButtonLeft      = Raw.SDL_BUTTON_LEFT+  toNumber ButtonMiddle    = Raw.SDL_BUTTON_MIDDLE+  toNumber ButtonRight     = Raw.SDL_BUTTON_RIGHT+  toNumber ButtonX1        = Raw.SDL_BUTTON_X1+  toNumber ButtonX2        = Raw.SDL_BUTTON_X2+  toNumber (ButtonExtra i) = fromIntegral i++-- | Identifies what kind of mouse-like device this is.+data MouseDevice+  = Mouse !Int -- ^ An actual mouse. The number identifies which mouse.+  | Touch      -- ^ Some sort of touch device.+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber MouseDevice Word32 where+  fromNumber n' = case n' of+    Raw.SDL_TOUCH_MOUSEID -> Touch+    n -> Mouse $ fromIntegral n++-- | Identifies mouse scroll direction.+data MouseScrollDirection+  = ScrollNormal+  | ScrollFlipped+  deriving (Bounded, Data, Eq, Enum, Generic, Ord, Read, Show, Typeable)++instance FromNumber MouseScrollDirection Word32 where+  fromNumber n' = case n' of+    Raw.SDL_MOUSEWHEEL_NORMAL -> ScrollNormal+    Raw.SDL_MOUSEWHEEL_FLIPPED -> ScrollFlipped+    _ -> ScrollNormal++data WarpMouseOrigin+  = WarpInWindow Window+    -- ^ Move the mouse pointer within a given 'Window'.+  | WarpCurrentFocus+    -- ^ Move the mouse pointer within whichever 'Window' currently has focus.+  | WarpGlobal+    -- ^ Move the mouse pointer in global screen space.+  deriving (Data, Eq, Generic, Ord, Show, Typeable)++-- | Move the current location of a mouse pointer. The 'WarpMouseOrigin' specifies the origin for the given warp coordinates.+warpMouse :: MonadIO m => WarpMouseOrigin -> Point V2 CInt -> m ()+warpMouse (WarpInWindow (Window w)) (P (V2 x y)) = Raw.warpMouseInWindow w x y+warpMouse WarpCurrentFocus (P (V2 x y)) = Raw.warpMouseInWindow nullPtr x y+warpMouse WarpGlobal (P (V2 x y)) = throwIfNeg_ "SDL.Mouse.warpMouse" "SDL_WarpMouseGlobal" $+  Raw.warpMouseGlobal x y++-- | Get or set whether the cursor is currently visible.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_ShowCursor SDL_ShowCursor>@ and @<https://wiki.libsdl.org/SDL_HideCursor SDL_HideCursor>@ for C documentation.+cursorVisible :: StateVar Bool+cursorVisible = makeStateVar getCursorVisible setCursorVisible+  where+  -- The usage of 'void' is OK here - Raw.showCursor just returns the old state.+  setCursorVisible :: (Functor m, MonadIO m) => Bool -> m ()+  setCursorVisible True = void $ Raw.showCursor 1+  setCursorVisible False = void $ Raw.showCursor 0++  getCursorVisible :: (Functor m, MonadIO m) => m Bool+  getCursorVisible = (== 1) <$> Raw.showCursor (-1)++-- | Retrieve the current location of the mouse, relative to the currently focused window.+getAbsoluteMouseLocation :: MonadIO m => m (Point V2 CInt)+getAbsoluteMouseLocation = liftIO $+  alloca $ \x ->+  alloca $ \y -> do+    _ <- Raw.getMouseState x y -- We don't deal with button states here+    P <$> (V2 <$> peek x <*> peek y)++-- | Retrieve mouse motion+getRelativeMouseLocation :: MonadIO m => m (V2 CInt)+getRelativeMouseLocation = liftIO $+  alloca $ \x ->+  alloca $ \y -> do+    _ <- Raw.getRelativeMouseState x y+    V2 <$> peek x <*> peek y+++-- | Retrieve a mapping of which buttons are currently held down.+getMouseButtons :: MonadIO m => m (MouseButton -> Bool)+getMouseButtons = liftIO $+  convert <$> Raw.getMouseState nullPtr nullPtr+  where+    convert w b = w `testBit` fromIntegral (toNumber b)++newtype Cursor = Cursor { unwrapCursor :: Raw.Cursor }+    deriving (Eq, Typeable)++-- | Get or set the currently active cursor. You can create new 'Cursor's with 'createCursor'.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetCursor SDL_SetCursor>@ and @<https://wiki.libsdl.org/SDL_GetCursor SDL_GetCursor>@ for C documentation.+activeCursor :: StateVar Cursor+activeCursor = makeStateVar getCursor setCursor+  where+  getCursor :: MonadIO m => m Cursor+  getCursor = liftIO . fmap Cursor $+      throwIfNull "SDL.Input.Mouse.getCursor" "SDL_getCursor"+          Raw.getCursor++  setCursor :: MonadIO m => Cursor -> m ()+  setCursor = Raw.setCursor . unwrapCursor++-- | Create a cursor using the specified bitmap data and mask (in MSB format).+--+--+createCursor :: MonadIO m+             => V.Vector Bool -- ^ Whether this part of the cursor is black. Use 'False' for white and 'True' for black.+             -> V.Vector Bool -- ^ Whether or not pixels are visible. Use 'True' for visible and 'False' for transparent.+             -> V2 CInt -- ^ The width and height of the cursor.+             -> Point V2 CInt -- ^ The X- and Y-axis location of the upper left corner of the cursor relative to the actual mouse position+             -> m Cursor+createCursor dta msk (V2 w h) (P (V2 hx hy)) =+    liftIO . fmap Cursor $+        throwIfNull "SDL.Input.Mouse.createCursor" "SDL_createCursor" $+            V.unsafeWith (V.map (bool 0 1) dta) $ \unsafeDta ->+            V.unsafeWith (V.map (bool 0 1) msk) $ \unsafeMsk ->+                Raw.createCursor unsafeDta unsafeMsk w h hx hy++-- | Free a cursor created with 'createCursor' and 'createColorCusor'.+--+-- See @<https://wiki.libsdl.org/SDL_FreeCursor SDL_FreeCursor>@ for C documentation.+freeCursor :: MonadIO m => Cursor -> m ()+freeCursor = Raw.freeCursor . unwrapCursor++-- | Create a color cursor.+--+-- See @<https://wiki.libsdl.org/SDL_CreateColorCursor SDL_CreateColorCursor>@ for C documentation.+createColorCursor :: MonadIO m+                  => Surface+                  -> Point V2 CInt -- ^ The location of the cursor hot spot+                  -> m Cursor+createColorCursor (Surface surfPtr _) (P (V2 hx hy)) =+    liftIO . fmap Cursor $+        throwIfNull "SDL.Input.Mouse.createColorCursor" "SDL_createColorCursor" $+            Raw.createColorCursor surfPtr hx hy
src/SDL/Internal/Exception.hs view
@@ -1,69 +1,69 @@-{-# LANGUAGE CPP #-}
-
-module SDL.Internal.Exception
-  ( fromC
-  , getError
-  , throwIf
-  , throwIf_
-  , throwIf0
-  , throwIfNeg
-  , throwIfNeg_
-  , throwIfNot0
-  , throwIfNot0_
-  , throwIfNull
-  ) where
-
-import Control.Exception
-import Data.Maybe (fromMaybe)
-import Control.Monad
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Text (Text)
-import Foreign (Ptr, nullPtr)
-import SDL.Exception
-import qualified Data.ByteString as BS
-import qualified Data.Text.Encoding as Text
-import qualified SDL.Raw as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
-getError :: MonadIO m => m Text
-getError = liftIO $ do
-  cstr <- Raw.getError
-  Text.decodeUtf8 <$> BS.packCString cstr
-
-throwIf :: MonadIO m => (a -> Bool) -> Text -> Text -> m a -> m a
-throwIf f caller funName m = do
-  a <- m
-  liftIO $ when (f a) $
-    (SDLCallFailed caller funName <$> getError) >>= throwIO
-  return a
-
-throwIf_ :: MonadIO m => (a -> Bool) -> Text -> Text -> m a -> m ()
-throwIf_ f caller funName m = throwIf f caller funName m >> return ()
-
-throwIfNeg :: (MonadIO m, Num a, Ord a) => Text -> Text -> m a -> m a
-throwIfNeg = throwIf (< 0)
-
-throwIfNeg_ :: (MonadIO m, Num a, Ord a) => Text -> Text -> m a -> m ()
-throwIfNeg_ = throwIf_ (< 0)
-
-throwIfNull :: (MonadIO m) => Text -> Text -> m (Ptr a) -> m (Ptr a)
-throwIfNull = throwIf (== nullPtr)
-
-throwIf0 :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m a
-throwIf0 = throwIf (== 0)
-
-throwIfNot0 :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m a
-throwIfNot0 = throwIf (/= 0)
-
-throwIfNot0_ :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m ()
-throwIfNot0_ = throwIf_ (/= 0)
-
-fromC :: Show a => Text -> Text -> (a -> Maybe b) -> a -> b
-fromC caller funName f x =
-  fromMaybe (throw (SDLUnexpectedArgument caller
-                                          funName
-                                          (show x)))
-            (f x)
+{-# LANGUAGE CPP #-}++module SDL.Internal.Exception+  ( fromC+  , getError+  , throwIf+  , throwIf_+  , throwIf0+  , throwIfNeg+  , throwIfNeg_+  , throwIfNot0+  , throwIfNot0_+  , throwIfNull+  ) where++import Control.Exception+import Data.Maybe (fromMaybe)+import Control.Monad+import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Text (Text)+import Foreign (Ptr, nullPtr)+import SDL.Exception+import qualified Data.ByteString as BS+import qualified Data.Text.Encoding as Text+import qualified SDL.Raw as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++getError :: MonadIO m => m Text+getError = liftIO $ do+  cstr <- Raw.getError+  Text.decodeUtf8 <$> BS.packCString cstr++throwIf :: MonadIO m => (a -> Bool) -> Text -> Text -> m a -> m a+throwIf f caller funName m = do+  a <- m+  liftIO $ when (f a) $+    (SDLCallFailed caller funName <$> getError) >>= throwIO+  return a++throwIf_ :: MonadIO m => (a -> Bool) -> Text -> Text -> m a -> m ()+throwIf_ f caller funName m = throwIf f caller funName m >> return ()++throwIfNeg :: (MonadIO m, Num a, Ord a) => Text -> Text -> m a -> m a+throwIfNeg = throwIf (< 0)++throwIfNeg_ :: (MonadIO m, Num a, Ord a) => Text -> Text -> m a -> m ()+throwIfNeg_ = throwIf_ (< 0)++throwIfNull :: (MonadIO m) => Text -> Text -> m (Ptr a) -> m (Ptr a)+throwIfNull = throwIf (== nullPtr)++throwIf0 :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m a+throwIf0 = throwIf (== 0)++throwIfNot0 :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m a+throwIfNot0 = throwIf (/= 0)++throwIfNot0_ :: (Eq a, MonadIO m, Num a) => Text -> Text -> m a -> m ()+throwIfNot0_ = throwIf_ (/= 0)++fromC :: Show a => Text -> Text -> (a -> Maybe b) -> a -> b+fromC caller funName f x =+  fromMaybe (throw (SDLUnexpectedArgument caller+                                          funName+                                          (show x)))+            (f x)
src/SDL/Internal/Numbered.hs view
@@ -1,11 +1,11 @@-{-# LANGUAGE FunctionalDependencies #-}
-module SDL.Internal.Numbered
-  ( FromNumber(..)
-  , ToNumber(..)
-  ) where
-
-class (Integral b) => FromNumber a b | a -> b where
-  fromNumber :: b -> a
-
-class (Integral b) => ToNumber a b | a -> b where
-  toNumber :: a -> b
+{-# LANGUAGE FunctionalDependencies #-}+module SDL.Internal.Numbered+  ( FromNumber(..)+  , ToNumber(..)+  ) where++class (Integral b) => FromNumber a b | a -> b where+  fromNumber :: b -> a++class (Integral b) => ToNumber a b | a -> b where+  toNumber :: a -> b
src/SDL/Internal/Types.hs view
@@ -1,23 +1,23 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-module SDL.Internal.Types
-  ( Joystick(..)
-  , Window(..)
-  , Renderer(..)
-  ) where
-
-import Data.Data (Data)
-import Data.Typeable
-import GHC.Generics (Generic)
-
-import qualified SDL.Raw as Raw
-
-newtype Joystick = Joystick { joystickPtr :: Raw.Joystick }
-  deriving (Data, Eq, Generic, Ord, Show, Typeable)
-
-newtype Window = Window (Raw.Window)
-  deriving (Data, Eq, Generic, Ord, Show, Typeable)
-
--- | An SDL rendering device. This can be created with 'SDL.Video.createRenderer'.
-newtype Renderer = Renderer Raw.Renderer
-  deriving (Data, Eq, Generic, Ord, Show, Typeable)
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+module SDL.Internal.Types+  ( Joystick(..)+  , Window(..)+  , Renderer(..)+  ) where++import Data.Data (Data)+import Data.Typeable+import GHC.Generics (Generic)++import qualified SDL.Raw as Raw++newtype Joystick = Joystick { joystickPtr :: Raw.Joystick }+  deriving (Data, Eq, Generic, Ord, Show, Typeable)++newtype Window = Window (Raw.Window)+  deriving (Data, Eq, Generic, Ord, Show, Typeable)++-- | An SDL rendering device. This can be created with 'SDL.Video.createRenderer'.+newtype Renderer = Renderer Raw.Renderer+  deriving (Data, Eq, Generic, Ord, Show, Typeable)
src/SDL/Power.hs view
@@ -1,70 +1,70 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-module SDL.Power
-  ( -- * Power Status
-    getPowerInfo
-  , PowerState(..)
-  , BatteryState(..)
-  , Charge(..)
-  ) where
-
-import Control.Applicative
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Data (Data)
-import Data.Typeable
-import Foreign.C.Types
-import Foreign.Marshal.Alloc
-import Foreign.Marshal.Utils
-import Foreign.Storable
-import GHC.Generics (Generic)
-
-import qualified SDL.Raw as Raw
-
--- | Current power supply details.
---
--- Throws 'SDLException' if the current power state can not be determined.
---
--- See @<https://wiki.libsdl.org/SDL_GetPowerInfo SDL_GetPowerInfo>@ for C documentation.
-getPowerInfo :: (Functor m, MonadIO m) => m PowerState
-getPowerInfo =
-  liftIO $
-  alloca $ \secsPtr ->
-  alloca $ \pctPtr -> do
-    state <- Raw.getPowerInfo secsPtr pctPtr
-    let peekCharge = liftA2 Charge (maybePeek peek secsPtr) (maybePeek peek pctPtr)
-    case state of
-     Raw.SDL_POWERSTATE_ON_BATTERY -> fmap (Battery Draining) peekCharge
-     Raw.SDL_POWERSTATE_CHARGING -> fmap (Battery Charging) peekCharge
-     Raw.SDL_POWERSTATE_CHARGED -> fmap (Battery Charged) peekCharge
-     Raw.SDL_POWERSTATE_NO_BATTERY -> pure Mains
-     _ -> pure UnknownPowerState
-
--- | Information about the power supply for the user's environment
-data PowerState
-  = Battery BatteryState Charge
-    -- ^ The user is on a battery powered device. See 'BatteryState' for charge information, and 'Charge' for charge information
-  | Mains
-    -- ^ The user is on a device connected to the mains.
-  | UnknownPowerState
-    -- ^ SDL could not determine the power for the device.
-  deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Information on battery consumption for battery powered devices
-data BatteryState
-  = Draining
-    -- ^ The battery is currently being drained.
-  | Charged
-    -- ^ The battery is fully charged.
-  | Charging
-    -- ^ The device is plugged in and the battery is charging.
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Information about how much charge a battery has.
-data Charge =
-  Charge {chargeSecondsLeft :: Maybe CInt -- ^ How many seconds of battery life is left
-         ,chargePercent :: Maybe CInt -- ^ The percentage of battery charged
-         }
-  deriving (Eq, Generic, Ord, Read, Show, Typeable)
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}+module SDL.Power+  ( -- * Power Status+    getPowerInfo+  , PowerState(..)+  , BatteryState(..)+  , Charge(..)+  ) where++import Control.Applicative+import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Data (Data)+import Data.Typeable+import Foreign.C.Types+import Foreign.Marshal.Alloc+import Foreign.Marshal.Utils+import Foreign.Storable+import GHC.Generics (Generic)++import qualified SDL.Raw as Raw++-- | Current power supply details.+--+-- Throws 'SDLException' if the current power state can not be determined.+--+-- See @<https://wiki.libsdl.org/SDL_GetPowerInfo SDL_GetPowerInfo>@ for C documentation.+getPowerInfo :: (Functor m, MonadIO m) => m PowerState+getPowerInfo =+  liftIO $+  alloca $ \secsPtr ->+  alloca $ \pctPtr -> do+    state <- Raw.getPowerInfo secsPtr pctPtr+    let peekCharge = liftA2 Charge (maybePeek peek secsPtr) (maybePeek peek pctPtr)+    case state of+     Raw.SDL_POWERSTATE_ON_BATTERY -> fmap (Battery Draining) peekCharge+     Raw.SDL_POWERSTATE_CHARGING -> fmap (Battery Charging) peekCharge+     Raw.SDL_POWERSTATE_CHARGED -> fmap (Battery Charged) peekCharge+     Raw.SDL_POWERSTATE_NO_BATTERY -> pure Mains+     _ -> pure UnknownPowerState++-- | Information about the power supply for the user's environment+data PowerState+  = Battery BatteryState Charge+    -- ^ The user is on a battery powered device. See 'BatteryState' for charge information, and 'Charge' for charge information+  | Mains+    -- ^ The user is on a device connected to the mains.+  | UnknownPowerState+    -- ^ SDL could not determine the power for the device.+  deriving (Eq, Generic, Ord, Read, Show, Typeable)++-- | Information on battery consumption for battery powered devices+data BatteryState+  = Draining+    -- ^ The battery is currently being drained.+  | Charged+    -- ^ The battery is fully charged.+  | Charging+    -- ^ The device is plugged in and the battery is charging.+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++-- | Information about how much charge a battery has.+data Charge =+  Charge {chargeSecondsLeft :: Maybe CInt -- ^ How many seconds of battery life is left+         ,chargePercent :: Maybe CInt -- ^ The percentage of battery charged+         }+  deriving (Eq, Generic, Ord, Read, Show, Typeable)
src/SDL/Raw.hs view
@@ -1,31 +1,31 @@--- | Raw low-level FFI bindings to the sdl2 C library. Ease of use is not a
--- design factor, use "SDL" instead if you can.
-module SDL.Raw (
-  module SDL.Raw.Audio,
-  module SDL.Raw.Basic,
-  module SDL.Raw.Enum,
-  module SDL.Raw.Error,
-  module SDL.Raw.Event,
-  module SDL.Raw.Filesystem,
-  module SDL.Raw.Haptic,
-  module SDL.Raw.Platform,
-  module SDL.Raw.Power,
-  module SDL.Raw.Thread,
-  module SDL.Raw.Timer,
-  module SDL.Raw.Types,
-  module SDL.Raw.Video
-) where
-
-import SDL.Raw.Audio
-import SDL.Raw.Basic
-import SDL.Raw.Enum
-import SDL.Raw.Error
-import SDL.Raw.Event
-import SDL.Raw.Filesystem
-import SDL.Raw.Haptic
-import SDL.Raw.Platform
-import SDL.Raw.Power
-import SDL.Raw.Thread
-import SDL.Raw.Timer
-import SDL.Raw.Types
-import SDL.Raw.Video
+-- | Raw low-level FFI bindings to the sdl2 C library. Ease of use is not a+-- design factor, use "SDL" instead if you can.+module SDL.Raw (+  module SDL.Raw.Audio,+  module SDL.Raw.Basic,+  module SDL.Raw.Enum,+  module SDL.Raw.Error,+  module SDL.Raw.Event,+  module SDL.Raw.Filesystem,+  module SDL.Raw.Haptic,+  module SDL.Raw.Platform,+  module SDL.Raw.Power,+  module SDL.Raw.Thread,+  module SDL.Raw.Timer,+  module SDL.Raw.Types,+  module SDL.Raw.Video+) where++import SDL.Raw.Audio+import SDL.Raw.Basic+import SDL.Raw.Enum+import SDL.Raw.Error+import SDL.Raw.Event+import SDL.Raw.Filesystem+import SDL.Raw.Haptic+import SDL.Raw.Platform+import SDL.Raw.Power+import SDL.Raw.Thread+import SDL.Raw.Timer+import SDL.Raw.Types+import SDL.Raw.Video
src/SDL/Raw/Audio.hs view
@@ -1,188 +1,188 @@-module SDL.Raw.Audio (
-  -- * Audio Device Management, Playing and Recording
-  audioInit,
-  audioQuit,
-  buildAudioCVT,
-  clearQueuedAudio,
-  closeAudio,
-  closeAudioDevice,
-  convertAudio,
-  freeWAV,
-  getAudioDeviceName,
-  getAudioDeviceStatus,
-  getAudioDriver,
-  getAudioStatus,
-  getCurrentAudioDriver,
-  getNumAudioDevices,
-  getNumAudioDrivers,
-  getQueuedAudioSize,
-  loadWAV,
-  loadWAV_RW,
-  lockAudio,
-  lockAudioDevice,
-  mixAudio,
-  mixAudioFormat,
-  openAudio,
-  openAudioDevice,
-  pauseAudio,
-  pauseAudioDevice,
-  queueAudio,
-  unlockAudio,
-  unlockAudioDevice
-) where
-
-import Control.Monad.IO.Class
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Enum
-import SDL.Raw.Filesystem
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_AudioInit" audioInitFFI :: CString -> IO CInt
-foreign import ccall "SDL.h SDL_AudioQuit" audioQuitFFI :: IO ()
-foreign import ccall "SDL.h SDL_BuildAudioCVT" buildAudioCVTFFI :: Ptr AudioCVT -> AudioFormat -> Word8 -> CInt -> AudioFormat -> Word8 -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_ClearQueuedAudio" clearQueuedAudioFFI :: AudioDeviceID -> IO ()
-foreign import ccall "SDL.h SDL_CloseAudio" closeAudioFFI :: IO ()
-foreign import ccall "SDL.h SDL_CloseAudioDevice" closeAudioDeviceFFI :: AudioDeviceID -> IO ()
-foreign import ccall "SDL.h SDL_ConvertAudio" convertAudioFFI :: Ptr AudioCVT -> IO CInt
-foreign import ccall "SDL.h SDL_FreeWAV" freeWAVFFI :: Ptr Word8 -> IO ()
-foreign import ccall "SDL.h SDL_GetAudioDeviceName" getAudioDeviceNameFFI :: CInt -> CInt -> IO CString
-foreign import ccall "SDL.h SDL_GetAudioDeviceStatus" getAudioDeviceStatusFFI :: AudioDeviceID -> IO AudioStatus
-foreign import ccall "SDL.h SDL_GetAudioDriver" getAudioDriverFFI :: CInt -> IO CString
-foreign import ccall "SDL.h SDL_GetAudioStatus" getAudioStatusFFI :: IO AudioStatus
-foreign import ccall "SDL.h SDL_GetCurrentAudioDriver" getCurrentAudioDriverFFI :: IO CString
-foreign import ccall "SDL.h SDL_GetNumAudioDevices" getNumAudioDevicesFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GetNumAudioDrivers" getNumAudioDriversFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GetQueuedAudioSize" getQueuedAudioSizeFFI :: AudioDeviceID -> IO Word32
-foreign import ccall "SDL.h SDL_LoadWAV_RW" loadWAV_RWFFI :: Ptr RWops -> CInt -> Ptr AudioSpec -> Ptr (Ptr Word8) -> Ptr Word32 -> IO (Ptr AudioSpec)
-foreign import ccall "SDL.h SDL_LockAudio" lockAudioFFI :: IO ()
-foreign import ccall "SDL.h SDL_LockAudioDevice" lockAudioDeviceFFI :: AudioDeviceID -> IO ()
-foreign import ccall "SDL.h SDL_MixAudio" mixAudioFFI :: Ptr Word8 -> Ptr Word8 -> Word32 -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_MixAudioFormat" mixAudioFormatFFI :: Ptr Word8 -> Ptr Word8 -> AudioFormat -> Word32 -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_OpenAudio" openAudioFFI :: Ptr AudioSpec -> Ptr AudioSpec -> IO CInt
-foreign import ccall "SDL.h SDL_OpenAudioDevice" openAudioDeviceFFI :: CString -> CInt -> Ptr AudioSpec -> Ptr AudioSpec -> CInt -> IO AudioDeviceID
-foreign import ccall "SDL.h SDL_PauseAudio" pauseAudioFFI :: CInt -> IO ()
-foreign import ccall "SDL.h SDL_PauseAudioDevice" pauseAudioDeviceFFI :: AudioDeviceID -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_QueueAudio" queueAudioFFI :: AudioDeviceID -> Ptr () -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_UnlockAudio" unlockAudioFFI :: IO ()
-foreign import ccall "SDL.h SDL_UnlockAudioDevice" unlockAudioDeviceFFI :: AudioDeviceID -> IO ()
-
-audioInit :: MonadIO m => CString -> m CInt
-audioInit v1 = liftIO $ audioInitFFI v1
-{-# INLINE audioInit #-}
-
-audioQuit :: MonadIO m => m ()
-audioQuit = liftIO audioQuitFFI
-{-# INLINE audioQuit #-}
-
-buildAudioCVT :: MonadIO m => Ptr AudioCVT -> AudioFormat -> Word8 -> CInt -> AudioFormat -> Word8 -> CInt -> m CInt
-buildAudioCVT v1 v2 v3 v4 v5 v6 v7 = liftIO $ buildAudioCVTFFI v1 v2 v3 v4 v5 v6 v7
-{-# INLINE buildAudioCVT #-}
-
-clearQueuedAudio :: MonadIO m => AudioDeviceID -> m ()
-clearQueuedAudio v1 = liftIO $ clearQueuedAudioFFI v1
-{-# INLINE clearQueuedAudio #-}
-
-closeAudio :: MonadIO m => m ()
-closeAudio = liftIO closeAudioFFI
-{-# INLINE closeAudio #-}
-
-closeAudioDevice :: MonadIO m => AudioDeviceID -> m ()
-closeAudioDevice v1 = liftIO $ closeAudioDeviceFFI v1
-{-# INLINE closeAudioDevice #-}
-
-convertAudio :: MonadIO m => Ptr AudioCVT -> m CInt
-convertAudio v1 = liftIO $ convertAudioFFI v1
-{-# INLINE convertAudio #-}
-
-freeWAV :: MonadIO m => Ptr Word8 -> m ()
-freeWAV v1 = liftIO $ freeWAVFFI v1
-{-# INLINE freeWAV #-}
-
-getAudioDeviceName :: MonadIO m => CInt -> CInt -> m CString
-getAudioDeviceName v1 v2 = liftIO $ getAudioDeviceNameFFI v1 v2
-{-# INLINE getAudioDeviceName #-}
-
-getAudioDeviceStatus :: MonadIO m => AudioDeviceID -> m AudioStatus
-getAudioDeviceStatus v1 = liftIO $ getAudioDeviceStatusFFI v1
-{-# INLINE getAudioDeviceStatus #-}
-
-getAudioDriver :: MonadIO m => CInt -> m CString
-getAudioDriver v1 = liftIO $ getAudioDriverFFI v1
-{-# INLINE getAudioDriver #-}
-
-getAudioStatus :: MonadIO m => m AudioStatus
-getAudioStatus = liftIO getAudioStatusFFI
-{-# INLINE getAudioStatus #-}
-
-getCurrentAudioDriver :: MonadIO m => m CString
-getCurrentAudioDriver = liftIO getCurrentAudioDriverFFI
-{-# INLINE getCurrentAudioDriver #-}
-
-getNumAudioDevices :: MonadIO m => CInt -> m CInt
-getNumAudioDevices v1 = liftIO $ getNumAudioDevicesFFI v1
-{-# INLINE getNumAudioDevices #-}
-
-getNumAudioDrivers :: MonadIO m => m CInt
-getNumAudioDrivers = liftIO getNumAudioDriversFFI
-{-# INLINE getNumAudioDrivers #-}
-
-getQueuedAudioSize :: MonadIO m => AudioDeviceID -> m Word32
-getQueuedAudioSize v1 = liftIO $ getQueuedAudioSizeFFI v1
-{-# INLINE getQueuedAudioSize #-}
-
-loadWAV :: MonadIO m => CString -> Ptr AudioSpec -> Ptr (Ptr Word8) -> Ptr Word32 -> m (Ptr AudioSpec)
-loadWAV file spec audio_buf audio_len = liftIO $ do
-  rw <- withCString "rb" $ rwFromFile file
-  loadWAV_RW rw 1 spec audio_buf audio_len
-{-# INLINE loadWAV #-}
-
-loadWAV_RW :: MonadIO m => Ptr RWops -> CInt -> Ptr AudioSpec -> Ptr (Ptr Word8) -> Ptr Word32 -> m (Ptr AudioSpec)
-loadWAV_RW v1 v2 v3 v4 v5 = liftIO $ loadWAV_RWFFI v1 v2 v3 v4 v5
-{-# INLINE loadWAV_RW #-}
-
-lockAudio :: MonadIO m => m ()
-lockAudio = liftIO lockAudioFFI
-{-# INLINE lockAudio #-}
-
-lockAudioDevice :: MonadIO m => AudioDeviceID -> m ()
-lockAudioDevice v1 = liftIO $ lockAudioDeviceFFI v1
-{-# INLINE lockAudioDevice #-}
-
-mixAudio :: MonadIO m => Ptr Word8 -> Ptr Word8 -> Word32 -> CInt -> m ()
-mixAudio v1 v2 v3 v4 = liftIO $ mixAudioFFI v1 v2 v3 v4
-{-# INLINE mixAudio #-}
-
-mixAudioFormat :: MonadIO m => Ptr Word8 -> Ptr Word8 -> AudioFormat -> Word32 -> CInt -> m ()
-mixAudioFormat v1 v2 v3 v4 v5 = liftIO $ mixAudioFormatFFI v1 v2 v3 v4 v5
-{-# INLINE mixAudioFormat #-}
-
-openAudio :: MonadIO m => Ptr AudioSpec -> Ptr AudioSpec -> m CInt
-openAudio v1 v2 = liftIO $ openAudioFFI v1 v2
-{-# INLINE openAudio #-}
-
-openAudioDevice :: MonadIO m => CString -> CInt -> Ptr AudioSpec -> Ptr AudioSpec -> CInt -> m AudioDeviceID
-openAudioDevice v1 v2 v3 v4 v5 = liftIO $ openAudioDeviceFFI v1 v2 v3 v4 v5
-{-# INLINE openAudioDevice #-}
-
-pauseAudio :: MonadIO m => CInt -> m ()
-pauseAudio v1 = liftIO $ pauseAudioFFI v1
-{-# INLINE pauseAudio #-}
-
-pauseAudioDevice :: MonadIO m => AudioDeviceID -> CInt -> m ()
-pauseAudioDevice v1 v2 = liftIO $ pauseAudioDeviceFFI v1 v2
-{-# INLINE pauseAudioDevice #-}
-
-queueAudio :: MonadIO m => AudioDeviceID -> Ptr () -> Word32 -> m CInt
-queueAudio v1 v2 v3 = liftIO $ queueAudioFFI v1 v2 v3
-{-# INLINE queueAudio #-}
-
-unlockAudio :: MonadIO m => m ()
-unlockAudio = liftIO unlockAudioFFI
-{-# INLINE unlockAudio #-}
-
-unlockAudioDevice :: MonadIO m => AudioDeviceID -> m ()
-unlockAudioDevice v1 = liftIO $ unlockAudioDeviceFFI v1
-{-# INLINE unlockAudioDevice #-}
+module SDL.Raw.Audio (+  -- * Audio Device Management, Playing and Recording+  audioInit,+  audioQuit,+  buildAudioCVT,+  clearQueuedAudio,+  closeAudio,+  closeAudioDevice,+  convertAudio,+  freeWAV,+  getAudioDeviceName,+  getAudioDeviceStatus,+  getAudioDriver,+  getAudioStatus,+  getCurrentAudioDriver,+  getNumAudioDevices,+  getNumAudioDrivers,+  getQueuedAudioSize,+  loadWAV,+  loadWAV_RW,+  lockAudio,+  lockAudioDevice,+  mixAudio,+  mixAudioFormat,+  openAudio,+  openAudioDevice,+  pauseAudio,+  pauseAudioDevice,+  queueAudio,+  unlockAudio,+  unlockAudioDevice+) where++import Control.Monad.IO.Class+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Enum+import SDL.Raw.Filesystem+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_AudioInit" audioInitFFI :: CString -> IO CInt+foreign import ccall "SDL.h SDL_AudioQuit" audioQuitFFI :: IO ()+foreign import ccall "SDL.h SDL_BuildAudioCVT" buildAudioCVTFFI :: Ptr AudioCVT -> AudioFormat -> Word8 -> CInt -> AudioFormat -> Word8 -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_ClearQueuedAudio" clearQueuedAudioFFI :: AudioDeviceID -> IO ()+foreign import ccall "SDL.h SDL_CloseAudio" closeAudioFFI :: IO ()+foreign import ccall "SDL.h SDL_CloseAudioDevice" closeAudioDeviceFFI :: AudioDeviceID -> IO ()+foreign import ccall "SDL.h SDL_ConvertAudio" convertAudioFFI :: Ptr AudioCVT -> IO CInt+foreign import ccall "SDL.h SDL_FreeWAV" freeWAVFFI :: Ptr Word8 -> IO ()+foreign import ccall "SDL.h SDL_GetAudioDeviceName" getAudioDeviceNameFFI :: CInt -> CInt -> IO CString+foreign import ccall "SDL.h SDL_GetAudioDeviceStatus" getAudioDeviceStatusFFI :: AudioDeviceID -> IO AudioStatus+foreign import ccall "SDL.h SDL_GetAudioDriver" getAudioDriverFFI :: CInt -> IO CString+foreign import ccall "SDL.h SDL_GetAudioStatus" getAudioStatusFFI :: IO AudioStatus+foreign import ccall "SDL.h SDL_GetCurrentAudioDriver" getCurrentAudioDriverFFI :: IO CString+foreign import ccall "SDL.h SDL_GetNumAudioDevices" getNumAudioDevicesFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_GetNumAudioDrivers" getNumAudioDriversFFI :: IO CInt+foreign import ccall "SDL.h SDL_GetQueuedAudioSize" getQueuedAudioSizeFFI :: AudioDeviceID -> IO Word32+foreign import ccall "SDL.h SDL_LoadWAV_RW" loadWAV_RWFFI :: Ptr RWops -> CInt -> Ptr AudioSpec -> Ptr (Ptr Word8) -> Ptr Word32 -> IO (Ptr AudioSpec)+foreign import ccall "SDL.h SDL_LockAudio" lockAudioFFI :: IO ()+foreign import ccall "SDL.h SDL_LockAudioDevice" lockAudioDeviceFFI :: AudioDeviceID -> IO ()+foreign import ccall "SDL.h SDL_MixAudio" mixAudioFFI :: Ptr Word8 -> Ptr Word8 -> Word32 -> CInt -> IO ()+foreign import ccall "SDL.h SDL_MixAudioFormat" mixAudioFormatFFI :: Ptr Word8 -> Ptr Word8 -> AudioFormat -> Word32 -> CInt -> IO ()+foreign import ccall "SDL.h SDL_OpenAudio" openAudioFFI :: Ptr AudioSpec -> Ptr AudioSpec -> IO CInt+foreign import ccall "SDL.h SDL_OpenAudioDevice" openAudioDeviceFFI :: CString -> CInt -> Ptr AudioSpec -> Ptr AudioSpec -> CInt -> IO AudioDeviceID+foreign import ccall "SDL.h SDL_PauseAudio" pauseAudioFFI :: CInt -> IO ()+foreign import ccall "SDL.h SDL_PauseAudioDevice" pauseAudioDeviceFFI :: AudioDeviceID -> CInt -> IO ()+foreign import ccall "SDL.h SDL_QueueAudio" queueAudioFFI :: AudioDeviceID -> Ptr () -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_UnlockAudio" unlockAudioFFI :: IO ()+foreign import ccall "SDL.h SDL_UnlockAudioDevice" unlockAudioDeviceFFI :: AudioDeviceID -> IO ()++audioInit :: MonadIO m => CString -> m CInt+audioInit v1 = liftIO $ audioInitFFI v1+{-# INLINE audioInit #-}++audioQuit :: MonadIO m => m ()+audioQuit = liftIO audioQuitFFI+{-# INLINE audioQuit #-}++buildAudioCVT :: MonadIO m => Ptr AudioCVT -> AudioFormat -> Word8 -> CInt -> AudioFormat -> Word8 -> CInt -> m CInt+buildAudioCVT v1 v2 v3 v4 v5 v6 v7 = liftIO $ buildAudioCVTFFI v1 v2 v3 v4 v5 v6 v7+{-# INLINE buildAudioCVT #-}++clearQueuedAudio :: MonadIO m => AudioDeviceID -> m ()+clearQueuedAudio v1 = liftIO $ clearQueuedAudioFFI v1+{-# INLINE clearQueuedAudio #-}++closeAudio :: MonadIO m => m ()+closeAudio = liftIO closeAudioFFI+{-# INLINE closeAudio #-}++closeAudioDevice :: MonadIO m => AudioDeviceID -> m ()+closeAudioDevice v1 = liftIO $ closeAudioDeviceFFI v1+{-# INLINE closeAudioDevice #-}++convertAudio :: MonadIO m => Ptr AudioCVT -> m CInt+convertAudio v1 = liftIO $ convertAudioFFI v1+{-# INLINE convertAudio #-}++freeWAV :: MonadIO m => Ptr Word8 -> m ()+freeWAV v1 = liftIO $ freeWAVFFI v1+{-# INLINE freeWAV #-}++getAudioDeviceName :: MonadIO m => CInt -> CInt -> m CString+getAudioDeviceName v1 v2 = liftIO $ getAudioDeviceNameFFI v1 v2+{-# INLINE getAudioDeviceName #-}++getAudioDeviceStatus :: MonadIO m => AudioDeviceID -> m AudioStatus+getAudioDeviceStatus v1 = liftIO $ getAudioDeviceStatusFFI v1+{-# INLINE getAudioDeviceStatus #-}++getAudioDriver :: MonadIO m => CInt -> m CString+getAudioDriver v1 = liftIO $ getAudioDriverFFI v1+{-# INLINE getAudioDriver #-}++getAudioStatus :: MonadIO m => m AudioStatus+getAudioStatus = liftIO getAudioStatusFFI+{-# INLINE getAudioStatus #-}++getCurrentAudioDriver :: MonadIO m => m CString+getCurrentAudioDriver = liftIO getCurrentAudioDriverFFI+{-# INLINE getCurrentAudioDriver #-}++getNumAudioDevices :: MonadIO m => CInt -> m CInt+getNumAudioDevices v1 = liftIO $ getNumAudioDevicesFFI v1+{-# INLINE getNumAudioDevices #-}++getNumAudioDrivers :: MonadIO m => m CInt+getNumAudioDrivers = liftIO getNumAudioDriversFFI+{-# INLINE getNumAudioDrivers #-}++getQueuedAudioSize :: MonadIO m => AudioDeviceID -> m Word32+getQueuedAudioSize v1 = liftIO $ getQueuedAudioSizeFFI v1+{-# INLINE getQueuedAudioSize #-}++loadWAV :: MonadIO m => CString -> Ptr AudioSpec -> Ptr (Ptr Word8) -> Ptr Word32 -> m (Ptr AudioSpec)+loadWAV file spec audio_buf audio_len = liftIO $ do+  rw <- withCString "rb" $ rwFromFile file+  loadWAV_RW rw 1 spec audio_buf audio_len+{-# INLINE loadWAV #-}++loadWAV_RW :: MonadIO m => Ptr RWops -> CInt -> Ptr AudioSpec -> Ptr (Ptr Word8) -> Ptr Word32 -> m (Ptr AudioSpec)+loadWAV_RW v1 v2 v3 v4 v5 = liftIO $ loadWAV_RWFFI v1 v2 v3 v4 v5+{-# INLINE loadWAV_RW #-}++lockAudio :: MonadIO m => m ()+lockAudio = liftIO lockAudioFFI+{-# INLINE lockAudio #-}++lockAudioDevice :: MonadIO m => AudioDeviceID -> m ()+lockAudioDevice v1 = liftIO $ lockAudioDeviceFFI v1+{-# INLINE lockAudioDevice #-}++mixAudio :: MonadIO m => Ptr Word8 -> Ptr Word8 -> Word32 -> CInt -> m ()+mixAudio v1 v2 v3 v4 = liftIO $ mixAudioFFI v1 v2 v3 v4+{-# INLINE mixAudio #-}++mixAudioFormat :: MonadIO m => Ptr Word8 -> Ptr Word8 -> AudioFormat -> Word32 -> CInt -> m ()+mixAudioFormat v1 v2 v3 v4 v5 = liftIO $ mixAudioFormatFFI v1 v2 v3 v4 v5+{-# INLINE mixAudioFormat #-}++openAudio :: MonadIO m => Ptr AudioSpec -> Ptr AudioSpec -> m CInt+openAudio v1 v2 = liftIO $ openAudioFFI v1 v2+{-# INLINE openAudio #-}++openAudioDevice :: MonadIO m => CString -> CInt -> Ptr AudioSpec -> Ptr AudioSpec -> CInt -> m AudioDeviceID+openAudioDevice v1 v2 v3 v4 v5 = liftIO $ openAudioDeviceFFI v1 v2 v3 v4 v5+{-# INLINE openAudioDevice #-}++pauseAudio :: MonadIO m => CInt -> m ()+pauseAudio v1 = liftIO $ pauseAudioFFI v1+{-# INLINE pauseAudio #-}++pauseAudioDevice :: MonadIO m => AudioDeviceID -> CInt -> m ()+pauseAudioDevice v1 v2 = liftIO $ pauseAudioDeviceFFI v1 v2+{-# INLINE pauseAudioDevice #-}++queueAudio :: MonadIO m => AudioDeviceID -> Ptr () -> Word32 -> m CInt+queueAudio v1 v2 v3 = liftIO $ queueAudioFFI v1 v2 v3+{-# INLINE queueAudio #-}++unlockAudio :: MonadIO m => m ()+unlockAudio = liftIO unlockAudioFFI+{-# INLINE unlockAudio #-}++unlockAudioDevice :: MonadIO m => AudioDeviceID -> m ()+unlockAudioDevice v1 = liftIO $ unlockAudioDeviceFFI v1+{-# INLINE unlockAudioDevice #-}
src/SDL/Raw/Basic.hs view
@@ -1,200 +1,200 @@-module SDL.Raw.Basic (
-  -- * Initialization and Shutdown
-  init,
-  initSubSystem,
-  quit,
-  quitSubSystem,
-  setMainReady,
-  wasInit,
-
-  -- * Memory Management
-  free,
-
-  -- * Configuration Variables
-  addHintCallback,
-  clearHints,
-  delHintCallback,
-  getHint,
-  setHint,
-  setHintWithPriority,
-
-  -- * Log Handling
-  log,
-  logCritical,
-  logDebug,
-  logError,
-  logGetOutputFunction,
-  logGetPriority,
-  logInfo,
-  logMessage,
-  logResetPriorities,
-  logSetAllPriority,
-  logSetOutputFunction,
-  logSetPriority,
-  logVerbose,
-  logWarn,
-
-  -- * Assertions
-  -- | Use Haskell's own assertion primitives rather than SDL's.
-
-  -- * Querying SDL Version
-  getRevision,
-  getRevisionNumber,
-  getVersion
-) where
-
-import Control.Monad.IO.Class
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Enum
-import SDL.Raw.Types
-import Prelude hiding (init, log)
-
-foreign import ccall "SDL.h SDL_Init" initFFI :: InitFlag -> IO CInt
-foreign import ccall "SDL.h SDL_InitSubSystem" initSubSystemFFI :: InitFlag -> IO CInt
-foreign import ccall "SDL.h SDL_Quit" quitFFI :: IO ()
-foreign import ccall "SDL.h SDL_QuitSubSystem" quitSubSystemFFI :: InitFlag -> IO ()
-foreign import ccall "SDL.h SDL_SetMainReady" setMainReadyFFI :: IO ()
-foreign import ccall "SDL.h SDL_WasInit" wasInitFFI :: InitFlag -> IO InitFlag
-
-foreign import ccall "SDL.h SDL_free" freeFFI :: Ptr () -> IO ()
-
-foreign import ccall "SDL.h SDL_AddHintCallback" addHintCallbackFFI :: CString -> HintCallback -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_ClearHints" clearHintsFFI :: IO ()
-foreign import ccall "SDL.h SDL_DelHintCallback" delHintCallbackFFI :: CString -> HintCallback -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_GetHint" getHintFFI :: CString -> IO CString
-foreign import ccall "SDL.h SDL_SetHint" setHintFFI :: CString -> CString -> IO Bool
-foreign import ccall "SDL.h SDL_SetHintWithPriority" setHintWithPriorityFFI :: CString -> CString -> HintPriority -> IO Bool
-
-foreign import ccall "SDL.h SDL_LogGetOutputFunction" logGetOutputFunctionFFI :: Ptr LogOutputFunction -> Ptr (Ptr ()) -> IO ()
-foreign import ccall "SDL.h SDL_LogGetPriority" logGetPriorityFFI :: CInt -> IO LogPriority
-foreign import ccall "sdlhelper.c SDLHelper_LogMessage" logMessageFFI :: CInt -> LogPriority -> CString -> IO ()
-foreign import ccall "SDL.h SDL_LogResetPriorities" logResetPrioritiesFFI :: IO ()
-foreign import ccall "SDL.h SDL_LogSetAllPriority" logSetAllPriorityFFI :: LogPriority -> IO ()
-foreign import ccall "SDL.h SDL_LogSetOutputFunction" logSetOutputFunctionFFI :: LogOutputFunction -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_LogSetPriority" logSetPriorityFFI :: CInt -> LogPriority -> IO ()
-
-foreign import ccall "SDL.h SDL_GetRevision" getRevisionFFI :: IO CString
-foreign import ccall "SDL.h SDL_GetRevisionNumber" getRevisionNumberFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GetVersion" getVersionFFI :: Ptr Version -> IO ()
-
-init :: MonadIO m => InitFlag -> m CInt
-init v1 = liftIO $ initFFI v1
-{-# INLINE init #-}
-
-initSubSystem :: MonadIO m => InitFlag -> m CInt
-initSubSystem v1 = liftIO $ initSubSystemFFI v1
-{-# INLINE initSubSystem #-}
-
-quit :: MonadIO m => m ()
-quit = liftIO quitFFI
-{-# INLINE quit #-}
-
-quitSubSystem :: MonadIO m => InitFlag -> m ()
-quitSubSystem v1 = liftIO $ quitSubSystemFFI v1
-{-# INLINE quitSubSystem #-}
-
-setMainReady :: MonadIO m => m ()
-setMainReady = liftIO setMainReadyFFI
-{-# INLINE setMainReady #-}
-
-wasInit :: MonadIO m => InitFlag -> m InitFlag
-wasInit v1 = liftIO $ wasInitFFI v1
-{-# INLINE wasInit #-}
-
-free :: MonadIO m => Ptr () -> m ()
-free v1 = liftIO $ freeFFI v1
-{-# INLINE free #-}
-
-addHintCallback :: MonadIO m => CString -> HintCallback -> Ptr () -> m ()
-addHintCallback v1 v2 v3 = liftIO $ addHintCallbackFFI v1 v2 v3
-{-# INLINE addHintCallback #-}
-
-clearHints :: MonadIO m => m ()
-clearHints = liftIO clearHintsFFI
-{-# INLINE clearHints #-}
-
-delHintCallback :: MonadIO m => CString -> HintCallback -> Ptr () -> m ()
-delHintCallback v1 v2 v3 = liftIO $ delHintCallbackFFI v1 v2 v3
-{-# INLINE delHintCallback #-}
-
-getHint :: MonadIO m => CString -> m CString
-getHint v1 = liftIO $ getHintFFI v1
-{-# INLINE getHint #-}
-
-setHint :: MonadIO m => CString -> CString -> m Bool
-setHint v1 v2 = liftIO $ setHintFFI v1 v2
-{-# INLINE setHint #-}
-
-setHintWithPriority :: MonadIO m => CString -> CString -> HintPriority -> m Bool
-setHintWithPriority v1 v2 v3 = liftIO $ setHintWithPriorityFFI v1 v2 v3
-{-# INLINE setHintWithPriority #-}
-
-log :: CString -> IO ()
-log = logMessage SDL_LOG_CATEGORY_APPLICATION SDL_LOG_PRIORITY_INFO
-{-# INLINE log #-}
-
-logCritical :: CInt -> CString -> IO ()
-logCritical category = logMessage category SDL_LOG_PRIORITY_CRITICAL
-{-# INLINE logCritical #-}
-
-logDebug :: CInt -> CString -> IO ()
-logDebug category = logMessage category SDL_LOG_PRIORITY_DEBUG
-{-# INLINE logDebug #-}
-
-logError :: CInt -> CString -> IO ()
-logError category = logMessage category SDL_LOG_PRIORITY_ERROR
-{-# INLINE logError #-}
-
-logGetOutputFunction :: MonadIO m => Ptr LogOutputFunction -> Ptr (Ptr ()) -> m ()
-logGetOutputFunction v1 v2 = liftIO $ logGetOutputFunctionFFI v1 v2
-{-# INLINE logGetOutputFunction #-}
-
-logGetPriority :: MonadIO m => CInt -> m LogPriority
-logGetPriority v1 = liftIO $ logGetPriorityFFI v1
-{-# INLINE logGetPriority #-}
-
-logInfo :: CInt -> CString -> IO ()
-logInfo category = logMessage category SDL_LOG_PRIORITY_INFO
-{-# INLINE logInfo #-}
-
-logMessage :: MonadIO m => CInt -> LogPriority -> CString -> m ()
-logMessage v1 v2 v3 = liftIO $ logMessageFFI v1 v2 v3
-{-# INLINE logMessage #-}
-
-logResetPriorities :: MonadIO m => m ()
-logResetPriorities = liftIO logResetPrioritiesFFI
-{-# INLINE logResetPriorities #-}
-
-logSetAllPriority :: MonadIO m => LogPriority -> m ()
-logSetAllPriority v1 = liftIO $ logSetAllPriorityFFI v1
-{-# INLINE logSetAllPriority #-}
-
-logSetOutputFunction :: MonadIO m => LogOutputFunction -> Ptr () -> m ()
-logSetOutputFunction v1 v2 = liftIO $ logSetOutputFunctionFFI v1 v2
-{-# INLINE logSetOutputFunction #-}
-
-logSetPriority :: MonadIO m => CInt -> LogPriority -> m ()
-logSetPriority v1 v2 = liftIO $ logSetPriorityFFI v1 v2
-{-# INLINE logSetPriority #-}
-
-logVerbose :: CInt -> CString -> IO ()
-logVerbose category = logMessage category SDL_LOG_PRIORITY_VERBOSE
-{-# INLINE logVerbose #-}
-
-logWarn :: CInt -> CString -> IO ()
-logWarn category = logMessage category SDL_LOG_PRIORITY_WARN
-{-# INLINE logWarn #-}
-
-getRevision :: MonadIO m => m CString
-getRevision = liftIO getRevisionFFI
-{-# INLINE getRevision #-}
-
-getRevisionNumber :: MonadIO m => m CInt
-getRevisionNumber = liftIO getRevisionNumberFFI
-{-# INLINE getRevisionNumber #-}
-
-getVersion :: MonadIO m => Ptr Version -> m ()
-getVersion v1 = liftIO $ getVersionFFI v1
-{-# INLINE getVersion #-}
+module SDL.Raw.Basic (+  -- * Initialization and Shutdown+  init,+  initSubSystem,+  quit,+  quitSubSystem,+  setMainReady,+  wasInit,++  -- * Memory Management+  free,++  -- * Configuration Variables+  addHintCallback,+  clearHints,+  delHintCallback,+  getHint,+  setHint,+  setHintWithPriority,++  -- * Log Handling+  log,+  logCritical,+  logDebug,+  logError,+  logGetOutputFunction,+  logGetPriority,+  logInfo,+  logMessage,+  logResetPriorities,+  logSetAllPriority,+  logSetOutputFunction,+  logSetPriority,+  logVerbose,+  logWarn,++  -- * Assertions+  -- | Use Haskell's own assertion primitives rather than SDL's.++  -- * Querying SDL Version+  getRevision,+  getRevisionNumber,+  getVersion+) where++import Control.Monad.IO.Class+import Foreign.C.String+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Enum+import SDL.Raw.Types+import Prelude hiding (init, log)++foreign import ccall "SDL.h SDL_Init" initFFI :: InitFlag -> IO CInt+foreign import ccall "SDL.h SDL_InitSubSystem" initSubSystemFFI :: InitFlag -> IO CInt+foreign import ccall "SDL.h SDL_Quit" quitFFI :: IO ()+foreign import ccall "SDL.h SDL_QuitSubSystem" quitSubSystemFFI :: InitFlag -> IO ()+foreign import ccall "SDL.h SDL_SetMainReady" setMainReadyFFI :: IO ()+foreign import ccall "SDL.h SDL_WasInit" wasInitFFI :: InitFlag -> IO InitFlag++foreign import ccall "SDL.h SDL_free" freeFFI :: Ptr () -> IO ()++foreign import ccall "SDL.h SDL_AddHintCallback" addHintCallbackFFI :: CString -> HintCallback -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_ClearHints" clearHintsFFI :: IO ()+foreign import ccall "SDL.h SDL_DelHintCallback" delHintCallbackFFI :: CString -> HintCallback -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_GetHint" getHintFFI :: CString -> IO CString+foreign import ccall "SDL.h SDL_SetHint" setHintFFI :: CString -> CString -> IO Bool+foreign import ccall "SDL.h SDL_SetHintWithPriority" setHintWithPriorityFFI :: CString -> CString -> HintPriority -> IO Bool++foreign import ccall "SDL.h SDL_LogGetOutputFunction" logGetOutputFunctionFFI :: Ptr LogOutputFunction -> Ptr (Ptr ()) -> IO ()+foreign import ccall "SDL.h SDL_LogGetPriority" logGetPriorityFFI :: CInt -> IO LogPriority+foreign import ccall "sdlhelper.c SDLHelper_LogMessage" logMessageFFI :: CInt -> LogPriority -> CString -> IO ()+foreign import ccall "SDL.h SDL_LogResetPriorities" logResetPrioritiesFFI :: IO ()+foreign import ccall "SDL.h SDL_LogSetAllPriority" logSetAllPriorityFFI :: LogPriority -> IO ()+foreign import ccall "SDL.h SDL_LogSetOutputFunction" logSetOutputFunctionFFI :: LogOutputFunction -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_LogSetPriority" logSetPriorityFFI :: CInt -> LogPriority -> IO ()++foreign import ccall "SDL.h SDL_GetRevision" getRevisionFFI :: IO CString+foreign import ccall "SDL.h SDL_GetRevisionNumber" getRevisionNumberFFI :: IO CInt+foreign import ccall "SDL.h SDL_GetVersion" getVersionFFI :: Ptr Version -> IO ()++init :: MonadIO m => InitFlag -> m CInt+init v1 = liftIO $ initFFI v1+{-# INLINE init #-}++initSubSystem :: MonadIO m => InitFlag -> m CInt+initSubSystem v1 = liftIO $ initSubSystemFFI v1+{-# INLINE initSubSystem #-}++quit :: MonadIO m => m ()+quit = liftIO quitFFI+{-# INLINE quit #-}++quitSubSystem :: MonadIO m => InitFlag -> m ()+quitSubSystem v1 = liftIO $ quitSubSystemFFI v1+{-# INLINE quitSubSystem #-}++setMainReady :: MonadIO m => m ()+setMainReady = liftIO setMainReadyFFI+{-# INLINE setMainReady #-}++wasInit :: MonadIO m => InitFlag -> m InitFlag+wasInit v1 = liftIO $ wasInitFFI v1+{-# INLINE wasInit #-}++free :: MonadIO m => Ptr () -> m ()+free v1 = liftIO $ freeFFI v1+{-# INLINE free #-}++addHintCallback :: MonadIO m => CString -> HintCallback -> Ptr () -> m ()+addHintCallback v1 v2 v3 = liftIO $ addHintCallbackFFI v1 v2 v3+{-# INLINE addHintCallback #-}++clearHints :: MonadIO m => m ()+clearHints = liftIO clearHintsFFI+{-# INLINE clearHints #-}++delHintCallback :: MonadIO m => CString -> HintCallback -> Ptr () -> m ()+delHintCallback v1 v2 v3 = liftIO $ delHintCallbackFFI v1 v2 v3+{-# INLINE delHintCallback #-}++getHint :: MonadIO m => CString -> m CString+getHint v1 = liftIO $ getHintFFI v1+{-# INLINE getHint #-}++setHint :: MonadIO m => CString -> CString -> m Bool+setHint v1 v2 = liftIO $ setHintFFI v1 v2+{-# INLINE setHint #-}++setHintWithPriority :: MonadIO m => CString -> CString -> HintPriority -> m Bool+setHintWithPriority v1 v2 v3 = liftIO $ setHintWithPriorityFFI v1 v2 v3+{-# INLINE setHintWithPriority #-}++log :: CString -> IO ()+log = logMessage SDL_LOG_CATEGORY_APPLICATION SDL_LOG_PRIORITY_INFO+{-# INLINE log #-}++logCritical :: CInt -> CString -> IO ()+logCritical category = logMessage category SDL_LOG_PRIORITY_CRITICAL+{-# INLINE logCritical #-}++logDebug :: CInt -> CString -> IO ()+logDebug category = logMessage category SDL_LOG_PRIORITY_DEBUG+{-# INLINE logDebug #-}++logError :: CInt -> CString -> IO ()+logError category = logMessage category SDL_LOG_PRIORITY_ERROR+{-# INLINE logError #-}++logGetOutputFunction :: MonadIO m => Ptr LogOutputFunction -> Ptr (Ptr ()) -> m ()+logGetOutputFunction v1 v2 = liftIO $ logGetOutputFunctionFFI v1 v2+{-# INLINE logGetOutputFunction #-}++logGetPriority :: MonadIO m => CInt -> m LogPriority+logGetPriority v1 = liftIO $ logGetPriorityFFI v1+{-# INLINE logGetPriority #-}++logInfo :: CInt -> CString -> IO ()+logInfo category = logMessage category SDL_LOG_PRIORITY_INFO+{-# INLINE logInfo #-}++logMessage :: MonadIO m => CInt -> LogPriority -> CString -> m ()+logMessage v1 v2 v3 = liftIO $ logMessageFFI v1 v2 v3+{-# INLINE logMessage #-}++logResetPriorities :: MonadIO m => m ()+logResetPriorities = liftIO logResetPrioritiesFFI+{-# INLINE logResetPriorities #-}++logSetAllPriority :: MonadIO m => LogPriority -> m ()+logSetAllPriority v1 = liftIO $ logSetAllPriorityFFI v1+{-# INLINE logSetAllPriority #-}++logSetOutputFunction :: MonadIO m => LogOutputFunction -> Ptr () -> m ()+logSetOutputFunction v1 v2 = liftIO $ logSetOutputFunctionFFI v1 v2+{-# INLINE logSetOutputFunction #-}++logSetPriority :: MonadIO m => CInt -> LogPriority -> m ()+logSetPriority v1 v2 = liftIO $ logSetPriorityFFI v1 v2+{-# INLINE logSetPriority #-}++logVerbose :: CInt -> CString -> IO ()+logVerbose category = logMessage category SDL_LOG_PRIORITY_VERBOSE+{-# INLINE logVerbose #-}++logWarn :: CInt -> CString -> IO ()+logWarn category = logMessage category SDL_LOG_PRIORITY_WARN+{-# INLINE logWarn #-}++getRevision :: MonadIO m => m CString+getRevision = liftIO getRevisionFFI+{-# INLINE getRevision #-}++getRevisionNumber :: MonadIO m => m CInt+getRevisionNumber = liftIO getRevisionNumberFFI+{-# INLINE getRevisionNumber #-}++getVersion :: MonadIO m => Ptr Version -> m ()+getVersion v1 = liftIO $ getVersionFFI v1+{-# INLINE getVersion #-}
src/SDL/Raw/Enum.hsc view
@@ -1,1774 +1,1774 @@-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE PatternSynonyms #-}
-module SDL.Raw.Enum (
-  -- * Enumerations
-
-  -- ** Audio Format
-  AudioFormat,
-  pattern SDL_AUDIO_S8,
-  pattern SDL_AUDIO_U8,
-  pattern SDL_AUDIO_S16LSB,
-  pattern SDL_AUDIO_S16MSB,
-  pattern SDL_AUDIO_S16SYS,
-  pattern SDL_AUDIO_U16LSB,
-  pattern SDL_AUDIO_U16MSB,
-  pattern SDL_AUDIO_U16SYS,
-  pattern SDL_AUDIO_S32LSB,
-  pattern SDL_AUDIO_S32MSB,
-  pattern SDL_AUDIO_S32SYS,
-  pattern SDL_AUDIO_F32LSB,
-  pattern SDL_AUDIO_F32MSB,
-  pattern SDL_AUDIO_F32SYS,
-
-  -- ** Audio Status
-  AudioStatus,
-  pattern SDL_AUDIO_STOPPED,
-  pattern SDL_AUDIO_PLAYING,
-  pattern SDL_AUDIO_PAUSED,
-
-  -- ** Blend Mode
-  BlendMode,
-  pattern SDL_BLENDMODE_NONE,
-  pattern SDL_BLENDMODE_BLEND,
-  pattern SDL_BLENDMODE_ADD,
-  pattern SDL_BLENDMODE_MOD,
-
-  -- ** Endian Detetection
-  pattern SDL_BYTEORDER,
-  pattern SDL_LIL_ENDIAN,
-  pattern SDL_BIG_ENDIAN,
-
-  -- ** Event Action
-  EventAction,
-  pattern SDL_ADDEVENT,
-  pattern SDL_PEEKEVENT,
-  pattern SDL_GETEVENT,
-
-  -- ** Game Controller Axis
-  GameControllerAxis,
-  pattern SDL_CONTROLLER_AXIS_INVALID,
-  pattern SDL_CONTROLLER_AXIS_LEFTX,
-  pattern SDL_CONTROLLER_AXIS_LEFTY,
-  pattern SDL_CONTROLLER_AXIS_RIGHTX,
-  pattern SDL_CONTROLLER_AXIS_RIGHTY,
-  pattern SDL_CONTROLLER_AXIS_TRIGGERLEFT,
-  pattern SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
-  pattern SDL_CONTROLLER_AXIS_MAX,
-
-  -- ** Game Controller Button
-  GameControllerButton,
-  pattern SDL_CONTROLLER_BUTTON_INVALID,
-  pattern SDL_CONTROLLER_BUTTON_A,
-  pattern SDL_CONTROLLER_BUTTON_B,
-  pattern SDL_CONTROLLER_BUTTON_X,
-  pattern SDL_CONTROLLER_BUTTON_Y,
-  pattern SDL_CONTROLLER_BUTTON_BACK,
-  pattern SDL_CONTROLLER_BUTTON_GUIDE,
-  pattern SDL_CONTROLLER_BUTTON_START,
-  pattern SDL_CONTROLLER_BUTTON_LEFTSTICK,
-  pattern SDL_CONTROLLER_BUTTON_RIGHTSTICK,
-  pattern SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
-  pattern SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
-  pattern SDL_CONTROLLER_BUTTON_DPAD_UP,
-  pattern SDL_CONTROLLER_BUTTON_DPAD_DOWN,
-  pattern SDL_CONTROLLER_BUTTON_DPAD_LEFT,
-  pattern SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
-  pattern SDL_CONTROLLER_BUTTON_MAX,
-
-  -- ** OpenGL Attribute
-  GLattr,
-  pattern SDL_GL_RED_SIZE,
-  pattern SDL_GL_GREEN_SIZE,
-  pattern SDL_GL_BLUE_SIZE,
-  pattern SDL_GL_ALPHA_SIZE,
-  pattern SDL_GL_BUFFER_SIZE,
-  pattern SDL_GL_DOUBLEBUFFER,
-  pattern SDL_GL_DEPTH_SIZE,
-  pattern SDL_GL_STENCIL_SIZE,
-  pattern SDL_GL_ACCUM_RED_SIZE,
-  pattern SDL_GL_ACCUM_GREEN_SIZE,
-  pattern SDL_GL_ACCUM_BLUE_SIZE,
-  pattern SDL_GL_ACCUM_ALPHA_SIZE,
-  pattern SDL_GL_STEREO,
-  pattern SDL_GL_MULTISAMPLEBUFFERS,
-  pattern SDL_GL_MULTISAMPLESAMPLES,
-  pattern SDL_GL_ACCELERATED_VISUAL,
-  pattern SDL_GL_RETAINED_BACKING,
-  pattern SDL_GL_CONTEXT_MAJOR_VERSION,
-  pattern SDL_GL_CONTEXT_MINOR_VERSION,
-  pattern SDL_GL_CONTEXT_EGL,
-  pattern SDL_GL_CONTEXT_FLAGS,
-  pattern SDL_GL_CONTEXT_PROFILE_MASK,
-  pattern SDL_GL_SHARE_WITH_CURRENT_CONTEXT,
-  pattern SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
-  pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
-
-  -- ** Hint Priority
-  HintPriority,
-  pattern SDL_HINT_DEFAULT,
-  pattern SDL_HINT_NORMAL,
-  pattern SDL_HINT_OVERRIDE,
-
-  -- ** Initialization Flag
-  InitFlag,
-  pattern SDL_INIT_TIMER,
-  pattern SDL_INIT_AUDIO,
-  pattern SDL_INIT_VIDEO,
-  pattern SDL_INIT_JOYSTICK,
-  pattern SDL_INIT_HAPTIC,
-  pattern SDL_INIT_GAMECONTROLLER,
-  pattern SDL_INIT_EVENTS,
-  pattern SDL_INIT_NOPARACHUTE,
-  pattern SDL_INIT_EVERYTHING,
-
-  -- ** Joystick Power Level
-  JoystickPowerLevel,
-  pattern SDL_JOYSTICK_POWER_UNKNOWN,
-  pattern SDL_JOYSTICK_POWER_EMPTY,
-  pattern SDL_JOYSTICK_POWER_LOW,
-  pattern SDL_JOYSTICK_POWER_MEDIUM,
-  pattern SDL_JOYSTICK_POWER_FULL,
-  pattern SDL_JOYSTICK_POWER_WIRED,
-  pattern SDL_JOYSTICK_POWER_MAX,
-
-  -- ** Keycode
-  Keycode,
-  pattern SDLK_UNKNOWN,
-  pattern SDLK_RETURN,
-  pattern SDLK_ESCAPE,
-  pattern SDLK_BACKSPACE,
-  pattern SDLK_TAB,
-  pattern SDLK_SPACE,
-  pattern SDLK_EXCLAIM,
-  pattern SDLK_QUOTEDBL,
-  pattern SDLK_HASH,
-  pattern SDLK_PERCENT,
-  pattern SDLK_DOLLAR,
-  pattern SDLK_AMPERSAND,
-  pattern SDLK_QUOTE,
-  pattern SDLK_LEFTPAREN,
-  pattern SDLK_RIGHTPAREN,
-  pattern SDLK_ASTERISK,
-  pattern SDLK_PLUS,
-  pattern SDLK_COMMA,
-  pattern SDLK_MINUS,
-  pattern SDLK_PERIOD,
-  pattern SDLK_SLASH,
-  pattern SDLK_0,
-  pattern SDLK_1,
-  pattern SDLK_2,
-  pattern SDLK_3,
-  pattern SDLK_4,
-  pattern SDLK_5,
-  pattern SDLK_6,
-  pattern SDLK_7,
-  pattern SDLK_8,
-  pattern SDLK_9,
-  pattern SDLK_COLON,
-  pattern SDLK_SEMICOLON,
-  pattern SDLK_LESS,
-  pattern SDLK_EQUALS,
-  pattern SDLK_GREATER,
-  pattern SDLK_QUESTION,
-  pattern SDLK_AT,
-  pattern SDLK_LEFTBRACKET,
-  pattern SDLK_BACKSLASH,
-  pattern SDLK_RIGHTBRACKET,
-  pattern SDLK_CARET,
-  pattern SDLK_UNDERSCORE,
-  pattern SDLK_BACKQUOTE,
-  pattern SDLK_a,
-  pattern SDLK_b,
-  pattern SDLK_c,
-  pattern SDLK_d,
-  pattern SDLK_e,
-  pattern SDLK_f,
-  pattern SDLK_g,
-  pattern SDLK_h,
-  pattern SDLK_i,
-  pattern SDLK_j,
-  pattern SDLK_k,
-  pattern SDLK_l,
-  pattern SDLK_m,
-  pattern SDLK_n,
-  pattern SDLK_o,
-  pattern SDLK_p,
-  pattern SDLK_q,
-  pattern SDLK_r,
-  pattern SDLK_s,
-  pattern SDLK_t,
-  pattern SDLK_u,
-  pattern SDLK_v,
-  pattern SDLK_w,
-  pattern SDLK_x,
-  pattern SDLK_y,
-  pattern SDLK_z,
-  pattern SDLK_CAPSLOCK,
-  pattern SDLK_F1,
-  pattern SDLK_F2,
-  pattern SDLK_F3,
-  pattern SDLK_F4,
-  pattern SDLK_F5,
-  pattern SDLK_F6,
-  pattern SDLK_F7,
-  pattern SDLK_F8,
-  pattern SDLK_F9,
-  pattern SDLK_F10,
-  pattern SDLK_F11,
-  pattern SDLK_F12,
-  pattern SDLK_PRINTSCREEN,
-  pattern SDLK_SCROLLLOCK,
-  pattern SDLK_PAUSE,
-  pattern SDLK_INSERT,
-  pattern SDLK_HOME,
-  pattern SDLK_PAGEUP,
-  pattern SDLK_DELETE,
-  pattern SDLK_END,
-  pattern SDLK_PAGEDOWN,
-  pattern SDLK_RIGHT,
-  pattern SDLK_LEFT,
-  pattern SDLK_DOWN,
-  pattern SDLK_UP,
-  pattern SDLK_NUMLOCKCLEAR,
-  pattern SDLK_KP_DIVIDE,
-  pattern SDLK_KP_MULTIPLY,
-  pattern SDLK_KP_MINUS,
-  pattern SDLK_KP_PLUS,
-  pattern SDLK_KP_ENTER,
-  pattern SDLK_KP_1,
-  pattern SDLK_KP_2,
-  pattern SDLK_KP_3,
-  pattern SDLK_KP_4,
-  pattern SDLK_KP_5,
-  pattern SDLK_KP_6,
-  pattern SDLK_KP_7,
-  pattern SDLK_KP_8,
-  pattern SDLK_KP_9,
-  pattern SDLK_KP_0,
-  pattern SDLK_KP_PERIOD,
-  pattern SDLK_APPLICATION,
-  pattern SDLK_POWER,
-  pattern SDLK_KP_EQUALS,
-  pattern SDLK_F13,
-  pattern SDLK_F14,
-  pattern SDLK_F15,
-  pattern SDLK_F16,
-  pattern SDLK_F17,
-  pattern SDLK_F18,
-  pattern SDLK_F19,
-  pattern SDLK_F20,
-  pattern SDLK_F21,
-  pattern SDLK_F22,
-  pattern SDLK_F23,
-  pattern SDLK_F24,
-  pattern SDLK_EXECUTE,
-  pattern SDLK_HELP,
-  pattern SDLK_MENU,
-  pattern SDLK_SELECT,
-  pattern SDLK_STOP,
-  pattern SDLK_AGAIN,
-  pattern SDLK_UNDO,
-  pattern SDLK_CUT,
-  pattern SDLK_COPY,
-  pattern SDLK_PASTE,
-  pattern SDLK_FIND,
-  pattern SDLK_MUTE,
-  pattern SDLK_VOLUMEUP,
-  pattern SDLK_VOLUMEDOWN,
-  pattern SDLK_KP_COMMA,
-  pattern SDLK_KP_EQUALSAS400,
-  pattern SDLK_ALTERASE,
-  pattern SDLK_SYSREQ,
-  pattern SDLK_CANCEL,
-  pattern SDLK_CLEAR,
-  pattern SDLK_PRIOR,
-  pattern SDLK_RETURN2,
-  pattern SDLK_SEPARATOR,
-  pattern SDLK_OUT,
-  pattern SDLK_OPER,
-  pattern SDLK_CLEARAGAIN,
-  pattern SDLK_CRSEL,
-  pattern SDLK_EXSEL,
-  pattern SDLK_KP_00,
-  pattern SDLK_KP_000,
-  pattern SDLK_THOUSANDSSEPARATOR,
-  pattern SDLK_DECIMALSEPARATOR,
-  pattern SDLK_CURRENCYUNIT,
-  pattern SDLK_CURRENCYSUBUNIT,
-  pattern SDLK_KP_LEFTPAREN,
-  pattern SDLK_KP_RIGHTPAREN,
-  pattern SDLK_KP_LEFTBRACE,
-  pattern SDLK_KP_RIGHTBRACE,
-  pattern SDLK_KP_TAB,
-  pattern SDLK_KP_BACKSPACE,
-  pattern SDLK_KP_A,
-  pattern SDLK_KP_B,
-  pattern SDLK_KP_C,
-  pattern SDLK_KP_D,
-  pattern SDLK_KP_E,
-  pattern SDLK_KP_F,
-  pattern SDLK_KP_XOR,
-  pattern SDLK_KP_POWER,
-  pattern SDLK_KP_PERCENT,
-  pattern SDLK_KP_LESS,
-  pattern SDLK_KP_GREATER,
-  pattern SDLK_KP_AMPERSAND,
-  pattern SDLK_KP_DBLAMPERSAND,
-  pattern SDLK_KP_VERTICALBAR,
-  pattern SDLK_KP_DBLVERTICALBAR,
-  pattern SDLK_KP_COLON,
-  pattern SDLK_KP_HASH,
-  pattern SDLK_KP_SPACE,
-  pattern SDLK_KP_AT,
-  pattern SDLK_KP_EXCLAM,
-  pattern SDLK_KP_MEMSTORE,
-  pattern SDLK_KP_MEMRECALL,
-  pattern SDLK_KP_MEMCLEAR,
-  pattern SDLK_KP_MEMADD,
-  pattern SDLK_KP_MEMSUBTRACT,
-  pattern SDLK_KP_MEMMULTIPLY,
-  pattern SDLK_KP_MEMDIVIDE,
-  pattern SDLK_KP_PLUSMINUS,
-  pattern SDLK_KP_CLEAR,
-  pattern SDLK_KP_CLEARENTRY,
-  pattern SDLK_KP_BINARY,
-  pattern SDLK_KP_OCTAL,
-  pattern SDLK_KP_DECIMAL,
-  pattern SDLK_KP_HEXADECIMAL,
-  pattern SDLK_LCTRL,
-  pattern SDLK_LSHIFT,
-  pattern SDLK_LALT,
-  pattern SDLK_LGUI,
-  pattern SDLK_RCTRL,
-  pattern SDLK_RSHIFT,
-  pattern SDLK_RALT,
-  pattern SDLK_RGUI,
-  pattern SDLK_MODE,
-  pattern SDLK_AUDIONEXT,
-  pattern SDLK_AUDIOPREV,
-  pattern SDLK_AUDIOSTOP,
-  pattern SDLK_AUDIOPLAY,
-  pattern SDLK_AUDIOMUTE,
-  pattern SDLK_MEDIASELECT,
-  pattern SDLK_WWW,
-  pattern SDLK_MAIL,
-  pattern SDLK_CALCULATOR,
-  pattern SDLK_COMPUTER,
-  pattern SDLK_AC_SEARCH,
-  pattern SDLK_AC_HOME,
-  pattern SDLK_AC_BACK,
-  pattern SDLK_AC_FORWARD,
-  pattern SDLK_AC_STOP,
-  pattern SDLK_AC_REFRESH,
-  pattern SDLK_AC_BOOKMARKS,
-  pattern SDLK_BRIGHTNESSDOWN,
-  pattern SDLK_BRIGHTNESSUP,
-  pattern SDLK_DISPLAYSWITCH,
-  pattern SDLK_KBDILLUMTOGGLE,
-  pattern SDLK_KBDILLUMDOWN,
-  pattern SDLK_KBDILLUMUP,
-  pattern SDLK_EJECT,
-  pattern SDLK_SLEEP,
-
-  -- ** Key Modifier
-  Keymod,
-  pattern KMOD_NONE,
-  pattern KMOD_LSHIFT,
-  pattern KMOD_RSHIFT,
-  pattern KMOD_SHIFT,
-  pattern KMOD_LCTRL,
-  pattern KMOD_RCTRL,
-  pattern KMOD_CTRL,
-  pattern KMOD_LALT,
-  pattern KMOD_RALT,
-  pattern KMOD_ALT,
-  pattern KMOD_LGUI,
-  pattern KMOD_RGUI,
-  pattern KMOD_GUI,
-  pattern KMOD_NUM,
-  pattern KMOD_CAPS,
-  pattern KMOD_MODE,
-  pattern KMOD_RESERVED,
-
-  -- ** Log Priority
-  LogPriority,
-  pattern SDL_LOG_PRIORITY_VERBOSE,
-  pattern SDL_LOG_PRIORITY_DEBUG,
-  pattern SDL_LOG_PRIORITY_INFO,
-  pattern SDL_LOG_PRIORITY_WARN,
-  pattern SDL_LOG_PRIORITY_ERROR,
-  pattern SDL_LOG_PRIORITY_CRITICAL,
-  pattern SDL_NUM_LOG_PRIORITIES,
-
-  -- ** Power State
-  PowerState,
-  pattern SDL_POWERSTATE_UNKNOWN,
-  pattern SDL_POWERSTATE_ON_BATTERY,
-  pattern SDL_POWERSTATE_NO_BATTERY,
-  pattern SDL_POWERSTATE_CHARGING,
-  pattern SDL_POWERSTATE_CHARGED,
-
-  -- ** Renderer Flip
-  RendererFlip,
-  pattern SDL_FLIP_NONE,
-  pattern SDL_FLIP_HORIZONTAL,
-  pattern SDL_FLIP_VERTICAL,
-
-  -- ** Scancode
-  Scancode,
-  pattern SDL_SCANCODE_UNKNOWN,
-  pattern SDL_SCANCODE_A,
-  pattern SDL_SCANCODE_B,
-  pattern SDL_SCANCODE_C,
-  pattern SDL_SCANCODE_D,
-  pattern SDL_SCANCODE_E,
-  pattern SDL_SCANCODE_F,
-  pattern SDL_SCANCODE_G,
-  pattern SDL_SCANCODE_H,
-  pattern SDL_SCANCODE_I,
-  pattern SDL_SCANCODE_J,
-  pattern SDL_SCANCODE_K,
-  pattern SDL_SCANCODE_L,
-  pattern SDL_SCANCODE_M,
-  pattern SDL_SCANCODE_N,
-  pattern SDL_SCANCODE_O,
-  pattern SDL_SCANCODE_P,
-  pattern SDL_SCANCODE_Q,
-  pattern SDL_SCANCODE_R,
-  pattern SDL_SCANCODE_S,
-  pattern SDL_SCANCODE_T,
-  pattern SDL_SCANCODE_U,
-  pattern SDL_SCANCODE_V,
-  pattern SDL_SCANCODE_W,
-  pattern SDL_SCANCODE_X,
-  pattern SDL_SCANCODE_Y,
-  pattern SDL_SCANCODE_Z,
-  pattern SDL_SCANCODE_1,
-  pattern SDL_SCANCODE_2,
-  pattern SDL_SCANCODE_3,
-  pattern SDL_SCANCODE_4,
-  pattern SDL_SCANCODE_5,
-  pattern SDL_SCANCODE_6,
-  pattern SDL_SCANCODE_7,
-  pattern SDL_SCANCODE_8,
-  pattern SDL_SCANCODE_9,
-  pattern SDL_SCANCODE_0,
-  pattern SDL_SCANCODE_RETURN,
-  pattern SDL_SCANCODE_ESCAPE,
-  pattern SDL_SCANCODE_BACKSPACE,
-  pattern SDL_SCANCODE_TAB,
-  pattern SDL_SCANCODE_SPACE,
-  pattern SDL_SCANCODE_MINUS,
-  pattern SDL_SCANCODE_EQUALS,
-  pattern SDL_SCANCODE_LEFTBRACKET,
-  pattern SDL_SCANCODE_RIGHTBRACKET,
-  pattern SDL_SCANCODE_BACKSLASH,
-  pattern SDL_SCANCODE_NONUSHASH,
-  pattern SDL_SCANCODE_SEMICOLON,
-  pattern SDL_SCANCODE_APOSTROPHE,
-  pattern SDL_SCANCODE_GRAVE,
-  pattern SDL_SCANCODE_COMMA,
-  pattern SDL_SCANCODE_PERIOD,
-  pattern SDL_SCANCODE_SLASH,
-  pattern SDL_SCANCODE_CAPSLOCK,
-  pattern SDL_SCANCODE_F1,
-  pattern SDL_SCANCODE_F2,
-  pattern SDL_SCANCODE_F3,
-  pattern SDL_SCANCODE_F4,
-  pattern SDL_SCANCODE_F5,
-  pattern SDL_SCANCODE_F6,
-  pattern SDL_SCANCODE_F7,
-  pattern SDL_SCANCODE_F8,
-  pattern SDL_SCANCODE_F9,
-  pattern SDL_SCANCODE_F10,
-  pattern SDL_SCANCODE_F11,
-  pattern SDL_SCANCODE_F12,
-  pattern SDL_SCANCODE_PRINTSCREEN,
-  pattern SDL_SCANCODE_SCROLLLOCK,
-  pattern SDL_SCANCODE_PAUSE,
-  pattern SDL_SCANCODE_INSERT,
-  pattern SDL_SCANCODE_HOME,
-  pattern SDL_SCANCODE_PAGEUP,
-  pattern SDL_SCANCODE_DELETE,
-  pattern SDL_SCANCODE_END,
-  pattern SDL_SCANCODE_PAGEDOWN,
-  pattern SDL_SCANCODE_RIGHT,
-  pattern SDL_SCANCODE_LEFT,
-  pattern SDL_SCANCODE_DOWN,
-  pattern SDL_SCANCODE_UP,
-  pattern SDL_SCANCODE_NUMLOCKCLEAR,
-  pattern SDL_SCANCODE_KP_DIVIDE,
-  pattern SDL_SCANCODE_KP_MULTIPLY,
-  pattern SDL_SCANCODE_KP_MINUS,
-  pattern SDL_SCANCODE_KP_PLUS,
-  pattern SDL_SCANCODE_KP_ENTER,
-  pattern SDL_SCANCODE_KP_1,
-  pattern SDL_SCANCODE_KP_2,
-  pattern SDL_SCANCODE_KP_3,
-  pattern SDL_SCANCODE_KP_4,
-  pattern SDL_SCANCODE_KP_5,
-  pattern SDL_SCANCODE_KP_6,
-  pattern SDL_SCANCODE_KP_7,
-  pattern SDL_SCANCODE_KP_8,
-  pattern SDL_SCANCODE_KP_9,
-  pattern SDL_SCANCODE_KP_0,
-  pattern SDL_SCANCODE_KP_PERIOD,
-  pattern SDL_SCANCODE_NONUSBACKSLASH,
-  pattern SDL_SCANCODE_APPLICATION,
-  pattern SDL_SCANCODE_POWER,
-  pattern SDL_SCANCODE_KP_EQUALS,
-  pattern SDL_SCANCODE_F13,
-  pattern SDL_SCANCODE_F14,
-  pattern SDL_SCANCODE_F15,
-  pattern SDL_SCANCODE_F16,
-  pattern SDL_SCANCODE_F17,
-  pattern SDL_SCANCODE_F18,
-  pattern SDL_SCANCODE_F19,
-  pattern SDL_SCANCODE_F20,
-  pattern SDL_SCANCODE_F21,
-  pattern SDL_SCANCODE_F22,
-  pattern SDL_SCANCODE_F23,
-  pattern SDL_SCANCODE_F24,
-  pattern SDL_SCANCODE_EXECUTE,
-  pattern SDL_SCANCODE_HELP,
-  pattern SDL_SCANCODE_MENU,
-  pattern SDL_SCANCODE_SELECT,
-  pattern SDL_SCANCODE_STOP,
-  pattern SDL_SCANCODE_AGAIN,
-  pattern SDL_SCANCODE_UNDO,
-  pattern SDL_SCANCODE_CUT,
-  pattern SDL_SCANCODE_COPY,
-  pattern SDL_SCANCODE_PASTE,
-  pattern SDL_SCANCODE_FIND,
-  pattern SDL_SCANCODE_MUTE,
-  pattern SDL_SCANCODE_VOLUMEUP,
-  pattern SDL_SCANCODE_VOLUMEDOWN,
-  pattern SDL_SCANCODE_KP_COMMA,
-  pattern SDL_SCANCODE_KP_EQUALSAS400,
-  pattern SDL_SCANCODE_INTERNATIONAL1,
-  pattern SDL_SCANCODE_INTERNATIONAL2,
-  pattern SDL_SCANCODE_INTERNATIONAL3,
-  pattern SDL_SCANCODE_INTERNATIONAL4,
-  pattern SDL_SCANCODE_INTERNATIONAL5,
-  pattern SDL_SCANCODE_INTERNATIONAL6,
-  pattern SDL_SCANCODE_INTERNATIONAL7,
-  pattern SDL_SCANCODE_INTERNATIONAL8,
-  pattern SDL_SCANCODE_INTERNATIONAL9,
-  pattern SDL_SCANCODE_LANG1,
-  pattern SDL_SCANCODE_LANG2,
-  pattern SDL_SCANCODE_LANG3,
-  pattern SDL_SCANCODE_LANG4,
-  pattern SDL_SCANCODE_LANG5,
-  pattern SDL_SCANCODE_LANG6,
-  pattern SDL_SCANCODE_LANG7,
-  pattern SDL_SCANCODE_LANG8,
-  pattern SDL_SCANCODE_LANG9,
-  pattern SDL_SCANCODE_ALTERASE,
-  pattern SDL_SCANCODE_SYSREQ,
-  pattern SDL_SCANCODE_CANCEL,
-  pattern SDL_SCANCODE_CLEAR,
-  pattern SDL_SCANCODE_PRIOR,
-  pattern SDL_SCANCODE_RETURN2,
-  pattern SDL_SCANCODE_SEPARATOR,
-  pattern SDL_SCANCODE_OUT,
-  pattern SDL_SCANCODE_OPER,
-  pattern SDL_SCANCODE_CLEARAGAIN,
-  pattern SDL_SCANCODE_CRSEL,
-  pattern SDL_SCANCODE_EXSEL,
-  pattern SDL_SCANCODE_KP_00,
-  pattern SDL_SCANCODE_KP_000,
-  pattern SDL_SCANCODE_THOUSANDSSEPARATOR,
-  pattern SDL_SCANCODE_DECIMALSEPARATOR,
-  pattern SDL_SCANCODE_CURRENCYUNIT,
-  pattern SDL_SCANCODE_CURRENCYSUBUNIT,
-  pattern SDL_SCANCODE_KP_LEFTPAREN,
-  pattern SDL_SCANCODE_KP_RIGHTPAREN,
-  pattern SDL_SCANCODE_KP_LEFTBRACE,
-  pattern SDL_SCANCODE_KP_RIGHTBRACE,
-  pattern SDL_SCANCODE_KP_TAB,
-  pattern SDL_SCANCODE_KP_BACKSPACE,
-  pattern SDL_SCANCODE_KP_A,
-  pattern SDL_SCANCODE_KP_B,
-  pattern SDL_SCANCODE_KP_C,
-  pattern SDL_SCANCODE_KP_D,
-  pattern SDL_SCANCODE_KP_E,
-  pattern SDL_SCANCODE_KP_F,
-  pattern SDL_SCANCODE_KP_XOR,
-  pattern SDL_SCANCODE_KP_POWER,
-  pattern SDL_SCANCODE_KP_PERCENT,
-  pattern SDL_SCANCODE_KP_LESS,
-  pattern SDL_SCANCODE_KP_GREATER,
-  pattern SDL_SCANCODE_KP_AMPERSAND,
-  pattern SDL_SCANCODE_KP_DBLAMPERSAND,
-  pattern SDL_SCANCODE_KP_VERTICALBAR,
-  pattern SDL_SCANCODE_KP_DBLVERTICALBAR,
-  pattern SDL_SCANCODE_KP_COLON,
-  pattern SDL_SCANCODE_KP_HASH,
-  pattern SDL_SCANCODE_KP_SPACE,
-  pattern SDL_SCANCODE_KP_AT,
-  pattern SDL_SCANCODE_KP_EXCLAM,
-  pattern SDL_SCANCODE_KP_MEMSTORE,
-  pattern SDL_SCANCODE_KP_MEMRECALL,
-  pattern SDL_SCANCODE_KP_MEMCLEAR,
-  pattern SDL_SCANCODE_KP_MEMADD,
-  pattern SDL_SCANCODE_KP_MEMSUBTRACT,
-  pattern SDL_SCANCODE_KP_MEMMULTIPLY,
-  pattern SDL_SCANCODE_KP_MEMDIVIDE,
-  pattern SDL_SCANCODE_KP_PLUSMINUS,
-  pattern SDL_SCANCODE_KP_CLEAR,
-  pattern SDL_SCANCODE_KP_CLEARENTRY,
-  pattern SDL_SCANCODE_KP_BINARY,
-  pattern SDL_SCANCODE_KP_OCTAL,
-  pattern SDL_SCANCODE_KP_DECIMAL,
-  pattern SDL_SCANCODE_KP_HEXADECIMAL,
-  pattern SDL_SCANCODE_LCTRL,
-  pattern SDL_SCANCODE_LSHIFT,
-  pattern SDL_SCANCODE_LALT,
-  pattern SDL_SCANCODE_LGUI,
-  pattern SDL_SCANCODE_RCTRL,
-  pattern SDL_SCANCODE_RSHIFT,
-  pattern SDL_SCANCODE_RALT,
-  pattern SDL_SCANCODE_RGUI,
-  pattern SDL_SCANCODE_MODE,
-  pattern SDL_SCANCODE_AUDIONEXT,
-  pattern SDL_SCANCODE_AUDIOPREV,
-  pattern SDL_SCANCODE_AUDIOSTOP,
-  pattern SDL_SCANCODE_AUDIOPLAY,
-  pattern SDL_SCANCODE_AUDIOMUTE,
-  pattern SDL_SCANCODE_MEDIASELECT,
-  pattern SDL_SCANCODE_WWW,
-  pattern SDL_SCANCODE_MAIL,
-  pattern SDL_SCANCODE_CALCULATOR,
-  pattern SDL_SCANCODE_COMPUTER,
-  pattern SDL_SCANCODE_AC_SEARCH,
-  pattern SDL_SCANCODE_AC_HOME,
-  pattern SDL_SCANCODE_AC_BACK,
-  pattern SDL_SCANCODE_AC_FORWARD,
-  pattern SDL_SCANCODE_AC_STOP,
-  pattern SDL_SCANCODE_AC_REFRESH,
-  pattern SDL_SCANCODE_AC_BOOKMARKS,
-  pattern SDL_SCANCODE_BRIGHTNESSDOWN,
-  pattern SDL_SCANCODE_BRIGHTNESSUP,
-  pattern SDL_SCANCODE_DISPLAYSWITCH,
-  pattern SDL_SCANCODE_KBDILLUMTOGGLE,
-  pattern SDL_SCANCODE_KBDILLUMDOWN,
-  pattern SDL_SCANCODE_KBDILLUMUP,
-  pattern SDL_SCANCODE_EJECT,
-  pattern SDL_SCANCODE_SLEEP,
-  pattern SDL_SCANCODE_APP1,
-  pattern SDL_SCANCODE_APP2,
-  pattern SDL_NUM_SCANCODES,
-
-  pattern SDL_SYSTEM_CURSOR_ARROW,
-  pattern SDL_SYSTEM_CURSOR_IBEAM,
-  pattern SDL_SYSTEM_CURSOR_WAIT,
-
-  -- ** System Cursor
-  SystemCursor,
-  pattern SDL_SYSTEM_CURSOR_CROSSHAIR,
-  pattern SDL_SYSTEM_CURSOR_WAITARROW,
-  pattern SDL_SYSTEM_CURSOR_SIZENWSE,
-  pattern SDL_SYSTEM_CURSOR_SIZENESW,
-  pattern SDL_SYSTEM_CURSOR_SIZEWE,
-  pattern SDL_SYSTEM_CURSOR_SIZENS,
-  pattern SDL_SYSTEM_CURSOR_SIZEALL,
-  pattern SDL_SYSTEM_CURSOR_NO,
-  pattern SDL_SYSTEM_CURSOR_HAND,
-  pattern SDL_NUM_SYSTEM_CURSORS,
-
-  -- ** Thread Priority
-  ThreadPriority,
-  pattern SDL_THREAD_PRIORITY_LOW,
-  pattern SDL_THREAD_PRIORITY_NORMAL,
-  pattern SDL_THREAD_PRIORITY_HIGH,
-
-  -- * Miscellaneous Enumerations
-  -- | These enumerations are not used directly by any SDL function, thus they have a polymorphic type.
-
-  -- ** Audio Allowed Changes
-  pattern SDL_AUDIO_ALLOW_FREQUENCY_CHANGE,
-  pattern SDL_AUDIO_ALLOW_FORMAT_CHANGE,
-  pattern SDL_AUDIO_ALLOW_CHANNELS_CHANGE,
-  pattern SDL_AUDIO_ALLOW_ANY_CHANGE,
-
-  -- ** Mouse Buttons
-  pattern SDL_BUTTON_LEFT,
-  pattern SDL_BUTTON_MIDDLE,
-  pattern SDL_BUTTON_RIGHT,
-  pattern SDL_BUTTON_X1,
-  pattern SDL_BUTTON_X2,
-
-  -- ** Mouse Button Masks
-  pattern SDL_BUTTON_LMASK,
-  pattern SDL_BUTTON_MMASK,
-  pattern SDL_BUTTON_RMASK,
-  pattern SDL_BUTTON_X1MASK,
-  pattern SDL_BUTTON_X2MASK,
-
-  -- ** Mouse Wheel Direction
-  pattern SDL_MOUSEWHEEL_NORMAL,
-  pattern SDL_MOUSEWHEEL_FLIPPED,
-
-  -- ** Event Type
-  pattern SDL_FIRSTEVENT,
-  pattern SDL_QUIT,
-  pattern SDL_APP_TERMINATING,
-  pattern SDL_APP_LOWMEMORY,
-  pattern SDL_APP_WILLENTERBACKGROUND,
-  pattern SDL_APP_DIDENTERBACKGROUND,
-  pattern SDL_APP_WILLENTERFOREGROUND,
-  pattern SDL_APP_DIDENTERFOREGROUND,
-  pattern SDL_WINDOWEVENT,
-  pattern SDL_SYSWMEVENT,
-  pattern SDL_KEYDOWN,
-  pattern SDL_KEYUP,
-  pattern SDL_TEXTEDITING,
-  pattern SDL_TEXTINPUT,
-  pattern SDL_KEYMAPCHANGED,
-  pattern SDL_MOUSEMOTION,
-  pattern SDL_MOUSEBUTTONDOWN,
-  pattern SDL_MOUSEBUTTONUP,
-  pattern SDL_MOUSEWHEEL,
-  pattern SDL_JOYAXISMOTION,
-  pattern SDL_JOYBALLMOTION,
-  pattern SDL_JOYHATMOTION,
-  pattern SDL_JOYBUTTONDOWN,
-  pattern SDL_JOYBUTTONUP,
-  pattern SDL_JOYDEVICEADDED,
-  pattern SDL_JOYDEVICEREMOVED,
-  pattern SDL_CONTROLLERAXISMOTION,
-  pattern SDL_CONTROLLERBUTTONDOWN,
-  pattern SDL_CONTROLLERBUTTONUP,
-  pattern SDL_CONTROLLERDEVICEADDED,
-  pattern SDL_CONTROLLERDEVICEREMOVED,
-  pattern SDL_CONTROLLERDEVICEREMAPPED,
-  pattern SDL_FINGERDOWN,
-  pattern SDL_FINGERUP,
-  pattern SDL_FINGERMOTION,
-  pattern SDL_DOLLARGESTURE,
-  pattern SDL_DOLLARRECORD,
-  pattern SDL_MULTIGESTURE,
-  pattern SDL_CLIPBOARDUPDATE,
-  pattern SDL_DROPFILE,
-  pattern SDL_AUDIODEVICEADDED,
-  pattern SDL_AUDIODEVICEREMOVED,
-  pattern SDL_RENDER_TARGETS_RESET,
-  pattern SDL_RENDER_DEVICE_RESET,
-  pattern SDL_USEREVENT,
-  pattern SDL_LASTEVENT,
-
-  -- ** Joystick Hat Position
-  pattern SDL_HAT_CENTERED,
-  pattern SDL_HAT_UP,
-  pattern SDL_HAT_RIGHT,
-  pattern SDL_HAT_DOWN,
-  pattern SDL_HAT_LEFT,
-  pattern SDL_HAT_RIGHTUP,
-  pattern SDL_HAT_RIGHTDOWN,
-  pattern SDL_HAT_LEFTUP,
-  pattern SDL_HAT_LEFTDOWN,
-
-  -- ** Key States
-  pattern SDL_PRESSED,
-  pattern SDL_RELEASED,
-
-  -- ** Log Category
-  pattern SDL_LOG_CATEGORY_APPLICATION,
-  pattern SDL_LOG_CATEGORY_ERROR,
-  pattern SDL_LOG_CATEGORY_ASSERT,
-  pattern SDL_LOG_CATEGORY_SYSTEM,
-  pattern SDL_LOG_CATEGORY_AUDIO,
-  pattern SDL_LOG_CATEGORY_VIDEO,
-  pattern SDL_LOG_CATEGORY_RENDER,
-  pattern SDL_LOG_CATEGORY_INPUT,
-  pattern SDL_LOG_CATEGORY_TEST,
-  pattern SDL_LOG_CATEGORY_CUSTOM,
-
-  -- ** Message Box Flags
-  pattern SDL_MESSAGEBOX_ERROR,
-  pattern SDL_MESSAGEBOX_WARNING,
-  pattern SDL_MESSAGEBOX_INFORMATION,
-
-  -- ** Message Box Button Flags
-  pattern SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT,
-  pattern SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT,
-
-  -- ** OpenGL Profile
-  pattern SDL_GL_CONTEXT_PROFILE_CORE,
-  pattern SDL_GL_CONTEXT_PROFILE_COMPATIBILITY,
-  pattern SDL_GL_CONTEXT_PROFILE_ES,
-
-  -- ** OpenGL Context Flag
-  pattern SDL_GL_CONTEXT_DEBUG_FLAG,
-  pattern SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG,
-  pattern SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG,
-  pattern SDL_GL_CONTEXT_RESET_ISOLATION_FLAG,
-
-  -- ** OpenGL Context Release Behavior Flag
-  pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE,
-  pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH,
-
-  -- ** Pixel Formats
-  pattern SDL_PIXELFORMAT_UNKNOWN,
-  pattern SDL_PIXELFORMAT_INDEX1LSB,
-  pattern SDL_PIXELFORMAT_INDEX1MSB,
-  pattern SDL_PIXELFORMAT_INDEX4LSB,
-  pattern SDL_PIXELFORMAT_INDEX4MSB,
-  pattern SDL_PIXELFORMAT_INDEX8,
-  pattern SDL_PIXELFORMAT_RGB332,
-  pattern SDL_PIXELFORMAT_RGB444,
-  pattern SDL_PIXELFORMAT_RGB555,
-  pattern SDL_PIXELFORMAT_BGR555,
-  pattern SDL_PIXELFORMAT_ARGB4444,
-  pattern SDL_PIXELFORMAT_RGBA4444,
-  pattern SDL_PIXELFORMAT_ABGR4444,
-  pattern SDL_PIXELFORMAT_BGRA4444,
-  pattern SDL_PIXELFORMAT_ARGB1555,
-  pattern SDL_PIXELFORMAT_RGBA5551,
-  pattern SDL_PIXELFORMAT_ABGR1555,
-  pattern SDL_PIXELFORMAT_BGRA5551,
-  pattern SDL_PIXELFORMAT_RGB565,
-  pattern SDL_PIXELFORMAT_BGR565,
-  pattern SDL_PIXELFORMAT_RGB24,
-  pattern SDL_PIXELFORMAT_BGR24,
-  pattern SDL_PIXELFORMAT_RGB888,
-  pattern SDL_PIXELFORMAT_RGBX8888,
-  pattern SDL_PIXELFORMAT_BGR888,
-  pattern SDL_PIXELFORMAT_BGRX8888,
-  pattern SDL_PIXELFORMAT_ARGB8888,
-  pattern SDL_PIXELFORMAT_RGBA8888,
-  pattern SDL_PIXELFORMAT_ABGR8888,
-  pattern SDL_PIXELFORMAT_BGRA8888,
-  pattern SDL_PIXELFORMAT_ARGB2101010,
-  pattern SDL_PIXELFORMAT_YV12,
-  pattern SDL_PIXELFORMAT_IYUV,
-  pattern SDL_PIXELFORMAT_YUY2,
-  pattern SDL_PIXELFORMAT_UYVY,
-  pattern SDL_PIXELFORMAT_YVYU,
-
-  -- ** Renderer Flags
-  pattern SDL_RENDERER_SOFTWARE,
-  pattern SDL_RENDERER_ACCELERATED,
-  pattern SDL_RENDERER_PRESENTVSYNC,
-  pattern SDL_RENDERER_TARGETTEXTURE,
-
-  -- ** Texture Access
-  pattern SDL_TEXTUREACCESS_STATIC,
-  pattern SDL_TEXTUREACCESS_STREAMING,
-  pattern SDL_TEXTUREACCESS_TARGET,
-
-  -- ** Texture Modulate
-  pattern SDL_TEXTUREMODULATE_NONE,
-  pattern SDL_TEXTUREMODULATE_COLOR,
-  pattern SDL_TEXTUREMODULATE_ALPHA,
-
-  -- ** Touch
-  pattern SDL_TOUCH_MOUSEID,
-
-  -- ** Window Event
-  pattern SDL_WINDOWEVENT_NONE,
-  pattern SDL_WINDOWEVENT_SHOWN,
-  pattern SDL_WINDOWEVENT_HIDDEN,
-  pattern SDL_WINDOWEVENT_EXPOSED,
-  pattern SDL_WINDOWEVENT_MOVED,
-  pattern SDL_WINDOWEVENT_RESIZED,
-  pattern SDL_WINDOWEVENT_SIZE_CHANGED,
-  pattern SDL_WINDOWEVENT_MINIMIZED,
-  pattern SDL_WINDOWEVENT_MAXIMIZED,
-  pattern SDL_WINDOWEVENT_RESTORED,
-  pattern SDL_WINDOWEVENT_ENTER,
-  pattern SDL_WINDOWEVENT_LEAVE,
-  pattern SDL_WINDOWEVENT_FOCUS_GAINED,
-  pattern SDL_WINDOWEVENT_FOCUS_LOST,
-  pattern SDL_WINDOWEVENT_CLOSE,
-
-  -- ** Window Flags
-  pattern SDL_WINDOW_FULLSCREEN,
-  pattern SDL_WINDOW_OPENGL,
-  pattern SDL_WINDOW_SHOWN,
-  pattern SDL_WINDOW_HIDDEN,
-  pattern SDL_WINDOW_BORDERLESS,
-  pattern SDL_WINDOW_RESIZABLE,
-  pattern SDL_WINDOW_MINIMIZED,
-  pattern SDL_WINDOW_MAXIMIZED,
-  pattern SDL_WINDOW_INPUT_GRABBED,
-  pattern SDL_WINDOW_INPUT_FOCUS,
-  pattern SDL_WINDOW_MOUSE_FOCUS,
-  pattern SDL_WINDOW_FULLSCREEN_DESKTOP,
-  pattern SDL_WINDOW_FOREIGN,
-  pattern SDL_WINDOW_ALLOW_HIGHDPI,
-  pattern SDL_WINDOW_MOUSE_CAPTURE,
-
-  -- ** Window Positioning
-  pattern SDL_WINDOWPOS_UNDEFINED,
-  pattern SDL_WINDOWPOS_CENTERED,
-
-  -- ** Haptic Event Types
-  pattern SDL_HAPTIC_CONSTANT
-) where
-
-#include "SDL.h"
-
-import Data.Int
-import Data.Word
-
-import Foreign.C.Types
-
-type AudioFormat = (#type SDL_AudioFormat)
-type AudioStatus = (#type SDL_AudioStatus)
-type BlendMode = (#type SDL_BlendMode)
-type Endian = CInt
-type EventAction = (#type SDL_eventaction)
-type GameControllerAxis = (#type SDL_GameControllerAxis)
-type GameControllerButton = (#type SDL_GameControllerButton)
-type GLattr = (#type SDL_GLattr)
-type HintPriority = (#type SDL_HintPriority)
-type InitFlag = Word32
-type JoystickPowerLevel = (#type SDL_JoystickPowerLevel)
-type Keycode = (#type SDL_Keycode)
-type Keymod = (#type SDL_Keymod)
-type LogPriority = (#type SDL_LogPriority)
-type PowerState = (#type SDL_PowerState)
-type RendererFlip = (#type SDL_RendererFlip)
-type Scancode = (#type SDL_Scancode)
-type SystemCursor = (#type SDL_SystemCursor)
-type ThreadPriority = (#type SDL_ThreadPriority)
-
-pattern SDL_AUDIO_S8 = (#const AUDIO_S8) :: AudioFormat
-pattern SDL_AUDIO_U8 = (#const AUDIO_U8) :: AudioFormat
-pattern SDL_AUDIO_S16LSB = (#const AUDIO_S16LSB) :: AudioFormat
-pattern SDL_AUDIO_S16MSB = (#const AUDIO_S16MSB) :: AudioFormat
-pattern SDL_AUDIO_S16SYS = (#const AUDIO_S16SYS) :: AudioFormat
-pattern SDL_AUDIO_U16LSB = (#const AUDIO_U16LSB) :: AudioFormat
-pattern SDL_AUDIO_U16MSB = (#const AUDIO_U16MSB) :: AudioFormat
-pattern SDL_AUDIO_U16SYS = (#const AUDIO_U16SYS) :: AudioFormat
-pattern SDL_AUDIO_S32LSB = (#const AUDIO_S32LSB) :: AudioFormat
-pattern SDL_AUDIO_S32MSB = (#const AUDIO_S32MSB) :: AudioFormat
-pattern SDL_AUDIO_S32SYS = (#const AUDIO_S32SYS) :: AudioFormat
-pattern SDL_AUDIO_F32LSB = (#const AUDIO_F32LSB) :: AudioFormat
-pattern SDL_AUDIO_F32MSB = (#const AUDIO_F32MSB) :: AudioFormat
-pattern SDL_AUDIO_F32SYS = (#const AUDIO_F32SYS) :: AudioFormat
-
-pattern SDL_AUDIO_STOPPED = (#const SDL_AUDIO_STOPPED) :: AudioStatus
-pattern SDL_AUDIO_PLAYING = (#const SDL_AUDIO_PLAYING) :: AudioStatus
-pattern SDL_AUDIO_PAUSED = (#const SDL_AUDIO_PAUSED) :: AudioStatus
-
-pattern SDL_BLENDMODE_NONE = (#const SDL_BLENDMODE_NONE) :: BlendMode
-pattern SDL_BLENDMODE_BLEND = (#const SDL_BLENDMODE_BLEND) :: BlendMode
-pattern SDL_BLENDMODE_ADD = (#const SDL_BLENDMODE_ADD) :: BlendMode
-pattern SDL_BLENDMODE_MOD = (#const SDL_BLENDMODE_MOD) :: BlendMode
-
-pattern SDL_BYTEORDER = (#const SDL_BYTEORDER) :: Endian
-pattern SDL_LIL_ENDIAN = (#const SDL_LIL_ENDIAN) :: Endian
-pattern SDL_BIG_ENDIAN = (#const SDL_BIG_ENDIAN) :: Endian
-
-pattern SDL_ADDEVENT = (#const SDL_ADDEVENT) :: EventAction
-pattern SDL_PEEKEVENT = (#const SDL_PEEKEVENT) :: EventAction
-pattern SDL_GETEVENT = (#const SDL_GETEVENT) :: EventAction
-
-pattern SDL_CONTROLLER_AXIS_INVALID = (#const SDL_CONTROLLER_AXIS_INVALID) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_LEFTX = (#const SDL_CONTROLLER_AXIS_LEFTX) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_LEFTY = (#const SDL_CONTROLLER_AXIS_LEFTY) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_RIGHTX = (#const SDL_CONTROLLER_AXIS_RIGHTX) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_RIGHTY = (#const SDL_CONTROLLER_AXIS_RIGHTY) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_TRIGGERLEFT = (#const SDL_CONTROLLER_AXIS_TRIGGERLEFT) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_TRIGGERRIGHT = (#const SDL_CONTROLLER_AXIS_TRIGGERRIGHT) :: GameControllerAxis
-pattern SDL_CONTROLLER_AXIS_MAX = (#const SDL_CONTROLLER_AXIS_MAX) :: GameControllerAxis
-
-pattern SDL_CONTROLLER_BUTTON_INVALID = (#const SDL_CONTROLLER_BUTTON_INVALID) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_A = (#const SDL_CONTROLLER_BUTTON_A) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_B = (#const SDL_CONTROLLER_BUTTON_B) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_X = (#const SDL_CONTROLLER_BUTTON_X) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_Y = (#const SDL_CONTROLLER_BUTTON_Y) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_BACK = (#const SDL_CONTROLLER_BUTTON_BACK) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_GUIDE = (#const SDL_CONTROLLER_BUTTON_GUIDE) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_START = (#const SDL_CONTROLLER_BUTTON_START) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_LEFTSTICK = (#const SDL_CONTROLLER_BUTTON_LEFTSTICK) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_RIGHTSTICK = (#const SDL_CONTROLLER_BUTTON_RIGHTSTICK) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_LEFTSHOULDER = (#const SDL_CONTROLLER_BUTTON_LEFTSHOULDER) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = (#const SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_DPAD_UP = (#const SDL_CONTROLLER_BUTTON_DPAD_UP) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_DPAD_DOWN = (#const SDL_CONTROLLER_BUTTON_DPAD_DOWN) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_DPAD_LEFT = (#const SDL_CONTROLLER_BUTTON_DPAD_LEFT) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_DPAD_RIGHT = (#const SDL_CONTROLLER_BUTTON_DPAD_RIGHT) :: GameControllerButton
-pattern SDL_CONTROLLER_BUTTON_MAX = (#const SDL_CONTROLLER_BUTTON_MAX) :: GameControllerButton
-
-pattern SDL_GL_RED_SIZE = (#const SDL_GL_RED_SIZE) :: GLattr
-pattern SDL_GL_GREEN_SIZE = (#const SDL_GL_GREEN_SIZE) :: GLattr
-pattern SDL_GL_BLUE_SIZE = (#const SDL_GL_BLUE_SIZE) :: GLattr
-pattern SDL_GL_ALPHA_SIZE = (#const SDL_GL_ALPHA_SIZE) :: GLattr
-pattern SDL_GL_BUFFER_SIZE = (#const SDL_GL_BUFFER_SIZE) :: GLattr
-pattern SDL_GL_DOUBLEBUFFER = (#const SDL_GL_DOUBLEBUFFER) :: GLattr
-pattern SDL_GL_DEPTH_SIZE = (#const SDL_GL_DEPTH_SIZE) :: GLattr
-pattern SDL_GL_STENCIL_SIZE = (#const SDL_GL_STENCIL_SIZE) :: GLattr
-pattern SDL_GL_ACCUM_RED_SIZE = (#const SDL_GL_ACCUM_RED_SIZE) :: GLattr
-pattern SDL_GL_ACCUM_GREEN_SIZE = (#const SDL_GL_ACCUM_GREEN_SIZE) :: GLattr
-pattern SDL_GL_ACCUM_BLUE_SIZE = (#const SDL_GL_ACCUM_BLUE_SIZE) :: GLattr
-pattern SDL_GL_ACCUM_ALPHA_SIZE = (#const SDL_GL_ACCUM_ALPHA_SIZE) :: GLattr
-pattern SDL_GL_STEREO = (#const SDL_GL_STEREO) :: GLattr
-pattern SDL_GL_MULTISAMPLEBUFFERS = (#const SDL_GL_MULTISAMPLEBUFFERS) :: GLattr
-pattern SDL_GL_MULTISAMPLESAMPLES = (#const SDL_GL_MULTISAMPLESAMPLES) :: GLattr
-pattern SDL_GL_ACCELERATED_VISUAL = (#const SDL_GL_ACCELERATED_VISUAL) :: GLattr
-pattern SDL_GL_RETAINED_BACKING = (#const SDL_GL_RETAINED_BACKING) :: GLattr
-pattern SDL_GL_CONTEXT_MAJOR_VERSION = (#const SDL_GL_CONTEXT_MAJOR_VERSION) :: GLattr
-pattern SDL_GL_CONTEXT_MINOR_VERSION = (#const SDL_GL_CONTEXT_MINOR_VERSION) :: GLattr
-pattern SDL_GL_CONTEXT_EGL = (#const SDL_GL_CONTEXT_EGL) :: GLattr
-pattern SDL_GL_CONTEXT_FLAGS = (#const SDL_GL_CONTEXT_FLAGS) :: GLattr
-pattern SDL_GL_CONTEXT_PROFILE_MASK = (#const SDL_GL_CONTEXT_PROFILE_MASK) :: GLattr
-pattern SDL_GL_SHARE_WITH_CURRENT_CONTEXT = (#const SDL_GL_SHARE_WITH_CURRENT_CONTEXT) :: GLattr
-pattern SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = (#const SDL_GL_FRAMEBUFFER_SRGB_CAPABLE) :: GLattr
-pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR = (#const SDL_GL_CONTEXT_RELEASE_BEHAVIOR) :: GLattr
-
-pattern SDL_HINT_DEFAULT = (#const SDL_HINT_DEFAULT) :: HintPriority
-pattern SDL_HINT_NORMAL = (#const SDL_HINT_NORMAL) :: HintPriority
-pattern SDL_HINT_OVERRIDE = (#const SDL_HINT_OVERRIDE) :: HintPriority
-
-pattern SDL_INIT_TIMER = (#const SDL_INIT_TIMER) :: InitFlag
-pattern SDL_INIT_AUDIO = (#const SDL_INIT_AUDIO) :: InitFlag
-pattern SDL_INIT_VIDEO = (#const SDL_INIT_VIDEO) :: InitFlag
-pattern SDL_INIT_JOYSTICK = (#const SDL_INIT_JOYSTICK) :: InitFlag
-pattern SDL_INIT_HAPTIC = (#const SDL_INIT_HAPTIC) :: InitFlag
-pattern SDL_INIT_GAMECONTROLLER = (#const SDL_INIT_GAMECONTROLLER) :: InitFlag
-pattern SDL_INIT_EVENTS = (#const SDL_INIT_EVENTS) :: InitFlag
-pattern SDL_INIT_NOPARACHUTE = (#const SDL_INIT_NOPARACHUTE) :: InitFlag
-pattern SDL_INIT_EVERYTHING = (#const SDL_INIT_EVERYTHING) :: InitFlag
-
-pattern SDL_JOYSTICK_POWER_UNKNOWN = (#const SDL_JOYSTICK_POWER_UNKNOWN) :: JoystickPowerLevel
-pattern SDL_JOYSTICK_POWER_EMPTY = (#const SDL_JOYSTICK_POWER_EMPTY) :: JoystickPowerLevel
-pattern SDL_JOYSTICK_POWER_LOW = (#const SDL_JOYSTICK_POWER_LOW) :: JoystickPowerLevel
-pattern SDL_JOYSTICK_POWER_MEDIUM = (#const SDL_JOYSTICK_POWER_MEDIUM) :: JoystickPowerLevel
-pattern SDL_JOYSTICK_POWER_FULL = (#const SDL_JOYSTICK_POWER_FULL) :: JoystickPowerLevel
-pattern SDL_JOYSTICK_POWER_WIRED = (#const SDL_JOYSTICK_POWER_WIRED) :: JoystickPowerLevel
-pattern SDL_JOYSTICK_POWER_MAX = (#const SDL_JOYSTICK_POWER_MAX) :: JoystickPowerLevel
-
-pattern SDLK_UNKNOWN = (#const SDLK_UNKNOWN) :: Keycode
-pattern SDLK_RETURN = (#const SDLK_RETURN) :: Keycode
-pattern SDLK_ESCAPE = (#const SDLK_ESCAPE) :: Keycode
-pattern SDLK_BACKSPACE = (#const SDLK_BACKSPACE) :: Keycode
-pattern SDLK_TAB = (#const SDLK_TAB) :: Keycode
-pattern SDLK_SPACE = (#const SDLK_SPACE) :: Keycode
-pattern SDLK_EXCLAIM = (#const SDLK_EXCLAIM) :: Keycode
-pattern SDLK_QUOTEDBL = (#const SDLK_QUOTEDBL) :: Keycode
-pattern SDLK_HASH = (#const SDLK_HASH) :: Keycode
-pattern SDLK_PERCENT = (#const SDLK_PERCENT) :: Keycode
-pattern SDLK_DOLLAR = (#const SDLK_DOLLAR) :: Keycode
-pattern SDLK_AMPERSAND = (#const SDLK_AMPERSAND) :: Keycode
-pattern SDLK_QUOTE = (#const SDLK_QUOTE) :: Keycode
-pattern SDLK_LEFTPAREN = (#const SDLK_LEFTPAREN) :: Keycode
-pattern SDLK_RIGHTPAREN = (#const SDLK_RIGHTPAREN) :: Keycode
-pattern SDLK_ASTERISK = (#const SDLK_ASTERISK) :: Keycode
-pattern SDLK_PLUS = (#const SDLK_PLUS) :: Keycode
-pattern SDLK_COMMA = (#const SDLK_COMMA) :: Keycode
-pattern SDLK_MINUS = (#const SDLK_MINUS) :: Keycode
-pattern SDLK_PERIOD = (#const SDLK_PERIOD) :: Keycode
-pattern SDLK_SLASH = (#const SDLK_SLASH) :: Keycode
-pattern SDLK_0 = (#const SDLK_0) :: Keycode
-pattern SDLK_1 = (#const SDLK_1) :: Keycode
-pattern SDLK_2 = (#const SDLK_2) :: Keycode
-pattern SDLK_3 = (#const SDLK_3) :: Keycode
-pattern SDLK_4 = (#const SDLK_4) :: Keycode
-pattern SDLK_5 = (#const SDLK_5) :: Keycode
-pattern SDLK_6 = (#const SDLK_6) :: Keycode
-pattern SDLK_7 = (#const SDLK_7) :: Keycode
-pattern SDLK_8 = (#const SDLK_8) :: Keycode
-pattern SDLK_9 = (#const SDLK_9) :: Keycode
-pattern SDLK_COLON = (#const SDLK_COLON) :: Keycode
-pattern SDLK_SEMICOLON = (#const SDLK_SEMICOLON) :: Keycode
-pattern SDLK_LESS = (#const SDLK_LESS) :: Keycode
-pattern SDLK_EQUALS = (#const SDLK_EQUALS) :: Keycode
-pattern SDLK_GREATER = (#const SDLK_GREATER) :: Keycode
-pattern SDLK_QUESTION = (#const SDLK_QUESTION) :: Keycode
-pattern SDLK_AT = (#const SDLK_AT) :: Keycode
-pattern SDLK_LEFTBRACKET = (#const SDLK_LEFTBRACKET) :: Keycode
-pattern SDLK_BACKSLASH = (#const SDLK_BACKSLASH) :: Keycode
-pattern SDLK_RIGHTBRACKET = (#const SDLK_RIGHTBRACKET) :: Keycode
-pattern SDLK_CARET = (#const SDLK_CARET) :: Keycode
-pattern SDLK_UNDERSCORE = (#const SDLK_UNDERSCORE) :: Keycode
-pattern SDLK_BACKQUOTE = (#const SDLK_BACKQUOTE) :: Keycode
-pattern SDLK_a = (#const SDLK_a) :: Keycode
-pattern SDLK_b = (#const SDLK_b) :: Keycode
-pattern SDLK_c = (#const SDLK_c) :: Keycode
-pattern SDLK_d = (#const SDLK_d) :: Keycode
-pattern SDLK_e = (#const SDLK_e) :: Keycode
-pattern SDLK_f = (#const SDLK_f) :: Keycode
-pattern SDLK_g = (#const SDLK_g) :: Keycode
-pattern SDLK_h = (#const SDLK_h) :: Keycode
-pattern SDLK_i = (#const SDLK_i) :: Keycode
-pattern SDLK_j = (#const SDLK_j) :: Keycode
-pattern SDLK_k = (#const SDLK_k) :: Keycode
-pattern SDLK_l = (#const SDLK_l) :: Keycode
-pattern SDLK_m = (#const SDLK_m) :: Keycode
-pattern SDLK_n = (#const SDLK_n) :: Keycode
-pattern SDLK_o = (#const SDLK_o) :: Keycode
-pattern SDLK_p = (#const SDLK_p) :: Keycode
-pattern SDLK_q = (#const SDLK_q) :: Keycode
-pattern SDLK_r = (#const SDLK_r) :: Keycode
-pattern SDLK_s = (#const SDLK_s) :: Keycode
-pattern SDLK_t = (#const SDLK_t) :: Keycode
-pattern SDLK_u = (#const SDLK_u) :: Keycode
-pattern SDLK_v = (#const SDLK_v) :: Keycode
-pattern SDLK_w = (#const SDLK_w) :: Keycode
-pattern SDLK_x = (#const SDLK_x) :: Keycode
-pattern SDLK_y = (#const SDLK_y) :: Keycode
-pattern SDLK_z = (#const SDLK_z) :: Keycode
-pattern SDLK_CAPSLOCK = (#const SDLK_CAPSLOCK) :: Keycode
-pattern SDLK_F1 = (#const SDLK_F1) :: Keycode
-pattern SDLK_F2 = (#const SDLK_F2) :: Keycode
-pattern SDLK_F3 = (#const SDLK_F3) :: Keycode
-pattern SDLK_F4 = (#const SDLK_F4) :: Keycode
-pattern SDLK_F5 = (#const SDLK_F5) :: Keycode
-pattern SDLK_F6 = (#const SDLK_F6) :: Keycode
-pattern SDLK_F7 = (#const SDLK_F7) :: Keycode
-pattern SDLK_F8 = (#const SDLK_F8) :: Keycode
-pattern SDLK_F9 = (#const SDLK_F9) :: Keycode
-pattern SDLK_F10 = (#const SDLK_F10) :: Keycode
-pattern SDLK_F11 = (#const SDLK_F11) :: Keycode
-pattern SDLK_F12 = (#const SDLK_F12) :: Keycode
-pattern SDLK_PRINTSCREEN = (#const SDLK_PRINTSCREEN) :: Keycode
-pattern SDLK_SCROLLLOCK = (#const SDLK_SCROLLLOCK) :: Keycode
-pattern SDLK_PAUSE = (#const SDLK_PAUSE) :: Keycode
-pattern SDLK_INSERT = (#const SDLK_INSERT) :: Keycode
-pattern SDLK_HOME = (#const SDLK_HOME) :: Keycode
-pattern SDLK_PAGEUP = (#const SDLK_PAGEUP) :: Keycode
-pattern SDLK_DELETE = (#const SDLK_DELETE) :: Keycode
-pattern SDLK_END = (#const SDLK_END) :: Keycode
-pattern SDLK_PAGEDOWN = (#const SDLK_PAGEDOWN) :: Keycode
-pattern SDLK_RIGHT = (#const SDLK_RIGHT) :: Keycode
-pattern SDLK_LEFT = (#const SDLK_LEFT) :: Keycode
-pattern SDLK_DOWN = (#const SDLK_DOWN) :: Keycode
-pattern SDLK_UP = (#const SDLK_UP) :: Keycode
-pattern SDLK_NUMLOCKCLEAR = (#const SDLK_NUMLOCKCLEAR) :: Keycode
-pattern SDLK_KP_DIVIDE = (#const SDLK_KP_DIVIDE) :: Keycode
-pattern SDLK_KP_MULTIPLY = (#const SDLK_KP_MULTIPLY) :: Keycode
-pattern SDLK_KP_MINUS = (#const SDLK_KP_MINUS) :: Keycode
-pattern SDLK_KP_PLUS = (#const SDLK_KP_PLUS) :: Keycode
-pattern SDLK_KP_ENTER = (#const SDLK_KP_ENTER) :: Keycode
-pattern SDLK_KP_1 = (#const SDLK_KP_1) :: Keycode
-pattern SDLK_KP_2 = (#const SDLK_KP_2) :: Keycode
-pattern SDLK_KP_3 = (#const SDLK_KP_3) :: Keycode
-pattern SDLK_KP_4 = (#const SDLK_KP_4) :: Keycode
-pattern SDLK_KP_5 = (#const SDLK_KP_5) :: Keycode
-pattern SDLK_KP_6 = (#const SDLK_KP_6) :: Keycode
-pattern SDLK_KP_7 = (#const SDLK_KP_7) :: Keycode
-pattern SDLK_KP_8 = (#const SDLK_KP_8) :: Keycode
-pattern SDLK_KP_9 = (#const SDLK_KP_9) :: Keycode
-pattern SDLK_KP_0 = (#const SDLK_KP_0) :: Keycode
-pattern SDLK_KP_PERIOD = (#const SDLK_KP_PERIOD) :: Keycode
-pattern SDLK_APPLICATION = (#const SDLK_APPLICATION) :: Keycode
-pattern SDLK_POWER = (#const SDLK_POWER) :: Keycode
-pattern SDLK_KP_EQUALS = (#const SDLK_KP_EQUALS) :: Keycode
-pattern SDLK_F13 = (#const SDLK_F13) :: Keycode
-pattern SDLK_F14 = (#const SDLK_F14) :: Keycode
-pattern SDLK_F15 = (#const SDLK_F15) :: Keycode
-pattern SDLK_F16 = (#const SDLK_F16) :: Keycode
-pattern SDLK_F17 = (#const SDLK_F17) :: Keycode
-pattern SDLK_F18 = (#const SDLK_F18) :: Keycode
-pattern SDLK_F19 = (#const SDLK_F19) :: Keycode
-pattern SDLK_F20 = (#const SDLK_F20) :: Keycode
-pattern SDLK_F21 = (#const SDLK_F21) :: Keycode
-pattern SDLK_F22 = (#const SDLK_F22) :: Keycode
-pattern SDLK_F23 = (#const SDLK_F23) :: Keycode
-pattern SDLK_F24 = (#const SDLK_F24) :: Keycode
-pattern SDLK_EXECUTE = (#const SDLK_EXECUTE) :: Keycode
-pattern SDLK_HELP = (#const SDLK_HELP) :: Keycode
-pattern SDLK_MENU = (#const SDLK_MENU) :: Keycode
-pattern SDLK_SELECT = (#const SDLK_SELECT) :: Keycode
-pattern SDLK_STOP = (#const SDLK_STOP) :: Keycode
-pattern SDLK_AGAIN = (#const SDLK_AGAIN) :: Keycode
-pattern SDLK_UNDO = (#const SDLK_UNDO) :: Keycode
-pattern SDLK_CUT = (#const SDLK_CUT) :: Keycode
-pattern SDLK_COPY = (#const SDLK_COPY) :: Keycode
-pattern SDLK_PASTE = (#const SDLK_PASTE) :: Keycode
-pattern SDLK_FIND = (#const SDLK_FIND) :: Keycode
-pattern SDLK_MUTE = (#const SDLK_MUTE) :: Keycode
-pattern SDLK_VOLUMEUP = (#const SDLK_VOLUMEUP) :: Keycode
-pattern SDLK_VOLUMEDOWN = (#const SDLK_VOLUMEDOWN) :: Keycode
-pattern SDLK_KP_COMMA = (#const SDLK_KP_COMMA) :: Keycode
-pattern SDLK_KP_EQUALSAS400 = (#const SDLK_KP_EQUALSAS400) :: Keycode
-pattern SDLK_ALTERASE = (#const SDLK_ALTERASE) :: Keycode
-pattern SDLK_SYSREQ = (#const SDLK_SYSREQ) :: Keycode
-pattern SDLK_CANCEL = (#const SDLK_CANCEL) :: Keycode
-pattern SDLK_CLEAR = (#const SDLK_CLEAR) :: Keycode
-pattern SDLK_PRIOR = (#const SDLK_PRIOR) :: Keycode
-pattern SDLK_RETURN2 = (#const SDLK_RETURN2) :: Keycode
-pattern SDLK_SEPARATOR = (#const SDLK_SEPARATOR) :: Keycode
-pattern SDLK_OUT = (#const SDLK_OUT) :: Keycode
-pattern SDLK_OPER = (#const SDLK_OPER) :: Keycode
-pattern SDLK_CLEARAGAIN = (#const SDLK_CLEARAGAIN) :: Keycode
-pattern SDLK_CRSEL = (#const SDLK_CRSEL) :: Keycode
-pattern SDLK_EXSEL = (#const SDLK_EXSEL) :: Keycode
-pattern SDLK_KP_00 = (#const SDLK_KP_00) :: Keycode
-pattern SDLK_KP_000 = (#const SDLK_KP_000) :: Keycode
-pattern SDLK_THOUSANDSSEPARATOR = (#const SDLK_THOUSANDSSEPARATOR) :: Keycode
-pattern SDLK_DECIMALSEPARATOR = (#const SDLK_DECIMALSEPARATOR) :: Keycode
-pattern SDLK_CURRENCYUNIT = (#const SDLK_CURRENCYUNIT) :: Keycode
-pattern SDLK_CURRENCYSUBUNIT = (#const SDLK_CURRENCYSUBUNIT) :: Keycode
-pattern SDLK_KP_LEFTPAREN = (#const SDLK_KP_LEFTPAREN) :: Keycode
-pattern SDLK_KP_RIGHTPAREN = (#const SDLK_KP_RIGHTPAREN) :: Keycode
-pattern SDLK_KP_LEFTBRACE = (#const SDLK_KP_LEFTBRACE) :: Keycode
-pattern SDLK_KP_RIGHTBRACE = (#const SDLK_KP_RIGHTBRACE) :: Keycode
-pattern SDLK_KP_TAB = (#const SDLK_KP_TAB) :: Keycode
-pattern SDLK_KP_BACKSPACE = (#const SDLK_KP_BACKSPACE) :: Keycode
-pattern SDLK_KP_A = (#const SDLK_KP_A) :: Keycode
-pattern SDLK_KP_B = (#const SDLK_KP_B) :: Keycode
-pattern SDLK_KP_C = (#const SDLK_KP_C) :: Keycode
-pattern SDLK_KP_D = (#const SDLK_KP_D) :: Keycode
-pattern SDLK_KP_E = (#const SDLK_KP_E) :: Keycode
-pattern SDLK_KP_F = (#const SDLK_KP_F) :: Keycode
-pattern SDLK_KP_XOR = (#const SDLK_KP_XOR) :: Keycode
-pattern SDLK_KP_POWER = (#const SDLK_KP_POWER) :: Keycode
-pattern SDLK_KP_PERCENT = (#const SDLK_KP_PERCENT) :: Keycode
-pattern SDLK_KP_LESS = (#const SDLK_KP_LESS) :: Keycode
-pattern SDLK_KP_GREATER = (#const SDLK_KP_GREATER) :: Keycode
-pattern SDLK_KP_AMPERSAND = (#const SDLK_KP_AMPERSAND) :: Keycode
-pattern SDLK_KP_DBLAMPERSAND = (#const SDLK_KP_DBLAMPERSAND) :: Keycode
-pattern SDLK_KP_VERTICALBAR = (#const SDLK_KP_VERTICALBAR) :: Keycode
-pattern SDLK_KP_DBLVERTICALBAR = (#const SDLK_KP_DBLVERTICALBAR) :: Keycode
-pattern SDLK_KP_COLON = (#const SDLK_KP_COLON) :: Keycode
-pattern SDLK_KP_HASH = (#const SDLK_KP_HASH) :: Keycode
-pattern SDLK_KP_SPACE = (#const SDLK_KP_SPACE) :: Keycode
-pattern SDLK_KP_AT = (#const SDLK_KP_AT) :: Keycode
-pattern SDLK_KP_EXCLAM = (#const SDLK_KP_EXCLAM) :: Keycode
-pattern SDLK_KP_MEMSTORE = (#const SDLK_KP_MEMSTORE) :: Keycode
-pattern SDLK_KP_MEMRECALL = (#const SDLK_KP_MEMRECALL) :: Keycode
-pattern SDLK_KP_MEMCLEAR = (#const SDLK_KP_MEMCLEAR) :: Keycode
-pattern SDLK_KP_MEMADD = (#const SDLK_KP_MEMADD) :: Keycode
-pattern SDLK_KP_MEMSUBTRACT = (#const SDLK_KP_MEMSUBTRACT) :: Keycode
-pattern SDLK_KP_MEMMULTIPLY = (#const SDLK_KP_MEMMULTIPLY) :: Keycode
-pattern SDLK_KP_MEMDIVIDE = (#const SDLK_KP_MEMDIVIDE) :: Keycode
-pattern SDLK_KP_PLUSMINUS = (#const SDLK_KP_PLUSMINUS) :: Keycode
-pattern SDLK_KP_CLEAR = (#const SDLK_KP_CLEAR) :: Keycode
-pattern SDLK_KP_CLEARENTRY = (#const SDLK_KP_CLEARENTRY) :: Keycode
-pattern SDLK_KP_BINARY = (#const SDLK_KP_BINARY) :: Keycode
-pattern SDLK_KP_OCTAL = (#const SDLK_KP_OCTAL) :: Keycode
-pattern SDLK_KP_DECIMAL = (#const SDLK_KP_DECIMAL) :: Keycode
-pattern SDLK_KP_HEXADECIMAL = (#const SDLK_KP_HEXADECIMAL) :: Keycode
-pattern SDLK_LCTRL = (#const SDLK_LCTRL) :: Keycode
-pattern SDLK_LSHIFT = (#const SDLK_LSHIFT) :: Keycode
-pattern SDLK_LALT = (#const SDLK_LALT) :: Keycode
-pattern SDLK_LGUI = (#const SDLK_LGUI) :: Keycode
-pattern SDLK_RCTRL = (#const SDLK_RCTRL) :: Keycode
-pattern SDLK_RSHIFT = (#const SDLK_RSHIFT) :: Keycode
-pattern SDLK_RALT = (#const SDLK_RALT) :: Keycode
-pattern SDLK_RGUI = (#const SDLK_RGUI) :: Keycode
-pattern SDLK_MODE = (#const SDLK_MODE) :: Keycode
-pattern SDLK_AUDIONEXT = (#const SDLK_AUDIONEXT) :: Keycode
-pattern SDLK_AUDIOPREV = (#const SDLK_AUDIOPREV) :: Keycode
-pattern SDLK_AUDIOSTOP = (#const SDLK_AUDIOSTOP) :: Keycode
-pattern SDLK_AUDIOPLAY = (#const SDLK_AUDIOPLAY) :: Keycode
-pattern SDLK_AUDIOMUTE = (#const SDLK_AUDIOMUTE) :: Keycode
-pattern SDLK_MEDIASELECT = (#const SDLK_MEDIASELECT) :: Keycode
-pattern SDLK_WWW = (#const SDLK_WWW) :: Keycode
-pattern SDLK_MAIL = (#const SDLK_MAIL) :: Keycode
-pattern SDLK_CALCULATOR = (#const SDLK_CALCULATOR) :: Keycode
-pattern SDLK_COMPUTER = (#const SDLK_COMPUTER) :: Keycode
-pattern SDLK_AC_SEARCH = (#const SDLK_AC_SEARCH) :: Keycode
-pattern SDLK_AC_HOME = (#const SDLK_AC_HOME) :: Keycode
-pattern SDLK_AC_BACK = (#const SDLK_AC_BACK) :: Keycode
-pattern SDLK_AC_FORWARD = (#const SDLK_AC_FORWARD) :: Keycode
-pattern SDLK_AC_STOP = (#const SDLK_AC_STOP) :: Keycode
-pattern SDLK_AC_REFRESH = (#const SDLK_AC_REFRESH) :: Keycode
-pattern SDLK_AC_BOOKMARKS = (#const SDLK_AC_BOOKMARKS) :: Keycode
-pattern SDLK_BRIGHTNESSDOWN = (#const SDLK_BRIGHTNESSDOWN) :: Keycode
-pattern SDLK_BRIGHTNESSUP = (#const SDLK_BRIGHTNESSUP) :: Keycode
-pattern SDLK_DISPLAYSWITCH = (#const SDLK_DISPLAYSWITCH) :: Keycode
-pattern SDLK_KBDILLUMTOGGLE = (#const SDLK_KBDILLUMTOGGLE) :: Keycode
-pattern SDLK_KBDILLUMDOWN = (#const SDLK_KBDILLUMDOWN) :: Keycode
-pattern SDLK_KBDILLUMUP = (#const SDLK_KBDILLUMUP) :: Keycode
-pattern SDLK_EJECT = (#const SDLK_EJECT) :: Keycode
-pattern SDLK_SLEEP = (#const SDLK_SLEEP) :: Keycode
-
-pattern KMOD_NONE = (#const KMOD_NONE)
-pattern KMOD_LSHIFT = (#const KMOD_LSHIFT)
-pattern KMOD_RSHIFT = (#const KMOD_RSHIFT)
-pattern KMOD_SHIFT = (#const KMOD_SHIFT)
-pattern KMOD_LCTRL = (#const KMOD_LCTRL)
-pattern KMOD_RCTRL = (#const KMOD_RCTRL)
-pattern KMOD_CTRL = (#const KMOD_CTRL)
-pattern KMOD_LALT = (#const KMOD_LALT)
-pattern KMOD_RALT = (#const KMOD_RALT)
-pattern KMOD_ALT = (#const KMOD_ALT)
-pattern KMOD_LGUI = (#const KMOD_LGUI)
-pattern KMOD_RGUI = (#const KMOD_RGUI)
-pattern KMOD_GUI = (#const KMOD_GUI)
-pattern KMOD_NUM = (#const KMOD_NUM)
-pattern KMOD_CAPS = (#const KMOD_CAPS)
-pattern KMOD_MODE = (#const KMOD_MODE)
-pattern KMOD_RESERVED = (#const KMOD_RESERVED)
-
-pattern SDL_LOG_PRIORITY_VERBOSE = (#const SDL_LOG_PRIORITY_VERBOSE) :: LogPriority
-pattern SDL_LOG_PRIORITY_DEBUG = (#const SDL_LOG_PRIORITY_DEBUG) :: LogPriority
-pattern SDL_LOG_PRIORITY_INFO = (#const SDL_LOG_PRIORITY_INFO) :: LogPriority
-pattern SDL_LOG_PRIORITY_WARN = (#const SDL_LOG_PRIORITY_WARN) :: LogPriority
-pattern SDL_LOG_PRIORITY_ERROR = (#const SDL_LOG_PRIORITY_ERROR) :: LogPriority
-pattern SDL_LOG_PRIORITY_CRITICAL = (#const SDL_LOG_PRIORITY_CRITICAL) :: LogPriority
-pattern SDL_NUM_LOG_PRIORITIES = (#const SDL_NUM_LOG_PRIORITIES) :: LogPriority
-
-pattern SDL_POWERSTATE_UNKNOWN = (#const SDL_POWERSTATE_UNKNOWN) :: PowerState
-pattern SDL_POWERSTATE_ON_BATTERY = (#const SDL_POWERSTATE_ON_BATTERY) :: PowerState
-pattern SDL_POWERSTATE_NO_BATTERY = (#const SDL_POWERSTATE_NO_BATTERY) :: PowerState
-pattern SDL_POWERSTATE_CHARGING = (#const SDL_POWERSTATE_CHARGING) :: PowerState
-pattern SDL_POWERSTATE_CHARGED = (#const SDL_POWERSTATE_CHARGED) :: PowerState
-
-pattern SDL_FLIP_NONE = (#const SDL_FLIP_NONE) :: RendererFlip
-pattern SDL_FLIP_HORIZONTAL = (#const SDL_FLIP_HORIZONTAL) :: RendererFlip
-pattern SDL_FLIP_VERTICAL = (#const SDL_FLIP_VERTICAL) :: RendererFlip
-
-pattern SDL_SCANCODE_UNKNOWN = (#const SDL_SCANCODE_UNKNOWN) :: Scancode
-pattern SDL_SCANCODE_A = (#const SDL_SCANCODE_A) :: Scancode
-pattern SDL_SCANCODE_B = (#const SDL_SCANCODE_B) :: Scancode
-pattern SDL_SCANCODE_C = (#const SDL_SCANCODE_C) :: Scancode
-pattern SDL_SCANCODE_D = (#const SDL_SCANCODE_D) :: Scancode
-pattern SDL_SCANCODE_E = (#const SDL_SCANCODE_E) :: Scancode
-pattern SDL_SCANCODE_F = (#const SDL_SCANCODE_F) :: Scancode
-pattern SDL_SCANCODE_G = (#const SDL_SCANCODE_G) :: Scancode
-pattern SDL_SCANCODE_H = (#const SDL_SCANCODE_H) :: Scancode
-pattern SDL_SCANCODE_I = (#const SDL_SCANCODE_I) :: Scancode
-pattern SDL_SCANCODE_J = (#const SDL_SCANCODE_J) :: Scancode
-pattern SDL_SCANCODE_K = (#const SDL_SCANCODE_K) :: Scancode
-pattern SDL_SCANCODE_L = (#const SDL_SCANCODE_L) :: Scancode
-pattern SDL_SCANCODE_M = (#const SDL_SCANCODE_M) :: Scancode
-pattern SDL_SCANCODE_N = (#const SDL_SCANCODE_N) :: Scancode
-pattern SDL_SCANCODE_O = (#const SDL_SCANCODE_O) :: Scancode
-pattern SDL_SCANCODE_P = (#const SDL_SCANCODE_P) :: Scancode
-pattern SDL_SCANCODE_Q = (#const SDL_SCANCODE_Q) :: Scancode
-pattern SDL_SCANCODE_R = (#const SDL_SCANCODE_R) :: Scancode
-pattern SDL_SCANCODE_S = (#const SDL_SCANCODE_S) :: Scancode
-pattern SDL_SCANCODE_T = (#const SDL_SCANCODE_T) :: Scancode
-pattern SDL_SCANCODE_U = (#const SDL_SCANCODE_U) :: Scancode
-pattern SDL_SCANCODE_V = (#const SDL_SCANCODE_V) :: Scancode
-pattern SDL_SCANCODE_W = (#const SDL_SCANCODE_W) :: Scancode
-pattern SDL_SCANCODE_X = (#const SDL_SCANCODE_X) :: Scancode
-pattern SDL_SCANCODE_Y = (#const SDL_SCANCODE_Y) :: Scancode
-pattern SDL_SCANCODE_Z = (#const SDL_SCANCODE_Z) :: Scancode
-pattern SDL_SCANCODE_1 = (#const SDL_SCANCODE_1) :: Scancode
-pattern SDL_SCANCODE_2 = (#const SDL_SCANCODE_2) :: Scancode
-pattern SDL_SCANCODE_3 = (#const SDL_SCANCODE_3) :: Scancode
-pattern SDL_SCANCODE_4 = (#const SDL_SCANCODE_4) :: Scancode
-pattern SDL_SCANCODE_5 = (#const SDL_SCANCODE_5) :: Scancode
-pattern SDL_SCANCODE_6 = (#const SDL_SCANCODE_6) :: Scancode
-pattern SDL_SCANCODE_7 = (#const SDL_SCANCODE_7) :: Scancode
-pattern SDL_SCANCODE_8 = (#const SDL_SCANCODE_8) :: Scancode
-pattern SDL_SCANCODE_9 = (#const SDL_SCANCODE_9) :: Scancode
-pattern SDL_SCANCODE_0 = (#const SDL_SCANCODE_0) :: Scancode
-pattern SDL_SCANCODE_RETURN = (#const SDL_SCANCODE_RETURN) :: Scancode
-pattern SDL_SCANCODE_ESCAPE = (#const SDL_SCANCODE_ESCAPE) :: Scancode
-pattern SDL_SCANCODE_BACKSPACE = (#const SDL_SCANCODE_BACKSPACE) :: Scancode
-pattern SDL_SCANCODE_TAB = (#const SDL_SCANCODE_TAB) :: Scancode
-pattern SDL_SCANCODE_SPACE = (#const SDL_SCANCODE_SPACE) :: Scancode
-pattern SDL_SCANCODE_MINUS = (#const SDL_SCANCODE_MINUS) :: Scancode
-pattern SDL_SCANCODE_EQUALS = (#const SDL_SCANCODE_EQUALS) :: Scancode
-pattern SDL_SCANCODE_LEFTBRACKET = (#const SDL_SCANCODE_LEFTBRACKET) :: Scancode
-pattern SDL_SCANCODE_RIGHTBRACKET = (#const SDL_SCANCODE_RIGHTBRACKET) :: Scancode
-pattern SDL_SCANCODE_BACKSLASH = (#const SDL_SCANCODE_BACKSLASH) :: Scancode
-pattern SDL_SCANCODE_NONUSHASH = (#const SDL_SCANCODE_NONUSHASH) :: Scancode
-pattern SDL_SCANCODE_SEMICOLON = (#const SDL_SCANCODE_SEMICOLON) :: Scancode
-pattern SDL_SCANCODE_APOSTROPHE = (#const SDL_SCANCODE_APOSTROPHE) :: Scancode
-pattern SDL_SCANCODE_GRAVE = (#const SDL_SCANCODE_GRAVE) :: Scancode
-pattern SDL_SCANCODE_COMMA = (#const SDL_SCANCODE_COMMA) :: Scancode
-pattern SDL_SCANCODE_PERIOD = (#const SDL_SCANCODE_PERIOD) :: Scancode
-pattern SDL_SCANCODE_SLASH = (#const SDL_SCANCODE_SLASH) :: Scancode
-pattern SDL_SCANCODE_CAPSLOCK = (#const SDL_SCANCODE_CAPSLOCK) :: Scancode
-pattern SDL_SCANCODE_F1 = (#const SDL_SCANCODE_F1) :: Scancode
-pattern SDL_SCANCODE_F2 = (#const SDL_SCANCODE_F2) :: Scancode
-pattern SDL_SCANCODE_F3 = (#const SDL_SCANCODE_F3) :: Scancode
-pattern SDL_SCANCODE_F4 = (#const SDL_SCANCODE_F4) :: Scancode
-pattern SDL_SCANCODE_F5 = (#const SDL_SCANCODE_F5) :: Scancode
-pattern SDL_SCANCODE_F6 = (#const SDL_SCANCODE_F6) :: Scancode
-pattern SDL_SCANCODE_F7 = (#const SDL_SCANCODE_F7) :: Scancode
-pattern SDL_SCANCODE_F8 = (#const SDL_SCANCODE_F8) :: Scancode
-pattern SDL_SCANCODE_F9 = (#const SDL_SCANCODE_F9) :: Scancode
-pattern SDL_SCANCODE_F10 = (#const SDL_SCANCODE_F10) :: Scancode
-pattern SDL_SCANCODE_F11 = (#const SDL_SCANCODE_F11) :: Scancode
-pattern SDL_SCANCODE_F12 = (#const SDL_SCANCODE_F12) :: Scancode
-pattern SDL_SCANCODE_PRINTSCREEN = (#const SDL_SCANCODE_PRINTSCREEN) :: Scancode
-pattern SDL_SCANCODE_SCROLLLOCK = (#const SDL_SCANCODE_SCROLLLOCK) :: Scancode
-pattern SDL_SCANCODE_PAUSE = (#const SDL_SCANCODE_PAUSE) :: Scancode
-pattern SDL_SCANCODE_INSERT = (#const SDL_SCANCODE_INSERT) :: Scancode
-pattern SDL_SCANCODE_HOME = (#const SDL_SCANCODE_HOME) :: Scancode
-pattern SDL_SCANCODE_PAGEUP = (#const SDL_SCANCODE_PAGEUP) :: Scancode
-pattern SDL_SCANCODE_DELETE = (#const SDL_SCANCODE_DELETE) :: Scancode
-pattern SDL_SCANCODE_END = (#const SDL_SCANCODE_END) :: Scancode
-pattern SDL_SCANCODE_PAGEDOWN = (#const SDL_SCANCODE_PAGEDOWN) :: Scancode
-pattern SDL_SCANCODE_RIGHT = (#const SDL_SCANCODE_RIGHT) :: Scancode
-pattern SDL_SCANCODE_LEFT = (#const SDL_SCANCODE_LEFT) :: Scancode
-pattern SDL_SCANCODE_DOWN = (#const SDL_SCANCODE_DOWN) :: Scancode
-pattern SDL_SCANCODE_UP = (#const SDL_SCANCODE_UP) :: Scancode
-pattern SDL_SCANCODE_NUMLOCKCLEAR = (#const SDL_SCANCODE_NUMLOCKCLEAR) :: Scancode
-pattern SDL_SCANCODE_KP_DIVIDE = (#const SDL_SCANCODE_KP_DIVIDE) :: Scancode
-pattern SDL_SCANCODE_KP_MULTIPLY = (#const SDL_SCANCODE_KP_MULTIPLY) :: Scancode
-pattern SDL_SCANCODE_KP_MINUS = (#const SDL_SCANCODE_KP_MINUS) :: Scancode
-pattern SDL_SCANCODE_KP_PLUS = (#const SDL_SCANCODE_KP_PLUS) :: Scancode
-pattern SDL_SCANCODE_KP_ENTER = (#const SDL_SCANCODE_KP_ENTER) :: Scancode
-pattern SDL_SCANCODE_KP_1 = (#const SDL_SCANCODE_KP_1) :: Scancode
-pattern SDL_SCANCODE_KP_2 = (#const SDL_SCANCODE_KP_2) :: Scancode
-pattern SDL_SCANCODE_KP_3 = (#const SDL_SCANCODE_KP_3) :: Scancode
-pattern SDL_SCANCODE_KP_4 = (#const SDL_SCANCODE_KP_4) :: Scancode
-pattern SDL_SCANCODE_KP_5 = (#const SDL_SCANCODE_KP_5) :: Scancode
-pattern SDL_SCANCODE_KP_6 = (#const SDL_SCANCODE_KP_6) :: Scancode
-pattern SDL_SCANCODE_KP_7 = (#const SDL_SCANCODE_KP_7) :: Scancode
-pattern SDL_SCANCODE_KP_8 = (#const SDL_SCANCODE_KP_8) :: Scancode
-pattern SDL_SCANCODE_KP_9 = (#const SDL_SCANCODE_KP_9) :: Scancode
-pattern SDL_SCANCODE_KP_0 = (#const SDL_SCANCODE_KP_0) :: Scancode
-pattern SDL_SCANCODE_KP_PERIOD = (#const SDL_SCANCODE_KP_PERIOD) :: Scancode
-pattern SDL_SCANCODE_NONUSBACKSLASH = (#const SDL_SCANCODE_NONUSBACKSLASH) :: Scancode
-pattern SDL_SCANCODE_APPLICATION = (#const SDL_SCANCODE_APPLICATION) :: Scancode
-pattern SDL_SCANCODE_POWER = (#const SDL_SCANCODE_POWER) :: Scancode
-pattern SDL_SCANCODE_KP_EQUALS = (#const SDL_SCANCODE_KP_EQUALS) :: Scancode
-pattern SDL_SCANCODE_F13 = (#const SDL_SCANCODE_F13) :: Scancode
-pattern SDL_SCANCODE_F14 = (#const SDL_SCANCODE_F14) :: Scancode
-pattern SDL_SCANCODE_F15 = (#const SDL_SCANCODE_F15) :: Scancode
-pattern SDL_SCANCODE_F16 = (#const SDL_SCANCODE_F16) :: Scancode
-pattern SDL_SCANCODE_F17 = (#const SDL_SCANCODE_F17) :: Scancode
-pattern SDL_SCANCODE_F18 = (#const SDL_SCANCODE_F18) :: Scancode
-pattern SDL_SCANCODE_F19 = (#const SDL_SCANCODE_F19) :: Scancode
-pattern SDL_SCANCODE_F20 = (#const SDL_SCANCODE_F20) :: Scancode
-pattern SDL_SCANCODE_F21 = (#const SDL_SCANCODE_F21) :: Scancode
-pattern SDL_SCANCODE_F22 = (#const SDL_SCANCODE_F22) :: Scancode
-pattern SDL_SCANCODE_F23 = (#const SDL_SCANCODE_F23) :: Scancode
-pattern SDL_SCANCODE_F24 = (#const SDL_SCANCODE_F24) :: Scancode
-pattern SDL_SCANCODE_EXECUTE = (#const SDL_SCANCODE_EXECUTE) :: Scancode
-pattern SDL_SCANCODE_HELP = (#const SDL_SCANCODE_HELP) :: Scancode
-pattern SDL_SCANCODE_MENU = (#const SDL_SCANCODE_MENU) :: Scancode
-pattern SDL_SCANCODE_SELECT = (#const SDL_SCANCODE_SELECT) :: Scancode
-pattern SDL_SCANCODE_STOP = (#const SDL_SCANCODE_STOP) :: Scancode
-pattern SDL_SCANCODE_AGAIN = (#const SDL_SCANCODE_AGAIN) :: Scancode
-pattern SDL_SCANCODE_UNDO = (#const SDL_SCANCODE_UNDO) :: Scancode
-pattern SDL_SCANCODE_CUT = (#const SDL_SCANCODE_CUT) :: Scancode
-pattern SDL_SCANCODE_COPY = (#const SDL_SCANCODE_COPY) :: Scancode
-pattern SDL_SCANCODE_PASTE = (#const SDL_SCANCODE_PASTE) :: Scancode
-pattern SDL_SCANCODE_FIND = (#const SDL_SCANCODE_FIND) :: Scancode
-pattern SDL_SCANCODE_MUTE = (#const SDL_SCANCODE_MUTE) :: Scancode
-pattern SDL_SCANCODE_VOLUMEUP = (#const SDL_SCANCODE_VOLUMEUP) :: Scancode
-pattern SDL_SCANCODE_VOLUMEDOWN = (#const SDL_SCANCODE_VOLUMEDOWN) :: Scancode
-pattern SDL_SCANCODE_KP_COMMA = (#const SDL_SCANCODE_KP_COMMA) :: Scancode
-pattern SDL_SCANCODE_KP_EQUALSAS400 = (#const SDL_SCANCODE_KP_EQUALSAS400) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL1 = (#const SDL_SCANCODE_INTERNATIONAL1) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL2 = (#const SDL_SCANCODE_INTERNATIONAL2) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL3 = (#const SDL_SCANCODE_INTERNATIONAL3) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL4 = (#const SDL_SCANCODE_INTERNATIONAL4) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL5 = (#const SDL_SCANCODE_INTERNATIONAL5) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL6 = (#const SDL_SCANCODE_INTERNATIONAL6) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL7 = (#const SDL_SCANCODE_INTERNATIONAL7) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL8 = (#const SDL_SCANCODE_INTERNATIONAL8) :: Scancode
-pattern SDL_SCANCODE_INTERNATIONAL9 = (#const SDL_SCANCODE_INTERNATIONAL9) :: Scancode
-pattern SDL_SCANCODE_LANG1 = (#const SDL_SCANCODE_LANG1) :: Scancode
-pattern SDL_SCANCODE_LANG2 = (#const SDL_SCANCODE_LANG2) :: Scancode
-pattern SDL_SCANCODE_LANG3 = (#const SDL_SCANCODE_LANG3) :: Scancode
-pattern SDL_SCANCODE_LANG4 = (#const SDL_SCANCODE_LANG4) :: Scancode
-pattern SDL_SCANCODE_LANG5 = (#const SDL_SCANCODE_LANG5) :: Scancode
-pattern SDL_SCANCODE_LANG6 = (#const SDL_SCANCODE_LANG6) :: Scancode
-pattern SDL_SCANCODE_LANG7 = (#const SDL_SCANCODE_LANG7) :: Scancode
-pattern SDL_SCANCODE_LANG8 = (#const SDL_SCANCODE_LANG8) :: Scancode
-pattern SDL_SCANCODE_LANG9 = (#const SDL_SCANCODE_LANG9) :: Scancode
-pattern SDL_SCANCODE_ALTERASE = (#const SDL_SCANCODE_ALTERASE) :: Scancode
-pattern SDL_SCANCODE_SYSREQ = (#const SDL_SCANCODE_SYSREQ) :: Scancode
-pattern SDL_SCANCODE_CANCEL = (#const SDL_SCANCODE_CANCEL) :: Scancode
-pattern SDL_SCANCODE_CLEAR = (#const SDL_SCANCODE_CLEAR) :: Scancode
-pattern SDL_SCANCODE_PRIOR = (#const SDL_SCANCODE_PRIOR) :: Scancode
-pattern SDL_SCANCODE_RETURN2 = (#const SDL_SCANCODE_RETURN2) :: Scancode
-pattern SDL_SCANCODE_SEPARATOR = (#const SDL_SCANCODE_SEPARATOR) :: Scancode
-pattern SDL_SCANCODE_OUT = (#const SDL_SCANCODE_OUT) :: Scancode
-pattern SDL_SCANCODE_OPER = (#const SDL_SCANCODE_OPER) :: Scancode
-pattern SDL_SCANCODE_CLEARAGAIN = (#const SDL_SCANCODE_CLEARAGAIN) :: Scancode
-pattern SDL_SCANCODE_CRSEL = (#const SDL_SCANCODE_CRSEL) :: Scancode
-pattern SDL_SCANCODE_EXSEL = (#const SDL_SCANCODE_EXSEL) :: Scancode
-pattern SDL_SCANCODE_KP_00 = (#const SDL_SCANCODE_KP_00) :: Scancode
-pattern SDL_SCANCODE_KP_000 = (#const SDL_SCANCODE_KP_000) :: Scancode
-pattern SDL_SCANCODE_THOUSANDSSEPARATOR = (#const SDL_SCANCODE_THOUSANDSSEPARATOR) :: Scancode
-pattern SDL_SCANCODE_DECIMALSEPARATOR = (#const SDL_SCANCODE_DECIMALSEPARATOR) :: Scancode
-pattern SDL_SCANCODE_CURRENCYUNIT = (#const SDL_SCANCODE_CURRENCYUNIT) :: Scancode
-pattern SDL_SCANCODE_CURRENCYSUBUNIT = (#const SDL_SCANCODE_CURRENCYSUBUNIT) :: Scancode
-pattern SDL_SCANCODE_KP_LEFTPAREN = (#const SDL_SCANCODE_KP_LEFTPAREN) :: Scancode
-pattern SDL_SCANCODE_KP_RIGHTPAREN = (#const SDL_SCANCODE_KP_RIGHTPAREN) :: Scancode
-pattern SDL_SCANCODE_KP_LEFTBRACE = (#const SDL_SCANCODE_KP_LEFTBRACE) :: Scancode
-pattern SDL_SCANCODE_KP_RIGHTBRACE = (#const SDL_SCANCODE_KP_RIGHTBRACE) :: Scancode
-pattern SDL_SCANCODE_KP_TAB = (#const SDL_SCANCODE_KP_TAB) :: Scancode
-pattern SDL_SCANCODE_KP_BACKSPACE = (#const SDL_SCANCODE_KP_BACKSPACE) :: Scancode
-pattern SDL_SCANCODE_KP_A = (#const SDL_SCANCODE_KP_A) :: Scancode
-pattern SDL_SCANCODE_KP_B = (#const SDL_SCANCODE_KP_B) :: Scancode
-pattern SDL_SCANCODE_KP_C = (#const SDL_SCANCODE_KP_C) :: Scancode
-pattern SDL_SCANCODE_KP_D = (#const SDL_SCANCODE_KP_D) :: Scancode
-pattern SDL_SCANCODE_KP_E = (#const SDL_SCANCODE_KP_E) :: Scancode
-pattern SDL_SCANCODE_KP_F = (#const SDL_SCANCODE_KP_F) :: Scancode
-pattern SDL_SCANCODE_KP_XOR = (#const SDL_SCANCODE_KP_XOR) :: Scancode
-pattern SDL_SCANCODE_KP_POWER = (#const SDL_SCANCODE_KP_POWER) :: Scancode
-pattern SDL_SCANCODE_KP_PERCENT = (#const SDL_SCANCODE_KP_PERCENT) :: Scancode
-pattern SDL_SCANCODE_KP_LESS = (#const SDL_SCANCODE_KP_LESS) :: Scancode
-pattern SDL_SCANCODE_KP_GREATER = (#const SDL_SCANCODE_KP_GREATER) :: Scancode
-pattern SDL_SCANCODE_KP_AMPERSAND = (#const SDL_SCANCODE_KP_AMPERSAND) :: Scancode
-pattern SDL_SCANCODE_KP_DBLAMPERSAND = (#const SDL_SCANCODE_KP_DBLAMPERSAND) :: Scancode
-pattern SDL_SCANCODE_KP_VERTICALBAR = (#const SDL_SCANCODE_KP_VERTICALBAR) :: Scancode
-pattern SDL_SCANCODE_KP_DBLVERTICALBAR = (#const SDL_SCANCODE_KP_DBLVERTICALBAR) :: Scancode
-pattern SDL_SCANCODE_KP_COLON = (#const SDL_SCANCODE_KP_COLON) :: Scancode
-pattern SDL_SCANCODE_KP_HASH = (#const SDL_SCANCODE_KP_HASH) :: Scancode
-pattern SDL_SCANCODE_KP_SPACE = (#const SDL_SCANCODE_KP_SPACE) :: Scancode
-pattern SDL_SCANCODE_KP_AT = (#const SDL_SCANCODE_KP_AT) :: Scancode
-pattern SDL_SCANCODE_KP_EXCLAM = (#const SDL_SCANCODE_KP_EXCLAM) :: Scancode
-pattern SDL_SCANCODE_KP_MEMSTORE = (#const SDL_SCANCODE_KP_MEMSTORE) :: Scancode
-pattern SDL_SCANCODE_KP_MEMRECALL = (#const SDL_SCANCODE_KP_MEMRECALL) :: Scancode
-pattern SDL_SCANCODE_KP_MEMCLEAR = (#const SDL_SCANCODE_KP_MEMCLEAR) :: Scancode
-pattern SDL_SCANCODE_KP_MEMADD = (#const SDL_SCANCODE_KP_MEMADD) :: Scancode
-pattern SDL_SCANCODE_KP_MEMSUBTRACT = (#const SDL_SCANCODE_KP_MEMSUBTRACT) :: Scancode
-pattern SDL_SCANCODE_KP_MEMMULTIPLY = (#const SDL_SCANCODE_KP_MEMMULTIPLY) :: Scancode
-pattern SDL_SCANCODE_KP_MEMDIVIDE = (#const SDL_SCANCODE_KP_MEMDIVIDE) :: Scancode
-pattern SDL_SCANCODE_KP_PLUSMINUS = (#const SDL_SCANCODE_KP_PLUSMINUS) :: Scancode
-pattern SDL_SCANCODE_KP_CLEAR = (#const SDL_SCANCODE_KP_CLEAR) :: Scancode
-pattern SDL_SCANCODE_KP_CLEARENTRY = (#const SDL_SCANCODE_KP_CLEARENTRY) :: Scancode
-pattern SDL_SCANCODE_KP_BINARY = (#const SDL_SCANCODE_KP_BINARY) :: Scancode
-pattern SDL_SCANCODE_KP_OCTAL = (#const SDL_SCANCODE_KP_OCTAL) :: Scancode
-pattern SDL_SCANCODE_KP_DECIMAL = (#const SDL_SCANCODE_KP_DECIMAL) :: Scancode
-pattern SDL_SCANCODE_KP_HEXADECIMAL = (#const SDL_SCANCODE_KP_HEXADECIMAL) :: Scancode
-pattern SDL_SCANCODE_LCTRL = (#const SDL_SCANCODE_LCTRL) :: Scancode
-pattern SDL_SCANCODE_LSHIFT = (#const SDL_SCANCODE_LSHIFT) :: Scancode
-pattern SDL_SCANCODE_LALT = (#const SDL_SCANCODE_LALT) :: Scancode
-pattern SDL_SCANCODE_LGUI = (#const SDL_SCANCODE_LGUI) :: Scancode
-pattern SDL_SCANCODE_RCTRL = (#const SDL_SCANCODE_RCTRL) :: Scancode
-pattern SDL_SCANCODE_RSHIFT = (#const SDL_SCANCODE_RSHIFT) :: Scancode
-pattern SDL_SCANCODE_RALT = (#const SDL_SCANCODE_RALT) :: Scancode
-pattern SDL_SCANCODE_RGUI = (#const SDL_SCANCODE_RGUI) :: Scancode
-pattern SDL_SCANCODE_MODE = (#const SDL_SCANCODE_MODE) :: Scancode
-pattern SDL_SCANCODE_AUDIONEXT = (#const SDL_SCANCODE_AUDIONEXT) :: Scancode
-pattern SDL_SCANCODE_AUDIOPREV = (#const SDL_SCANCODE_AUDIOPREV) :: Scancode
-pattern SDL_SCANCODE_AUDIOSTOP = (#const SDL_SCANCODE_AUDIOSTOP) :: Scancode
-pattern SDL_SCANCODE_AUDIOPLAY = (#const SDL_SCANCODE_AUDIOPLAY) :: Scancode
-pattern SDL_SCANCODE_AUDIOMUTE = (#const SDL_SCANCODE_AUDIOMUTE) :: Scancode
-pattern SDL_SCANCODE_MEDIASELECT = (#const SDL_SCANCODE_MEDIASELECT) :: Scancode
-pattern SDL_SCANCODE_WWW = (#const SDL_SCANCODE_WWW) :: Scancode
-pattern SDL_SCANCODE_MAIL = (#const SDL_SCANCODE_MAIL) :: Scancode
-pattern SDL_SCANCODE_CALCULATOR = (#const SDL_SCANCODE_CALCULATOR) :: Scancode
-pattern SDL_SCANCODE_COMPUTER = (#const SDL_SCANCODE_COMPUTER) :: Scancode
-pattern SDL_SCANCODE_AC_SEARCH = (#const SDL_SCANCODE_AC_SEARCH) :: Scancode
-pattern SDL_SCANCODE_AC_HOME = (#const SDL_SCANCODE_AC_HOME) :: Scancode
-pattern SDL_SCANCODE_AC_BACK = (#const SDL_SCANCODE_AC_BACK) :: Scancode
-pattern SDL_SCANCODE_AC_FORWARD = (#const SDL_SCANCODE_AC_FORWARD) :: Scancode
-pattern SDL_SCANCODE_AC_STOP = (#const SDL_SCANCODE_AC_STOP) :: Scancode
-pattern SDL_SCANCODE_AC_REFRESH = (#const SDL_SCANCODE_AC_REFRESH) :: Scancode
-pattern SDL_SCANCODE_AC_BOOKMARKS = (#const SDL_SCANCODE_AC_BOOKMARKS) :: Scancode
-pattern SDL_SCANCODE_BRIGHTNESSDOWN = (#const SDL_SCANCODE_BRIGHTNESSDOWN) :: Scancode
-pattern SDL_SCANCODE_BRIGHTNESSUP = (#const SDL_SCANCODE_BRIGHTNESSUP) :: Scancode
-pattern SDL_SCANCODE_DISPLAYSWITCH = (#const SDL_SCANCODE_DISPLAYSWITCH) :: Scancode
-pattern SDL_SCANCODE_KBDILLUMTOGGLE = (#const SDL_SCANCODE_KBDILLUMTOGGLE) :: Scancode
-pattern SDL_SCANCODE_KBDILLUMDOWN = (#const SDL_SCANCODE_KBDILLUMDOWN) :: Scancode
-pattern SDL_SCANCODE_KBDILLUMUP = (#const SDL_SCANCODE_KBDILLUMUP) :: Scancode
-pattern SDL_SCANCODE_EJECT = (#const SDL_SCANCODE_EJECT) :: Scancode
-pattern SDL_SCANCODE_SLEEP = (#const SDL_SCANCODE_SLEEP) :: Scancode
-pattern SDL_SCANCODE_APP1 = (#const SDL_SCANCODE_APP1) :: Scancode
-pattern SDL_SCANCODE_APP2 = (#const SDL_SCANCODE_APP2) :: Scancode
-pattern SDL_NUM_SCANCODES = (#const SDL_NUM_SCANCODES) :: Scancode
-
-pattern SDL_SYSTEM_CURSOR_ARROW = (#const SDL_SYSTEM_CURSOR_ARROW) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_IBEAM = (#const SDL_SYSTEM_CURSOR_IBEAM) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_WAIT = (#const SDL_SYSTEM_CURSOR_WAIT) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_CROSSHAIR = (#const SDL_SYSTEM_CURSOR_CROSSHAIR) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_WAITARROW = (#const SDL_SYSTEM_CURSOR_WAITARROW) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_SIZENWSE = (#const SDL_SYSTEM_CURSOR_SIZENWSE) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_SIZENESW = (#const SDL_SYSTEM_CURSOR_SIZENESW) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_SIZEWE = (#const SDL_SYSTEM_CURSOR_SIZEWE) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_SIZENS = (#const SDL_SYSTEM_CURSOR_SIZENS) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_SIZEALL = (#const SDL_SYSTEM_CURSOR_SIZEALL) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_NO = (#const SDL_SYSTEM_CURSOR_NO) :: SystemCursor
-pattern SDL_SYSTEM_CURSOR_HAND = (#const SDL_SYSTEM_CURSOR_HAND) :: SystemCursor
-pattern SDL_NUM_SYSTEM_CURSORS = (#const SDL_NUM_SYSTEM_CURSORS) :: SystemCursor
-
-pattern SDL_THREAD_PRIORITY_LOW = (#const SDL_THREAD_PRIORITY_LOW) :: ThreadPriority
-pattern SDL_THREAD_PRIORITY_NORMAL = (#const SDL_THREAD_PRIORITY_NORMAL) :: ThreadPriority
-pattern SDL_THREAD_PRIORITY_HIGH = (#const SDL_THREAD_PRIORITY_HIGH) :: ThreadPriority
-
-pattern SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = (#const SDL_AUDIO_ALLOW_FREQUENCY_CHANGE)
-pattern SDL_AUDIO_ALLOW_FORMAT_CHANGE = (#const SDL_AUDIO_ALLOW_FORMAT_CHANGE)
-pattern SDL_AUDIO_ALLOW_CHANNELS_CHANGE = (#const SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
-pattern SDL_AUDIO_ALLOW_ANY_CHANGE = (#const SDL_AUDIO_ALLOW_ANY_CHANGE)
-
-pattern SDL_BUTTON_LEFT = (#const SDL_BUTTON_LEFT)
-pattern SDL_BUTTON_MIDDLE = (#const SDL_BUTTON_MIDDLE)
-pattern SDL_BUTTON_RIGHT = (#const SDL_BUTTON_RIGHT)
-pattern SDL_BUTTON_X1 = (#const SDL_BUTTON_X1)
-pattern SDL_BUTTON_X2 = (#const SDL_BUTTON_X2)
-pattern SDL_BUTTON_LMASK = (#const SDL_BUTTON_LMASK)
-pattern SDL_BUTTON_MMASK = (#const SDL_BUTTON_MMASK)
-pattern SDL_BUTTON_RMASK = (#const SDL_BUTTON_RMASK)
-pattern SDL_BUTTON_X1MASK = (#const SDL_BUTTON_X1MASK)
-pattern SDL_BUTTON_X2MASK = (#const SDL_BUTTON_X2MASK)
-
-pattern SDL_MOUSEWHEEL_NORMAL = (#const SDL_MOUSEWHEEL_NORMAL)
-pattern SDL_MOUSEWHEEL_FLIPPED = (#const SDL_MOUSEWHEEL_FLIPPED)
-
-pattern SDL_FIRSTEVENT = (#const SDL_FIRSTEVENT)
-pattern SDL_QUIT = (#const SDL_QUIT)
-pattern SDL_APP_TERMINATING = (#const SDL_APP_TERMINATING)
-pattern SDL_APP_LOWMEMORY = (#const SDL_APP_LOWMEMORY)
-pattern SDL_APP_WILLENTERBACKGROUND = (#const SDL_APP_WILLENTERBACKGROUND)
-pattern SDL_APP_DIDENTERBACKGROUND = (#const SDL_APP_DIDENTERBACKGROUND)
-pattern SDL_APP_WILLENTERFOREGROUND = (#const SDL_APP_WILLENTERFOREGROUND)
-pattern SDL_APP_DIDENTERFOREGROUND = (#const SDL_APP_DIDENTERFOREGROUND)
-pattern SDL_WINDOWEVENT = (#const SDL_WINDOWEVENT)
-pattern SDL_SYSWMEVENT = (#const SDL_SYSWMEVENT)
-pattern SDL_KEYDOWN = (#const SDL_KEYDOWN)
-pattern SDL_KEYUP = (#const SDL_KEYUP)
-pattern SDL_TEXTEDITING = (#const SDL_TEXTEDITING)
-pattern SDL_TEXTINPUT = (#const SDL_TEXTINPUT)
-pattern SDL_KEYMAPCHANGED = (#const SDL_KEYMAPCHANGED)
-pattern SDL_MOUSEMOTION = (#const SDL_MOUSEMOTION)
-pattern SDL_MOUSEBUTTONDOWN = (#const SDL_MOUSEBUTTONDOWN)
-pattern SDL_MOUSEBUTTONUP = (#const SDL_MOUSEBUTTONUP)
-pattern SDL_MOUSEWHEEL = (#const SDL_MOUSEWHEEL)
-pattern SDL_JOYAXISMOTION = (#const SDL_JOYAXISMOTION)
-pattern SDL_JOYBALLMOTION = (#const SDL_JOYBALLMOTION)
-pattern SDL_JOYHATMOTION = (#const SDL_JOYHATMOTION)
-pattern SDL_JOYBUTTONDOWN = (#const SDL_JOYBUTTONDOWN)
-pattern SDL_JOYBUTTONUP = (#const SDL_JOYBUTTONUP)
-pattern SDL_JOYDEVICEADDED = (#const SDL_JOYDEVICEADDED)
-pattern SDL_JOYDEVICEREMOVED = (#const SDL_JOYDEVICEREMOVED)
-pattern SDL_CONTROLLERAXISMOTION = (#const SDL_CONTROLLERAXISMOTION)
-pattern SDL_CONTROLLERBUTTONDOWN = (#const SDL_CONTROLLERBUTTONDOWN)
-pattern SDL_CONTROLLERBUTTONUP = (#const SDL_CONTROLLERBUTTONUP)
-pattern SDL_CONTROLLERDEVICEADDED = (#const SDL_CONTROLLERDEVICEADDED)
-pattern SDL_CONTROLLERDEVICEREMOVED = (#const SDL_CONTROLLERDEVICEREMOVED)
-pattern SDL_CONTROLLERDEVICEREMAPPED = (#const SDL_CONTROLLERDEVICEREMAPPED)
-pattern SDL_FINGERDOWN = (#const SDL_FINGERDOWN)
-pattern SDL_FINGERUP = (#const SDL_FINGERUP)
-pattern SDL_FINGERMOTION = (#const SDL_FINGERMOTION)
-pattern SDL_DOLLARGESTURE = (#const SDL_DOLLARGESTURE)
-pattern SDL_DOLLARRECORD = (#const SDL_DOLLARRECORD)
-pattern SDL_MULTIGESTURE = (#const SDL_MULTIGESTURE)
-pattern SDL_CLIPBOARDUPDATE = (#const SDL_CLIPBOARDUPDATE)
-pattern SDL_DROPFILE = (#const SDL_DROPFILE)
-pattern SDL_AUDIODEVICEADDED = (#const SDL_AUDIODEVICEADDED)
-pattern SDL_AUDIODEVICEREMOVED = (#const SDL_AUDIODEVICEREMOVED)
-pattern SDL_RENDER_TARGETS_RESET = (#const SDL_RENDER_TARGETS_RESET)
-pattern SDL_RENDER_DEVICE_RESET = (#const SDL_RENDER_DEVICE_RESET)
-pattern SDL_USEREVENT = (#const SDL_USEREVENT)
-pattern SDL_LASTEVENT = (#const SDL_LASTEVENT)
-
-pattern SDL_HAT_CENTERED = (#const SDL_HAT_CENTERED)
-pattern SDL_HAT_UP = (#const SDL_HAT_UP)
-pattern SDL_HAT_RIGHT = (#const SDL_HAT_RIGHT)
-pattern SDL_HAT_DOWN = (#const SDL_HAT_DOWN)
-pattern SDL_HAT_LEFT = (#const SDL_HAT_LEFT)
-pattern SDL_HAT_RIGHTUP = (#const SDL_HAT_RIGHTUP)
-pattern SDL_HAT_RIGHTDOWN = (#const SDL_HAT_RIGHTDOWN)
-pattern SDL_HAT_LEFTUP = (#const SDL_HAT_LEFTUP)
-pattern SDL_HAT_LEFTDOWN = (#const SDL_HAT_LEFTDOWN)
-
-pattern SDL_PRESSED = (#const SDL_PRESSED)
-pattern SDL_RELEASED = (#const SDL_RELEASED)
-
-pattern SDL_LOG_CATEGORY_APPLICATION = (#const SDL_LOG_CATEGORY_APPLICATION)
-pattern SDL_LOG_CATEGORY_ERROR = (#const SDL_LOG_CATEGORY_ERROR)
-pattern SDL_LOG_CATEGORY_ASSERT = (#const SDL_LOG_CATEGORY_ASSERT)
-pattern SDL_LOG_CATEGORY_SYSTEM = (#const SDL_LOG_CATEGORY_SYSTEM)
-pattern SDL_LOG_CATEGORY_AUDIO = (#const SDL_LOG_CATEGORY_AUDIO)
-pattern SDL_LOG_CATEGORY_VIDEO = (#const SDL_LOG_CATEGORY_VIDEO)
-pattern SDL_LOG_CATEGORY_RENDER = (#const SDL_LOG_CATEGORY_RENDER)
-pattern SDL_LOG_CATEGORY_INPUT = (#const SDL_LOG_CATEGORY_INPUT)
-pattern SDL_LOG_CATEGORY_TEST = (#const SDL_LOG_CATEGORY_TEST)
-pattern SDL_LOG_CATEGORY_CUSTOM = (#const SDL_LOG_CATEGORY_CUSTOM)
-
-pattern SDL_MESSAGEBOX_ERROR = (#const SDL_MESSAGEBOX_ERROR)
-pattern SDL_MESSAGEBOX_WARNING = (#const SDL_MESSAGEBOX_WARNING)
-pattern SDL_MESSAGEBOX_INFORMATION = (#const SDL_MESSAGEBOX_INFORMATION)
-
-pattern SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = (#const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT)
-pattern SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = (#const SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT)
-
-pattern SDL_GL_CONTEXT_PROFILE_CORE = (#const SDL_GL_CONTEXT_PROFILE_CORE)
-pattern SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = (#const SDL_GL_CONTEXT_PROFILE_COMPATIBILITY)
-pattern SDL_GL_CONTEXT_PROFILE_ES = (#const SDL_GL_CONTEXT_PROFILE_ES)
-
-pattern SDL_GL_CONTEXT_DEBUG_FLAG = (#const SDL_GL_CONTEXT_DEBUG_FLAG)
-pattern SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = (#const SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG)
-pattern SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = (#const SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG)
-pattern SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = (#const SDL_GL_CONTEXT_RESET_ISOLATION_FLAG)
-
-pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = (#const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE)
-pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = (#const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)
-
-pattern SDL_PIXELFORMAT_UNKNOWN = (#const SDL_PIXELFORMAT_UNKNOWN)
-pattern SDL_PIXELFORMAT_INDEX1LSB = (#const SDL_PIXELFORMAT_INDEX1LSB)
-pattern SDL_PIXELFORMAT_INDEX1MSB = (#const SDL_PIXELFORMAT_INDEX1MSB)
-pattern SDL_PIXELFORMAT_INDEX4LSB = (#const SDL_PIXELFORMAT_INDEX4LSB)
-pattern SDL_PIXELFORMAT_INDEX4MSB = (#const SDL_PIXELFORMAT_INDEX4MSB)
-pattern SDL_PIXELFORMAT_INDEX8 = (#const SDL_PIXELFORMAT_INDEX8)
-pattern SDL_PIXELFORMAT_RGB332 = (#const SDL_PIXELFORMAT_RGB332)
-pattern SDL_PIXELFORMAT_RGB444 = (#const SDL_PIXELFORMAT_RGB444)
-pattern SDL_PIXELFORMAT_RGB555 = (#const SDL_PIXELFORMAT_RGB555)
-pattern SDL_PIXELFORMAT_BGR555 = (#const SDL_PIXELFORMAT_BGR555)
-pattern SDL_PIXELFORMAT_ARGB4444 = (#const SDL_PIXELFORMAT_ARGB4444)
-pattern SDL_PIXELFORMAT_RGBA4444 = (#const SDL_PIXELFORMAT_RGBA4444)
-pattern SDL_PIXELFORMAT_ABGR4444 = (#const SDL_PIXELFORMAT_ABGR4444)
-pattern SDL_PIXELFORMAT_BGRA4444 = (#const SDL_PIXELFORMAT_BGRA4444)
-pattern SDL_PIXELFORMAT_ARGB1555 = (#const SDL_PIXELFORMAT_ARGB1555)
-pattern SDL_PIXELFORMAT_RGBA5551 = (#const SDL_PIXELFORMAT_RGBA5551)
-pattern SDL_PIXELFORMAT_ABGR1555 = (#const SDL_PIXELFORMAT_ABGR1555)
-pattern SDL_PIXELFORMAT_BGRA5551 = (#const SDL_PIXELFORMAT_BGRA5551)
-pattern SDL_PIXELFORMAT_RGB565 = (#const SDL_PIXELFORMAT_RGB565)
-pattern SDL_PIXELFORMAT_BGR565 = (#const SDL_PIXELFORMAT_BGR565)
-pattern SDL_PIXELFORMAT_RGB24 = (#const SDL_PIXELFORMAT_RGB24)
-pattern SDL_PIXELFORMAT_BGR24 = (#const SDL_PIXELFORMAT_BGR24)
-pattern SDL_PIXELFORMAT_RGB888 = (#const SDL_PIXELFORMAT_RGB888)
-pattern SDL_PIXELFORMAT_RGBX8888 = (#const SDL_PIXELFORMAT_RGBX8888)
-pattern SDL_PIXELFORMAT_BGR888 = (#const SDL_PIXELFORMAT_BGR888)
-pattern SDL_PIXELFORMAT_BGRX8888 = (#const SDL_PIXELFORMAT_BGRX8888)
-pattern SDL_PIXELFORMAT_ARGB8888 = (#const SDL_PIXELFORMAT_ARGB8888)
-pattern SDL_PIXELFORMAT_RGBA8888 = (#const SDL_PIXELFORMAT_RGBA8888)
-pattern SDL_PIXELFORMAT_ABGR8888 = (#const SDL_PIXELFORMAT_ABGR8888)
-pattern SDL_PIXELFORMAT_BGRA8888 = (#const SDL_PIXELFORMAT_BGRA8888)
-pattern SDL_PIXELFORMAT_ARGB2101010 = (#const SDL_PIXELFORMAT_ARGB2101010)
-pattern SDL_PIXELFORMAT_YV12 = (#const SDL_PIXELFORMAT_YV12)
-pattern SDL_PIXELFORMAT_IYUV = (#const SDL_PIXELFORMAT_IYUV)
-pattern SDL_PIXELFORMAT_YUY2 = (#const SDL_PIXELFORMAT_YUY2)
-pattern SDL_PIXELFORMAT_UYVY = (#const SDL_PIXELFORMAT_UYVY)
-pattern SDL_PIXELFORMAT_YVYU = (#const SDL_PIXELFORMAT_YVYU)
-
-pattern SDL_RENDERER_SOFTWARE = (#const SDL_RENDERER_SOFTWARE)
-pattern SDL_RENDERER_ACCELERATED = (#const SDL_RENDERER_ACCELERATED)
-pattern SDL_RENDERER_PRESENTVSYNC = (#const SDL_RENDERER_PRESENTVSYNC)
-pattern SDL_RENDERER_TARGETTEXTURE = (#const SDL_RENDERER_TARGETTEXTURE)
-
-pattern SDL_TEXTUREACCESS_STATIC = (#const SDL_TEXTUREACCESS_STATIC)
-pattern SDL_TEXTUREACCESS_STREAMING = (#const SDL_TEXTUREACCESS_STREAMING)
-pattern SDL_TEXTUREACCESS_TARGET = (#const SDL_TEXTUREACCESS_TARGET)
-
-pattern SDL_TEXTUREMODULATE_NONE = (#const SDL_TEXTUREMODULATE_NONE)
-pattern SDL_TEXTUREMODULATE_COLOR = (#const SDL_TEXTUREMODULATE_COLOR)
-pattern SDL_TEXTUREMODULATE_ALPHA = (#const SDL_TEXTUREMODULATE_ALPHA)
-
-pattern SDL_TOUCH_MOUSEID = (#const SDL_TOUCH_MOUSEID)
-
-pattern SDL_WINDOWEVENT_NONE = (#const SDL_WINDOWEVENT_NONE)
-pattern SDL_WINDOWEVENT_SHOWN = (#const SDL_WINDOWEVENT_SHOWN)
-pattern SDL_WINDOWEVENT_HIDDEN = (#const SDL_WINDOWEVENT_HIDDEN)
-pattern SDL_WINDOWEVENT_EXPOSED = (#const SDL_WINDOWEVENT_EXPOSED)
-pattern SDL_WINDOWEVENT_MOVED = (#const SDL_WINDOWEVENT_MOVED)
-pattern SDL_WINDOWEVENT_RESIZED = (#const SDL_WINDOWEVENT_RESIZED)
-pattern SDL_WINDOWEVENT_SIZE_CHANGED = (#const SDL_WINDOWEVENT_SIZE_CHANGED)
-pattern SDL_WINDOWEVENT_MINIMIZED = (#const SDL_WINDOWEVENT_MINIMIZED)
-pattern SDL_WINDOWEVENT_MAXIMIZED = (#const SDL_WINDOWEVENT_MAXIMIZED)
-pattern SDL_WINDOWEVENT_RESTORED = (#const SDL_WINDOWEVENT_RESTORED)
-pattern SDL_WINDOWEVENT_ENTER = (#const SDL_WINDOWEVENT_ENTER)
-pattern SDL_WINDOWEVENT_LEAVE = (#const SDL_WINDOWEVENT_LEAVE)
-pattern SDL_WINDOWEVENT_FOCUS_GAINED = (#const SDL_WINDOWEVENT_FOCUS_GAINED)
-pattern SDL_WINDOWEVENT_FOCUS_LOST = (#const SDL_WINDOWEVENT_FOCUS_LOST)
-pattern SDL_WINDOWEVENT_CLOSE = (#const SDL_WINDOWEVENT_CLOSE)
-
-pattern SDL_WINDOW_FULLSCREEN = (#const SDL_WINDOW_FULLSCREEN)
-pattern SDL_WINDOW_OPENGL = (#const SDL_WINDOW_OPENGL)
-pattern SDL_WINDOW_SHOWN = (#const SDL_WINDOW_SHOWN)
-pattern SDL_WINDOW_HIDDEN = (#const SDL_WINDOW_HIDDEN)
-pattern SDL_WINDOW_BORDERLESS = (#const SDL_WINDOW_BORDERLESS)
-pattern SDL_WINDOW_RESIZABLE = (#const SDL_WINDOW_RESIZABLE)
-pattern SDL_WINDOW_MINIMIZED = (#const SDL_WINDOW_MINIMIZED)
-pattern SDL_WINDOW_MAXIMIZED = (#const SDL_WINDOW_MAXIMIZED)
-pattern SDL_WINDOW_INPUT_GRABBED = (#const SDL_WINDOW_INPUT_GRABBED)
-pattern SDL_WINDOW_INPUT_FOCUS = (#const SDL_WINDOW_INPUT_FOCUS)
-pattern SDL_WINDOW_MOUSE_FOCUS = (#const SDL_WINDOW_MOUSE_FOCUS)
-pattern SDL_WINDOW_FULLSCREEN_DESKTOP = (#const SDL_WINDOW_FULLSCREEN_DESKTOP)
-pattern SDL_WINDOW_FOREIGN = (#const SDL_WINDOW_FOREIGN)
-pattern SDL_WINDOW_ALLOW_HIGHDPI = (#const SDL_WINDOW_ALLOW_HIGHDPI)
-pattern SDL_WINDOW_MOUSE_CAPTURE = (#const SDL_WINDOW_MOUSE_CAPTURE)
-
-pattern SDL_WINDOWPOS_UNDEFINED = (#const SDL_WINDOWPOS_UNDEFINED)
-pattern SDL_WINDOWPOS_CENTERED = (#const SDL_WINDOWPOS_CENTERED)
-
-pattern SDL_HAPTIC_CONSTANT = (#const SDL_HAPTIC_CONSTANT)
+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE PatternSynonyms #-}+module SDL.Raw.Enum (+  -- * Enumerations++  -- ** Audio Format+  AudioFormat,+  pattern SDL_AUDIO_S8,+  pattern SDL_AUDIO_U8,+  pattern SDL_AUDIO_S16LSB,+  pattern SDL_AUDIO_S16MSB,+  pattern SDL_AUDIO_S16SYS,+  pattern SDL_AUDIO_U16LSB,+  pattern SDL_AUDIO_U16MSB,+  pattern SDL_AUDIO_U16SYS,+  pattern SDL_AUDIO_S32LSB,+  pattern SDL_AUDIO_S32MSB,+  pattern SDL_AUDIO_S32SYS,+  pattern SDL_AUDIO_F32LSB,+  pattern SDL_AUDIO_F32MSB,+  pattern SDL_AUDIO_F32SYS,++  -- ** Audio Status+  AudioStatus,+  pattern SDL_AUDIO_STOPPED,+  pattern SDL_AUDIO_PLAYING,+  pattern SDL_AUDIO_PAUSED,++  -- ** Blend Mode+  BlendMode,+  pattern SDL_BLENDMODE_NONE,+  pattern SDL_BLENDMODE_BLEND,+  pattern SDL_BLENDMODE_ADD,+  pattern SDL_BLENDMODE_MOD,++  -- ** Endian Detetection+  pattern SDL_BYTEORDER,+  pattern SDL_LIL_ENDIAN,+  pattern SDL_BIG_ENDIAN,++  -- ** Event Action+  EventAction,+  pattern SDL_ADDEVENT,+  pattern SDL_PEEKEVENT,+  pattern SDL_GETEVENT,++  -- ** Game Controller Axis+  GameControllerAxis,+  pattern SDL_CONTROLLER_AXIS_INVALID,+  pattern SDL_CONTROLLER_AXIS_LEFTX,+  pattern SDL_CONTROLLER_AXIS_LEFTY,+  pattern SDL_CONTROLLER_AXIS_RIGHTX,+  pattern SDL_CONTROLLER_AXIS_RIGHTY,+  pattern SDL_CONTROLLER_AXIS_TRIGGERLEFT,+  pattern SDL_CONTROLLER_AXIS_TRIGGERRIGHT,+  pattern SDL_CONTROLLER_AXIS_MAX,++  -- ** Game Controller Button+  GameControllerButton,+  pattern SDL_CONTROLLER_BUTTON_INVALID,+  pattern SDL_CONTROLLER_BUTTON_A,+  pattern SDL_CONTROLLER_BUTTON_B,+  pattern SDL_CONTROLLER_BUTTON_X,+  pattern SDL_CONTROLLER_BUTTON_Y,+  pattern SDL_CONTROLLER_BUTTON_BACK,+  pattern SDL_CONTROLLER_BUTTON_GUIDE,+  pattern SDL_CONTROLLER_BUTTON_START,+  pattern SDL_CONTROLLER_BUTTON_LEFTSTICK,+  pattern SDL_CONTROLLER_BUTTON_RIGHTSTICK,+  pattern SDL_CONTROLLER_BUTTON_LEFTSHOULDER,+  pattern SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,+  pattern SDL_CONTROLLER_BUTTON_DPAD_UP,+  pattern SDL_CONTROLLER_BUTTON_DPAD_DOWN,+  pattern SDL_CONTROLLER_BUTTON_DPAD_LEFT,+  pattern SDL_CONTROLLER_BUTTON_DPAD_RIGHT,+  pattern SDL_CONTROLLER_BUTTON_MAX,++  -- ** OpenGL Attribute+  GLattr,+  pattern SDL_GL_RED_SIZE,+  pattern SDL_GL_GREEN_SIZE,+  pattern SDL_GL_BLUE_SIZE,+  pattern SDL_GL_ALPHA_SIZE,+  pattern SDL_GL_BUFFER_SIZE,+  pattern SDL_GL_DOUBLEBUFFER,+  pattern SDL_GL_DEPTH_SIZE,+  pattern SDL_GL_STENCIL_SIZE,+  pattern SDL_GL_ACCUM_RED_SIZE,+  pattern SDL_GL_ACCUM_GREEN_SIZE,+  pattern SDL_GL_ACCUM_BLUE_SIZE,+  pattern SDL_GL_ACCUM_ALPHA_SIZE,+  pattern SDL_GL_STEREO,+  pattern SDL_GL_MULTISAMPLEBUFFERS,+  pattern SDL_GL_MULTISAMPLESAMPLES,+  pattern SDL_GL_ACCELERATED_VISUAL,+  pattern SDL_GL_RETAINED_BACKING,+  pattern SDL_GL_CONTEXT_MAJOR_VERSION,+  pattern SDL_GL_CONTEXT_MINOR_VERSION,+  pattern SDL_GL_CONTEXT_EGL,+  pattern SDL_GL_CONTEXT_FLAGS,+  pattern SDL_GL_CONTEXT_PROFILE_MASK,+  pattern SDL_GL_SHARE_WITH_CURRENT_CONTEXT,+  pattern SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,+  pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR,++  -- ** Hint Priority+  HintPriority,+  pattern SDL_HINT_DEFAULT,+  pattern SDL_HINT_NORMAL,+  pattern SDL_HINT_OVERRIDE,++  -- ** Initialization Flag+  InitFlag,+  pattern SDL_INIT_TIMER,+  pattern SDL_INIT_AUDIO,+  pattern SDL_INIT_VIDEO,+  pattern SDL_INIT_JOYSTICK,+  pattern SDL_INIT_HAPTIC,+  pattern SDL_INIT_GAMECONTROLLER,+  pattern SDL_INIT_EVENTS,+  pattern SDL_INIT_NOPARACHUTE,+  pattern SDL_INIT_EVERYTHING,++  -- ** Joystick Power Level+  JoystickPowerLevel,+  pattern SDL_JOYSTICK_POWER_UNKNOWN,+  pattern SDL_JOYSTICK_POWER_EMPTY,+  pattern SDL_JOYSTICK_POWER_LOW,+  pattern SDL_JOYSTICK_POWER_MEDIUM,+  pattern SDL_JOYSTICK_POWER_FULL,+  pattern SDL_JOYSTICK_POWER_WIRED,+  pattern SDL_JOYSTICK_POWER_MAX,++  -- ** Keycode+  Keycode,+  pattern SDLK_UNKNOWN,+  pattern SDLK_RETURN,+  pattern SDLK_ESCAPE,+  pattern SDLK_BACKSPACE,+  pattern SDLK_TAB,+  pattern SDLK_SPACE,+  pattern SDLK_EXCLAIM,+  pattern SDLK_QUOTEDBL,+  pattern SDLK_HASH,+  pattern SDLK_PERCENT,+  pattern SDLK_DOLLAR,+  pattern SDLK_AMPERSAND,+  pattern SDLK_QUOTE,+  pattern SDLK_LEFTPAREN,+  pattern SDLK_RIGHTPAREN,+  pattern SDLK_ASTERISK,+  pattern SDLK_PLUS,+  pattern SDLK_COMMA,+  pattern SDLK_MINUS,+  pattern SDLK_PERIOD,+  pattern SDLK_SLASH,+  pattern SDLK_0,+  pattern SDLK_1,+  pattern SDLK_2,+  pattern SDLK_3,+  pattern SDLK_4,+  pattern SDLK_5,+  pattern SDLK_6,+  pattern SDLK_7,+  pattern SDLK_8,+  pattern SDLK_9,+  pattern SDLK_COLON,+  pattern SDLK_SEMICOLON,+  pattern SDLK_LESS,+  pattern SDLK_EQUALS,+  pattern SDLK_GREATER,+  pattern SDLK_QUESTION,+  pattern SDLK_AT,+  pattern SDLK_LEFTBRACKET,+  pattern SDLK_BACKSLASH,+  pattern SDLK_RIGHTBRACKET,+  pattern SDLK_CARET,+  pattern SDLK_UNDERSCORE,+  pattern SDLK_BACKQUOTE,+  pattern SDLK_a,+  pattern SDLK_b,+  pattern SDLK_c,+  pattern SDLK_d,+  pattern SDLK_e,+  pattern SDLK_f,+  pattern SDLK_g,+  pattern SDLK_h,+  pattern SDLK_i,+  pattern SDLK_j,+  pattern SDLK_k,+  pattern SDLK_l,+  pattern SDLK_m,+  pattern SDLK_n,+  pattern SDLK_o,+  pattern SDLK_p,+  pattern SDLK_q,+  pattern SDLK_r,+  pattern SDLK_s,+  pattern SDLK_t,+  pattern SDLK_u,+  pattern SDLK_v,+  pattern SDLK_w,+  pattern SDLK_x,+  pattern SDLK_y,+  pattern SDLK_z,+  pattern SDLK_CAPSLOCK,+  pattern SDLK_F1,+  pattern SDLK_F2,+  pattern SDLK_F3,+  pattern SDLK_F4,+  pattern SDLK_F5,+  pattern SDLK_F6,+  pattern SDLK_F7,+  pattern SDLK_F8,+  pattern SDLK_F9,+  pattern SDLK_F10,+  pattern SDLK_F11,+  pattern SDLK_F12,+  pattern SDLK_PRINTSCREEN,+  pattern SDLK_SCROLLLOCK,+  pattern SDLK_PAUSE,+  pattern SDLK_INSERT,+  pattern SDLK_HOME,+  pattern SDLK_PAGEUP,+  pattern SDLK_DELETE,+  pattern SDLK_END,+  pattern SDLK_PAGEDOWN,+  pattern SDLK_RIGHT,+  pattern SDLK_LEFT,+  pattern SDLK_DOWN,+  pattern SDLK_UP,+  pattern SDLK_NUMLOCKCLEAR,+  pattern SDLK_KP_DIVIDE,+  pattern SDLK_KP_MULTIPLY,+  pattern SDLK_KP_MINUS,+  pattern SDLK_KP_PLUS,+  pattern SDLK_KP_ENTER,+  pattern SDLK_KP_1,+  pattern SDLK_KP_2,+  pattern SDLK_KP_3,+  pattern SDLK_KP_4,+  pattern SDLK_KP_5,+  pattern SDLK_KP_6,+  pattern SDLK_KP_7,+  pattern SDLK_KP_8,+  pattern SDLK_KP_9,+  pattern SDLK_KP_0,+  pattern SDLK_KP_PERIOD,+  pattern SDLK_APPLICATION,+  pattern SDLK_POWER,+  pattern SDLK_KP_EQUALS,+  pattern SDLK_F13,+  pattern SDLK_F14,+  pattern SDLK_F15,+  pattern SDLK_F16,+  pattern SDLK_F17,+  pattern SDLK_F18,+  pattern SDLK_F19,+  pattern SDLK_F20,+  pattern SDLK_F21,+  pattern SDLK_F22,+  pattern SDLK_F23,+  pattern SDLK_F24,+  pattern SDLK_EXECUTE,+  pattern SDLK_HELP,+  pattern SDLK_MENU,+  pattern SDLK_SELECT,+  pattern SDLK_STOP,+  pattern SDLK_AGAIN,+  pattern SDLK_UNDO,+  pattern SDLK_CUT,+  pattern SDLK_COPY,+  pattern SDLK_PASTE,+  pattern SDLK_FIND,+  pattern SDLK_MUTE,+  pattern SDLK_VOLUMEUP,+  pattern SDLK_VOLUMEDOWN,+  pattern SDLK_KP_COMMA,+  pattern SDLK_KP_EQUALSAS400,+  pattern SDLK_ALTERASE,+  pattern SDLK_SYSREQ,+  pattern SDLK_CANCEL,+  pattern SDLK_CLEAR,+  pattern SDLK_PRIOR,+  pattern SDLK_RETURN2,+  pattern SDLK_SEPARATOR,+  pattern SDLK_OUT,+  pattern SDLK_OPER,+  pattern SDLK_CLEARAGAIN,+  pattern SDLK_CRSEL,+  pattern SDLK_EXSEL,+  pattern SDLK_KP_00,+  pattern SDLK_KP_000,+  pattern SDLK_THOUSANDSSEPARATOR,+  pattern SDLK_DECIMALSEPARATOR,+  pattern SDLK_CURRENCYUNIT,+  pattern SDLK_CURRENCYSUBUNIT,+  pattern SDLK_KP_LEFTPAREN,+  pattern SDLK_KP_RIGHTPAREN,+  pattern SDLK_KP_LEFTBRACE,+  pattern SDLK_KP_RIGHTBRACE,+  pattern SDLK_KP_TAB,+  pattern SDLK_KP_BACKSPACE,+  pattern SDLK_KP_A,+  pattern SDLK_KP_B,+  pattern SDLK_KP_C,+  pattern SDLK_KP_D,+  pattern SDLK_KP_E,+  pattern SDLK_KP_F,+  pattern SDLK_KP_XOR,+  pattern SDLK_KP_POWER,+  pattern SDLK_KP_PERCENT,+  pattern SDLK_KP_LESS,+  pattern SDLK_KP_GREATER,+  pattern SDLK_KP_AMPERSAND,+  pattern SDLK_KP_DBLAMPERSAND,+  pattern SDLK_KP_VERTICALBAR,+  pattern SDLK_KP_DBLVERTICALBAR,+  pattern SDLK_KP_COLON,+  pattern SDLK_KP_HASH,+  pattern SDLK_KP_SPACE,+  pattern SDLK_KP_AT,+  pattern SDLK_KP_EXCLAM,+  pattern SDLK_KP_MEMSTORE,+  pattern SDLK_KP_MEMRECALL,+  pattern SDLK_KP_MEMCLEAR,+  pattern SDLK_KP_MEMADD,+  pattern SDLK_KP_MEMSUBTRACT,+  pattern SDLK_KP_MEMMULTIPLY,+  pattern SDLK_KP_MEMDIVIDE,+  pattern SDLK_KP_PLUSMINUS,+  pattern SDLK_KP_CLEAR,+  pattern SDLK_KP_CLEARENTRY,+  pattern SDLK_KP_BINARY,+  pattern SDLK_KP_OCTAL,+  pattern SDLK_KP_DECIMAL,+  pattern SDLK_KP_HEXADECIMAL,+  pattern SDLK_LCTRL,+  pattern SDLK_LSHIFT,+  pattern SDLK_LALT,+  pattern SDLK_LGUI,+  pattern SDLK_RCTRL,+  pattern SDLK_RSHIFT,+  pattern SDLK_RALT,+  pattern SDLK_RGUI,+  pattern SDLK_MODE,+  pattern SDLK_AUDIONEXT,+  pattern SDLK_AUDIOPREV,+  pattern SDLK_AUDIOSTOP,+  pattern SDLK_AUDIOPLAY,+  pattern SDLK_AUDIOMUTE,+  pattern SDLK_MEDIASELECT,+  pattern SDLK_WWW,+  pattern SDLK_MAIL,+  pattern SDLK_CALCULATOR,+  pattern SDLK_COMPUTER,+  pattern SDLK_AC_SEARCH,+  pattern SDLK_AC_HOME,+  pattern SDLK_AC_BACK,+  pattern SDLK_AC_FORWARD,+  pattern SDLK_AC_STOP,+  pattern SDLK_AC_REFRESH,+  pattern SDLK_AC_BOOKMARKS,+  pattern SDLK_BRIGHTNESSDOWN,+  pattern SDLK_BRIGHTNESSUP,+  pattern SDLK_DISPLAYSWITCH,+  pattern SDLK_KBDILLUMTOGGLE,+  pattern SDLK_KBDILLUMDOWN,+  pattern SDLK_KBDILLUMUP,+  pattern SDLK_EJECT,+  pattern SDLK_SLEEP,++  -- ** Key Modifier+  Keymod,+  pattern KMOD_NONE,+  pattern KMOD_LSHIFT,+  pattern KMOD_RSHIFT,+  pattern KMOD_SHIFT,+  pattern KMOD_LCTRL,+  pattern KMOD_RCTRL,+  pattern KMOD_CTRL,+  pattern KMOD_LALT,+  pattern KMOD_RALT,+  pattern KMOD_ALT,+  pattern KMOD_LGUI,+  pattern KMOD_RGUI,+  pattern KMOD_GUI,+  pattern KMOD_NUM,+  pattern KMOD_CAPS,+  pattern KMOD_MODE,+  pattern KMOD_RESERVED,++  -- ** Log Priority+  LogPriority,+  pattern SDL_LOG_PRIORITY_VERBOSE,+  pattern SDL_LOG_PRIORITY_DEBUG,+  pattern SDL_LOG_PRIORITY_INFO,+  pattern SDL_LOG_PRIORITY_WARN,+  pattern SDL_LOG_PRIORITY_ERROR,+  pattern SDL_LOG_PRIORITY_CRITICAL,+  pattern SDL_NUM_LOG_PRIORITIES,++  -- ** Power State+  PowerState,+  pattern SDL_POWERSTATE_UNKNOWN,+  pattern SDL_POWERSTATE_ON_BATTERY,+  pattern SDL_POWERSTATE_NO_BATTERY,+  pattern SDL_POWERSTATE_CHARGING,+  pattern SDL_POWERSTATE_CHARGED,++  -- ** Renderer Flip+  RendererFlip,+  pattern SDL_FLIP_NONE,+  pattern SDL_FLIP_HORIZONTAL,+  pattern SDL_FLIP_VERTICAL,++  -- ** Scancode+  Scancode,+  pattern SDL_SCANCODE_UNKNOWN,+  pattern SDL_SCANCODE_A,+  pattern SDL_SCANCODE_B,+  pattern SDL_SCANCODE_C,+  pattern SDL_SCANCODE_D,+  pattern SDL_SCANCODE_E,+  pattern SDL_SCANCODE_F,+  pattern SDL_SCANCODE_G,+  pattern SDL_SCANCODE_H,+  pattern SDL_SCANCODE_I,+  pattern SDL_SCANCODE_J,+  pattern SDL_SCANCODE_K,+  pattern SDL_SCANCODE_L,+  pattern SDL_SCANCODE_M,+  pattern SDL_SCANCODE_N,+  pattern SDL_SCANCODE_O,+  pattern SDL_SCANCODE_P,+  pattern SDL_SCANCODE_Q,+  pattern SDL_SCANCODE_R,+  pattern SDL_SCANCODE_S,+  pattern SDL_SCANCODE_T,+  pattern SDL_SCANCODE_U,+  pattern SDL_SCANCODE_V,+  pattern SDL_SCANCODE_W,+  pattern SDL_SCANCODE_X,+  pattern SDL_SCANCODE_Y,+  pattern SDL_SCANCODE_Z,+  pattern SDL_SCANCODE_1,+  pattern SDL_SCANCODE_2,+  pattern SDL_SCANCODE_3,+  pattern SDL_SCANCODE_4,+  pattern SDL_SCANCODE_5,+  pattern SDL_SCANCODE_6,+  pattern SDL_SCANCODE_7,+  pattern SDL_SCANCODE_8,+  pattern SDL_SCANCODE_9,+  pattern SDL_SCANCODE_0,+  pattern SDL_SCANCODE_RETURN,+  pattern SDL_SCANCODE_ESCAPE,+  pattern SDL_SCANCODE_BACKSPACE,+  pattern SDL_SCANCODE_TAB,+  pattern SDL_SCANCODE_SPACE,+  pattern SDL_SCANCODE_MINUS,+  pattern SDL_SCANCODE_EQUALS,+  pattern SDL_SCANCODE_LEFTBRACKET,+  pattern SDL_SCANCODE_RIGHTBRACKET,+  pattern SDL_SCANCODE_BACKSLASH,+  pattern SDL_SCANCODE_NONUSHASH,+  pattern SDL_SCANCODE_SEMICOLON,+  pattern SDL_SCANCODE_APOSTROPHE,+  pattern SDL_SCANCODE_GRAVE,+  pattern SDL_SCANCODE_COMMA,+  pattern SDL_SCANCODE_PERIOD,+  pattern SDL_SCANCODE_SLASH,+  pattern SDL_SCANCODE_CAPSLOCK,+  pattern SDL_SCANCODE_F1,+  pattern SDL_SCANCODE_F2,+  pattern SDL_SCANCODE_F3,+  pattern SDL_SCANCODE_F4,+  pattern SDL_SCANCODE_F5,+  pattern SDL_SCANCODE_F6,+  pattern SDL_SCANCODE_F7,+  pattern SDL_SCANCODE_F8,+  pattern SDL_SCANCODE_F9,+  pattern SDL_SCANCODE_F10,+  pattern SDL_SCANCODE_F11,+  pattern SDL_SCANCODE_F12,+  pattern SDL_SCANCODE_PRINTSCREEN,+  pattern SDL_SCANCODE_SCROLLLOCK,+  pattern SDL_SCANCODE_PAUSE,+  pattern SDL_SCANCODE_INSERT,+  pattern SDL_SCANCODE_HOME,+  pattern SDL_SCANCODE_PAGEUP,+  pattern SDL_SCANCODE_DELETE,+  pattern SDL_SCANCODE_END,+  pattern SDL_SCANCODE_PAGEDOWN,+  pattern SDL_SCANCODE_RIGHT,+  pattern SDL_SCANCODE_LEFT,+  pattern SDL_SCANCODE_DOWN,+  pattern SDL_SCANCODE_UP,+  pattern SDL_SCANCODE_NUMLOCKCLEAR,+  pattern SDL_SCANCODE_KP_DIVIDE,+  pattern SDL_SCANCODE_KP_MULTIPLY,+  pattern SDL_SCANCODE_KP_MINUS,+  pattern SDL_SCANCODE_KP_PLUS,+  pattern SDL_SCANCODE_KP_ENTER,+  pattern SDL_SCANCODE_KP_1,+  pattern SDL_SCANCODE_KP_2,+  pattern SDL_SCANCODE_KP_3,+  pattern SDL_SCANCODE_KP_4,+  pattern SDL_SCANCODE_KP_5,+  pattern SDL_SCANCODE_KP_6,+  pattern SDL_SCANCODE_KP_7,+  pattern SDL_SCANCODE_KP_8,+  pattern SDL_SCANCODE_KP_9,+  pattern SDL_SCANCODE_KP_0,+  pattern SDL_SCANCODE_KP_PERIOD,+  pattern SDL_SCANCODE_NONUSBACKSLASH,+  pattern SDL_SCANCODE_APPLICATION,+  pattern SDL_SCANCODE_POWER,+  pattern SDL_SCANCODE_KP_EQUALS,+  pattern SDL_SCANCODE_F13,+  pattern SDL_SCANCODE_F14,+  pattern SDL_SCANCODE_F15,+  pattern SDL_SCANCODE_F16,+  pattern SDL_SCANCODE_F17,+  pattern SDL_SCANCODE_F18,+  pattern SDL_SCANCODE_F19,+  pattern SDL_SCANCODE_F20,+  pattern SDL_SCANCODE_F21,+  pattern SDL_SCANCODE_F22,+  pattern SDL_SCANCODE_F23,+  pattern SDL_SCANCODE_F24,+  pattern SDL_SCANCODE_EXECUTE,+  pattern SDL_SCANCODE_HELP,+  pattern SDL_SCANCODE_MENU,+  pattern SDL_SCANCODE_SELECT,+  pattern SDL_SCANCODE_STOP,+  pattern SDL_SCANCODE_AGAIN,+  pattern SDL_SCANCODE_UNDO,+  pattern SDL_SCANCODE_CUT,+  pattern SDL_SCANCODE_COPY,+  pattern SDL_SCANCODE_PASTE,+  pattern SDL_SCANCODE_FIND,+  pattern SDL_SCANCODE_MUTE,+  pattern SDL_SCANCODE_VOLUMEUP,+  pattern SDL_SCANCODE_VOLUMEDOWN,+  pattern SDL_SCANCODE_KP_COMMA,+  pattern SDL_SCANCODE_KP_EQUALSAS400,+  pattern SDL_SCANCODE_INTERNATIONAL1,+  pattern SDL_SCANCODE_INTERNATIONAL2,+  pattern SDL_SCANCODE_INTERNATIONAL3,+  pattern SDL_SCANCODE_INTERNATIONAL4,+  pattern SDL_SCANCODE_INTERNATIONAL5,+  pattern SDL_SCANCODE_INTERNATIONAL6,+  pattern SDL_SCANCODE_INTERNATIONAL7,+  pattern SDL_SCANCODE_INTERNATIONAL8,+  pattern SDL_SCANCODE_INTERNATIONAL9,+  pattern SDL_SCANCODE_LANG1,+  pattern SDL_SCANCODE_LANG2,+  pattern SDL_SCANCODE_LANG3,+  pattern SDL_SCANCODE_LANG4,+  pattern SDL_SCANCODE_LANG5,+  pattern SDL_SCANCODE_LANG6,+  pattern SDL_SCANCODE_LANG7,+  pattern SDL_SCANCODE_LANG8,+  pattern SDL_SCANCODE_LANG9,+  pattern SDL_SCANCODE_ALTERASE,+  pattern SDL_SCANCODE_SYSREQ,+  pattern SDL_SCANCODE_CANCEL,+  pattern SDL_SCANCODE_CLEAR,+  pattern SDL_SCANCODE_PRIOR,+  pattern SDL_SCANCODE_RETURN2,+  pattern SDL_SCANCODE_SEPARATOR,+  pattern SDL_SCANCODE_OUT,+  pattern SDL_SCANCODE_OPER,+  pattern SDL_SCANCODE_CLEARAGAIN,+  pattern SDL_SCANCODE_CRSEL,+  pattern SDL_SCANCODE_EXSEL,+  pattern SDL_SCANCODE_KP_00,+  pattern SDL_SCANCODE_KP_000,+  pattern SDL_SCANCODE_THOUSANDSSEPARATOR,+  pattern SDL_SCANCODE_DECIMALSEPARATOR,+  pattern SDL_SCANCODE_CURRENCYUNIT,+  pattern SDL_SCANCODE_CURRENCYSUBUNIT,+  pattern SDL_SCANCODE_KP_LEFTPAREN,+  pattern SDL_SCANCODE_KP_RIGHTPAREN,+  pattern SDL_SCANCODE_KP_LEFTBRACE,+  pattern SDL_SCANCODE_KP_RIGHTBRACE,+  pattern SDL_SCANCODE_KP_TAB,+  pattern SDL_SCANCODE_KP_BACKSPACE,+  pattern SDL_SCANCODE_KP_A,+  pattern SDL_SCANCODE_KP_B,+  pattern SDL_SCANCODE_KP_C,+  pattern SDL_SCANCODE_KP_D,+  pattern SDL_SCANCODE_KP_E,+  pattern SDL_SCANCODE_KP_F,+  pattern SDL_SCANCODE_KP_XOR,+  pattern SDL_SCANCODE_KP_POWER,+  pattern SDL_SCANCODE_KP_PERCENT,+  pattern SDL_SCANCODE_KP_LESS,+  pattern SDL_SCANCODE_KP_GREATER,+  pattern SDL_SCANCODE_KP_AMPERSAND,+  pattern SDL_SCANCODE_KP_DBLAMPERSAND,+  pattern SDL_SCANCODE_KP_VERTICALBAR,+  pattern SDL_SCANCODE_KP_DBLVERTICALBAR,+  pattern SDL_SCANCODE_KP_COLON,+  pattern SDL_SCANCODE_KP_HASH,+  pattern SDL_SCANCODE_KP_SPACE,+  pattern SDL_SCANCODE_KP_AT,+  pattern SDL_SCANCODE_KP_EXCLAM,+  pattern SDL_SCANCODE_KP_MEMSTORE,+  pattern SDL_SCANCODE_KP_MEMRECALL,+  pattern SDL_SCANCODE_KP_MEMCLEAR,+  pattern SDL_SCANCODE_KP_MEMADD,+  pattern SDL_SCANCODE_KP_MEMSUBTRACT,+  pattern SDL_SCANCODE_KP_MEMMULTIPLY,+  pattern SDL_SCANCODE_KP_MEMDIVIDE,+  pattern SDL_SCANCODE_KP_PLUSMINUS,+  pattern SDL_SCANCODE_KP_CLEAR,+  pattern SDL_SCANCODE_KP_CLEARENTRY,+  pattern SDL_SCANCODE_KP_BINARY,+  pattern SDL_SCANCODE_KP_OCTAL,+  pattern SDL_SCANCODE_KP_DECIMAL,+  pattern SDL_SCANCODE_KP_HEXADECIMAL,+  pattern SDL_SCANCODE_LCTRL,+  pattern SDL_SCANCODE_LSHIFT,+  pattern SDL_SCANCODE_LALT,+  pattern SDL_SCANCODE_LGUI,+  pattern SDL_SCANCODE_RCTRL,+  pattern SDL_SCANCODE_RSHIFT,+  pattern SDL_SCANCODE_RALT,+  pattern SDL_SCANCODE_RGUI,+  pattern SDL_SCANCODE_MODE,+  pattern SDL_SCANCODE_AUDIONEXT,+  pattern SDL_SCANCODE_AUDIOPREV,+  pattern SDL_SCANCODE_AUDIOSTOP,+  pattern SDL_SCANCODE_AUDIOPLAY,+  pattern SDL_SCANCODE_AUDIOMUTE,+  pattern SDL_SCANCODE_MEDIASELECT,+  pattern SDL_SCANCODE_WWW,+  pattern SDL_SCANCODE_MAIL,+  pattern SDL_SCANCODE_CALCULATOR,+  pattern SDL_SCANCODE_COMPUTER,+  pattern SDL_SCANCODE_AC_SEARCH,+  pattern SDL_SCANCODE_AC_HOME,+  pattern SDL_SCANCODE_AC_BACK,+  pattern SDL_SCANCODE_AC_FORWARD,+  pattern SDL_SCANCODE_AC_STOP,+  pattern SDL_SCANCODE_AC_REFRESH,+  pattern SDL_SCANCODE_AC_BOOKMARKS,+  pattern SDL_SCANCODE_BRIGHTNESSDOWN,+  pattern SDL_SCANCODE_BRIGHTNESSUP,+  pattern SDL_SCANCODE_DISPLAYSWITCH,+  pattern SDL_SCANCODE_KBDILLUMTOGGLE,+  pattern SDL_SCANCODE_KBDILLUMDOWN,+  pattern SDL_SCANCODE_KBDILLUMUP,+  pattern SDL_SCANCODE_EJECT,+  pattern SDL_SCANCODE_SLEEP,+  pattern SDL_SCANCODE_APP1,+  pattern SDL_SCANCODE_APP2,+  pattern SDL_NUM_SCANCODES,++  pattern SDL_SYSTEM_CURSOR_ARROW,+  pattern SDL_SYSTEM_CURSOR_IBEAM,+  pattern SDL_SYSTEM_CURSOR_WAIT,++  -- ** System Cursor+  SystemCursor,+  pattern SDL_SYSTEM_CURSOR_CROSSHAIR,+  pattern SDL_SYSTEM_CURSOR_WAITARROW,+  pattern SDL_SYSTEM_CURSOR_SIZENWSE,+  pattern SDL_SYSTEM_CURSOR_SIZENESW,+  pattern SDL_SYSTEM_CURSOR_SIZEWE,+  pattern SDL_SYSTEM_CURSOR_SIZENS,+  pattern SDL_SYSTEM_CURSOR_SIZEALL,+  pattern SDL_SYSTEM_CURSOR_NO,+  pattern SDL_SYSTEM_CURSOR_HAND,+  pattern SDL_NUM_SYSTEM_CURSORS,++  -- ** Thread Priority+  ThreadPriority,+  pattern SDL_THREAD_PRIORITY_LOW,+  pattern SDL_THREAD_PRIORITY_NORMAL,+  pattern SDL_THREAD_PRIORITY_HIGH,++  -- * Miscellaneous Enumerations+  -- | These enumerations are not used directly by any SDL function, thus they have a polymorphic type.++  -- ** Audio Allowed Changes+  pattern SDL_AUDIO_ALLOW_FREQUENCY_CHANGE,+  pattern SDL_AUDIO_ALLOW_FORMAT_CHANGE,+  pattern SDL_AUDIO_ALLOW_CHANNELS_CHANGE,+  pattern SDL_AUDIO_ALLOW_ANY_CHANGE,++  -- ** Mouse Buttons+  pattern SDL_BUTTON_LEFT,+  pattern SDL_BUTTON_MIDDLE,+  pattern SDL_BUTTON_RIGHT,+  pattern SDL_BUTTON_X1,+  pattern SDL_BUTTON_X2,++  -- ** Mouse Button Masks+  pattern SDL_BUTTON_LMASK,+  pattern SDL_BUTTON_MMASK,+  pattern SDL_BUTTON_RMASK,+  pattern SDL_BUTTON_X1MASK,+  pattern SDL_BUTTON_X2MASK,++  -- ** Mouse Wheel Direction+  pattern SDL_MOUSEWHEEL_NORMAL,+  pattern SDL_MOUSEWHEEL_FLIPPED,++  -- ** Event Type+  pattern SDL_FIRSTEVENT,+  pattern SDL_QUIT,+  pattern SDL_APP_TERMINATING,+  pattern SDL_APP_LOWMEMORY,+  pattern SDL_APP_WILLENTERBACKGROUND,+  pattern SDL_APP_DIDENTERBACKGROUND,+  pattern SDL_APP_WILLENTERFOREGROUND,+  pattern SDL_APP_DIDENTERFOREGROUND,+  pattern SDL_WINDOWEVENT,+  pattern SDL_SYSWMEVENT,+  pattern SDL_KEYDOWN,+  pattern SDL_KEYUP,+  pattern SDL_TEXTEDITING,+  pattern SDL_TEXTINPUT,+  pattern SDL_KEYMAPCHANGED,+  pattern SDL_MOUSEMOTION,+  pattern SDL_MOUSEBUTTONDOWN,+  pattern SDL_MOUSEBUTTONUP,+  pattern SDL_MOUSEWHEEL,+  pattern SDL_JOYAXISMOTION,+  pattern SDL_JOYBALLMOTION,+  pattern SDL_JOYHATMOTION,+  pattern SDL_JOYBUTTONDOWN,+  pattern SDL_JOYBUTTONUP,+  pattern SDL_JOYDEVICEADDED,+  pattern SDL_JOYDEVICEREMOVED,+  pattern SDL_CONTROLLERAXISMOTION,+  pattern SDL_CONTROLLERBUTTONDOWN,+  pattern SDL_CONTROLLERBUTTONUP,+  pattern SDL_CONTROLLERDEVICEADDED,+  pattern SDL_CONTROLLERDEVICEREMOVED,+  pattern SDL_CONTROLLERDEVICEREMAPPED,+  pattern SDL_FINGERDOWN,+  pattern SDL_FINGERUP,+  pattern SDL_FINGERMOTION,+  pattern SDL_DOLLARGESTURE,+  pattern SDL_DOLLARRECORD,+  pattern SDL_MULTIGESTURE,+  pattern SDL_CLIPBOARDUPDATE,+  pattern SDL_DROPFILE,+  pattern SDL_AUDIODEVICEADDED,+  pattern SDL_AUDIODEVICEREMOVED,+  pattern SDL_RENDER_TARGETS_RESET,+  pattern SDL_RENDER_DEVICE_RESET,+  pattern SDL_USEREVENT,+  pattern SDL_LASTEVENT,++  -- ** Joystick Hat Position+  pattern SDL_HAT_CENTERED,+  pattern SDL_HAT_UP,+  pattern SDL_HAT_RIGHT,+  pattern SDL_HAT_DOWN,+  pattern SDL_HAT_LEFT,+  pattern SDL_HAT_RIGHTUP,+  pattern SDL_HAT_RIGHTDOWN,+  pattern SDL_HAT_LEFTUP,+  pattern SDL_HAT_LEFTDOWN,++  -- ** Key States+  pattern SDL_PRESSED,+  pattern SDL_RELEASED,++  -- ** Log Category+  pattern SDL_LOG_CATEGORY_APPLICATION,+  pattern SDL_LOG_CATEGORY_ERROR,+  pattern SDL_LOG_CATEGORY_ASSERT,+  pattern SDL_LOG_CATEGORY_SYSTEM,+  pattern SDL_LOG_CATEGORY_AUDIO,+  pattern SDL_LOG_CATEGORY_VIDEO,+  pattern SDL_LOG_CATEGORY_RENDER,+  pattern SDL_LOG_CATEGORY_INPUT,+  pattern SDL_LOG_CATEGORY_TEST,+  pattern SDL_LOG_CATEGORY_CUSTOM,++  -- ** Message Box Flags+  pattern SDL_MESSAGEBOX_ERROR,+  pattern SDL_MESSAGEBOX_WARNING,+  pattern SDL_MESSAGEBOX_INFORMATION,++  -- ** Message Box Button Flags+  pattern SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT,+  pattern SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT,++  -- ** OpenGL Profile+  pattern SDL_GL_CONTEXT_PROFILE_CORE,+  pattern SDL_GL_CONTEXT_PROFILE_COMPATIBILITY,+  pattern SDL_GL_CONTEXT_PROFILE_ES,++  -- ** OpenGL Context Flag+  pattern SDL_GL_CONTEXT_DEBUG_FLAG,+  pattern SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG,+  pattern SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG,+  pattern SDL_GL_CONTEXT_RESET_ISOLATION_FLAG,++  -- ** OpenGL Context Release Behavior Flag+  pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE,+  pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH,++  -- ** Pixel Formats+  pattern SDL_PIXELFORMAT_UNKNOWN,+  pattern SDL_PIXELFORMAT_INDEX1LSB,+  pattern SDL_PIXELFORMAT_INDEX1MSB,+  pattern SDL_PIXELFORMAT_INDEX4LSB,+  pattern SDL_PIXELFORMAT_INDEX4MSB,+  pattern SDL_PIXELFORMAT_INDEX8,+  pattern SDL_PIXELFORMAT_RGB332,+  pattern SDL_PIXELFORMAT_RGB444,+  pattern SDL_PIXELFORMAT_RGB555,+  pattern SDL_PIXELFORMAT_BGR555,+  pattern SDL_PIXELFORMAT_ARGB4444,+  pattern SDL_PIXELFORMAT_RGBA4444,+  pattern SDL_PIXELFORMAT_ABGR4444,+  pattern SDL_PIXELFORMAT_BGRA4444,+  pattern SDL_PIXELFORMAT_ARGB1555,+  pattern SDL_PIXELFORMAT_RGBA5551,+  pattern SDL_PIXELFORMAT_ABGR1555,+  pattern SDL_PIXELFORMAT_BGRA5551,+  pattern SDL_PIXELFORMAT_RGB565,+  pattern SDL_PIXELFORMAT_BGR565,+  pattern SDL_PIXELFORMAT_RGB24,+  pattern SDL_PIXELFORMAT_BGR24,+  pattern SDL_PIXELFORMAT_RGB888,+  pattern SDL_PIXELFORMAT_RGBX8888,+  pattern SDL_PIXELFORMAT_BGR888,+  pattern SDL_PIXELFORMAT_BGRX8888,+  pattern SDL_PIXELFORMAT_ARGB8888,+  pattern SDL_PIXELFORMAT_RGBA8888,+  pattern SDL_PIXELFORMAT_ABGR8888,+  pattern SDL_PIXELFORMAT_BGRA8888,+  pattern SDL_PIXELFORMAT_ARGB2101010,+  pattern SDL_PIXELFORMAT_YV12,+  pattern SDL_PIXELFORMAT_IYUV,+  pattern SDL_PIXELFORMAT_YUY2,+  pattern SDL_PIXELFORMAT_UYVY,+  pattern SDL_PIXELFORMAT_YVYU,++  -- ** Renderer Flags+  pattern SDL_RENDERER_SOFTWARE,+  pattern SDL_RENDERER_ACCELERATED,+  pattern SDL_RENDERER_PRESENTVSYNC,+  pattern SDL_RENDERER_TARGETTEXTURE,++  -- ** Texture Access+  pattern SDL_TEXTUREACCESS_STATIC,+  pattern SDL_TEXTUREACCESS_STREAMING,+  pattern SDL_TEXTUREACCESS_TARGET,++  -- ** Texture Modulate+  pattern SDL_TEXTUREMODULATE_NONE,+  pattern SDL_TEXTUREMODULATE_COLOR,+  pattern SDL_TEXTUREMODULATE_ALPHA,++  -- ** Touch+  pattern SDL_TOUCH_MOUSEID,++  -- ** Window Event+  pattern SDL_WINDOWEVENT_NONE,+  pattern SDL_WINDOWEVENT_SHOWN,+  pattern SDL_WINDOWEVENT_HIDDEN,+  pattern SDL_WINDOWEVENT_EXPOSED,+  pattern SDL_WINDOWEVENT_MOVED,+  pattern SDL_WINDOWEVENT_RESIZED,+  pattern SDL_WINDOWEVENT_SIZE_CHANGED,+  pattern SDL_WINDOWEVENT_MINIMIZED,+  pattern SDL_WINDOWEVENT_MAXIMIZED,+  pattern SDL_WINDOWEVENT_RESTORED,+  pattern SDL_WINDOWEVENT_ENTER,+  pattern SDL_WINDOWEVENT_LEAVE,+  pattern SDL_WINDOWEVENT_FOCUS_GAINED,+  pattern SDL_WINDOWEVENT_FOCUS_LOST,+  pattern SDL_WINDOWEVENT_CLOSE,++  -- ** Window Flags+  pattern SDL_WINDOW_FULLSCREEN,+  pattern SDL_WINDOW_OPENGL,+  pattern SDL_WINDOW_SHOWN,+  pattern SDL_WINDOW_HIDDEN,+  pattern SDL_WINDOW_BORDERLESS,+  pattern SDL_WINDOW_RESIZABLE,+  pattern SDL_WINDOW_MINIMIZED,+  pattern SDL_WINDOW_MAXIMIZED,+  pattern SDL_WINDOW_INPUT_GRABBED,+  pattern SDL_WINDOW_INPUT_FOCUS,+  pattern SDL_WINDOW_MOUSE_FOCUS,+  pattern SDL_WINDOW_FULLSCREEN_DESKTOP,+  pattern SDL_WINDOW_FOREIGN,+  pattern SDL_WINDOW_ALLOW_HIGHDPI,+  pattern SDL_WINDOW_MOUSE_CAPTURE,++  -- ** Window Positioning+  pattern SDL_WINDOWPOS_UNDEFINED,+  pattern SDL_WINDOWPOS_CENTERED,++  -- ** Haptic Event Types+  pattern SDL_HAPTIC_CONSTANT+) where++#include "SDL.h"++import Data.Int+import Data.Word++import Foreign.C.Types++type AudioFormat = (#type SDL_AudioFormat)+type AudioStatus = (#type SDL_AudioStatus)+type BlendMode = (#type SDL_BlendMode)+type Endian = CInt+type EventAction = (#type SDL_eventaction)+type GameControllerAxis = (#type SDL_GameControllerAxis)+type GameControllerButton = (#type SDL_GameControllerButton)+type GLattr = (#type SDL_GLattr)+type HintPriority = (#type SDL_HintPriority)+type InitFlag = Word32+type JoystickPowerLevel = (#type SDL_JoystickPowerLevel)+type Keycode = (#type SDL_Keycode)+type Keymod = (#type SDL_Keymod)+type LogPriority = (#type SDL_LogPriority)+type PowerState = (#type SDL_PowerState)+type RendererFlip = (#type SDL_RendererFlip)+type Scancode = (#type SDL_Scancode)+type SystemCursor = (#type SDL_SystemCursor)+type ThreadPriority = (#type SDL_ThreadPriority)++pattern SDL_AUDIO_S8 = (#const AUDIO_S8) :: AudioFormat+pattern SDL_AUDIO_U8 = (#const AUDIO_U8) :: AudioFormat+pattern SDL_AUDIO_S16LSB = (#const AUDIO_S16LSB) :: AudioFormat+pattern SDL_AUDIO_S16MSB = (#const AUDIO_S16MSB) :: AudioFormat+pattern SDL_AUDIO_S16SYS = (#const AUDIO_S16SYS) :: AudioFormat+pattern SDL_AUDIO_U16LSB = (#const AUDIO_U16LSB) :: AudioFormat+pattern SDL_AUDIO_U16MSB = (#const AUDIO_U16MSB) :: AudioFormat+pattern SDL_AUDIO_U16SYS = (#const AUDIO_U16SYS) :: AudioFormat+pattern SDL_AUDIO_S32LSB = (#const AUDIO_S32LSB) :: AudioFormat+pattern SDL_AUDIO_S32MSB = (#const AUDIO_S32MSB) :: AudioFormat+pattern SDL_AUDIO_S32SYS = (#const AUDIO_S32SYS) :: AudioFormat+pattern SDL_AUDIO_F32LSB = (#const AUDIO_F32LSB) :: AudioFormat+pattern SDL_AUDIO_F32MSB = (#const AUDIO_F32MSB) :: AudioFormat+pattern SDL_AUDIO_F32SYS = (#const AUDIO_F32SYS) :: AudioFormat++pattern SDL_AUDIO_STOPPED = (#const SDL_AUDIO_STOPPED) :: AudioStatus+pattern SDL_AUDIO_PLAYING = (#const SDL_AUDIO_PLAYING) :: AudioStatus+pattern SDL_AUDIO_PAUSED = (#const SDL_AUDIO_PAUSED) :: AudioStatus++pattern SDL_BLENDMODE_NONE = (#const SDL_BLENDMODE_NONE) :: BlendMode+pattern SDL_BLENDMODE_BLEND = (#const SDL_BLENDMODE_BLEND) :: BlendMode+pattern SDL_BLENDMODE_ADD = (#const SDL_BLENDMODE_ADD) :: BlendMode+pattern SDL_BLENDMODE_MOD = (#const SDL_BLENDMODE_MOD) :: BlendMode++pattern SDL_BYTEORDER = (#const SDL_BYTEORDER) :: Endian+pattern SDL_LIL_ENDIAN = (#const SDL_LIL_ENDIAN) :: Endian+pattern SDL_BIG_ENDIAN = (#const SDL_BIG_ENDIAN) :: Endian++pattern SDL_ADDEVENT = (#const SDL_ADDEVENT) :: EventAction+pattern SDL_PEEKEVENT = (#const SDL_PEEKEVENT) :: EventAction+pattern SDL_GETEVENT = (#const SDL_GETEVENT) :: EventAction++pattern SDL_CONTROLLER_AXIS_INVALID = (#const SDL_CONTROLLER_AXIS_INVALID) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_LEFTX = (#const SDL_CONTROLLER_AXIS_LEFTX) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_LEFTY = (#const SDL_CONTROLLER_AXIS_LEFTY) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_RIGHTX = (#const SDL_CONTROLLER_AXIS_RIGHTX) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_RIGHTY = (#const SDL_CONTROLLER_AXIS_RIGHTY) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_TRIGGERLEFT = (#const SDL_CONTROLLER_AXIS_TRIGGERLEFT) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_TRIGGERRIGHT = (#const SDL_CONTROLLER_AXIS_TRIGGERRIGHT) :: GameControllerAxis+pattern SDL_CONTROLLER_AXIS_MAX = (#const SDL_CONTROLLER_AXIS_MAX) :: GameControllerAxis++pattern SDL_CONTROLLER_BUTTON_INVALID = (#const SDL_CONTROLLER_BUTTON_INVALID) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_A = (#const SDL_CONTROLLER_BUTTON_A) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_B = (#const SDL_CONTROLLER_BUTTON_B) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_X = (#const SDL_CONTROLLER_BUTTON_X) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_Y = (#const SDL_CONTROLLER_BUTTON_Y) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_BACK = (#const SDL_CONTROLLER_BUTTON_BACK) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_GUIDE = (#const SDL_CONTROLLER_BUTTON_GUIDE) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_START = (#const SDL_CONTROLLER_BUTTON_START) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_LEFTSTICK = (#const SDL_CONTROLLER_BUTTON_LEFTSTICK) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_RIGHTSTICK = (#const SDL_CONTROLLER_BUTTON_RIGHTSTICK) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_LEFTSHOULDER = (#const SDL_CONTROLLER_BUTTON_LEFTSHOULDER) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = (#const SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_DPAD_UP = (#const SDL_CONTROLLER_BUTTON_DPAD_UP) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_DPAD_DOWN = (#const SDL_CONTROLLER_BUTTON_DPAD_DOWN) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_DPAD_LEFT = (#const SDL_CONTROLLER_BUTTON_DPAD_LEFT) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_DPAD_RIGHT = (#const SDL_CONTROLLER_BUTTON_DPAD_RIGHT) :: GameControllerButton+pattern SDL_CONTROLLER_BUTTON_MAX = (#const SDL_CONTROLLER_BUTTON_MAX) :: GameControllerButton++pattern SDL_GL_RED_SIZE = (#const SDL_GL_RED_SIZE) :: GLattr+pattern SDL_GL_GREEN_SIZE = (#const SDL_GL_GREEN_SIZE) :: GLattr+pattern SDL_GL_BLUE_SIZE = (#const SDL_GL_BLUE_SIZE) :: GLattr+pattern SDL_GL_ALPHA_SIZE = (#const SDL_GL_ALPHA_SIZE) :: GLattr+pattern SDL_GL_BUFFER_SIZE = (#const SDL_GL_BUFFER_SIZE) :: GLattr+pattern SDL_GL_DOUBLEBUFFER = (#const SDL_GL_DOUBLEBUFFER) :: GLattr+pattern SDL_GL_DEPTH_SIZE = (#const SDL_GL_DEPTH_SIZE) :: GLattr+pattern SDL_GL_STENCIL_SIZE = (#const SDL_GL_STENCIL_SIZE) :: GLattr+pattern SDL_GL_ACCUM_RED_SIZE = (#const SDL_GL_ACCUM_RED_SIZE) :: GLattr+pattern SDL_GL_ACCUM_GREEN_SIZE = (#const SDL_GL_ACCUM_GREEN_SIZE) :: GLattr+pattern SDL_GL_ACCUM_BLUE_SIZE = (#const SDL_GL_ACCUM_BLUE_SIZE) :: GLattr+pattern SDL_GL_ACCUM_ALPHA_SIZE = (#const SDL_GL_ACCUM_ALPHA_SIZE) :: GLattr+pattern SDL_GL_STEREO = (#const SDL_GL_STEREO) :: GLattr+pattern SDL_GL_MULTISAMPLEBUFFERS = (#const SDL_GL_MULTISAMPLEBUFFERS) :: GLattr+pattern SDL_GL_MULTISAMPLESAMPLES = (#const SDL_GL_MULTISAMPLESAMPLES) :: GLattr+pattern SDL_GL_ACCELERATED_VISUAL = (#const SDL_GL_ACCELERATED_VISUAL) :: GLattr+pattern SDL_GL_RETAINED_BACKING = (#const SDL_GL_RETAINED_BACKING) :: GLattr+pattern SDL_GL_CONTEXT_MAJOR_VERSION = (#const SDL_GL_CONTEXT_MAJOR_VERSION) :: GLattr+pattern SDL_GL_CONTEXT_MINOR_VERSION = (#const SDL_GL_CONTEXT_MINOR_VERSION) :: GLattr+pattern SDL_GL_CONTEXT_EGL = (#const SDL_GL_CONTEXT_EGL) :: GLattr+pattern SDL_GL_CONTEXT_FLAGS = (#const SDL_GL_CONTEXT_FLAGS) :: GLattr+pattern SDL_GL_CONTEXT_PROFILE_MASK = (#const SDL_GL_CONTEXT_PROFILE_MASK) :: GLattr+pattern SDL_GL_SHARE_WITH_CURRENT_CONTEXT = (#const SDL_GL_SHARE_WITH_CURRENT_CONTEXT) :: GLattr+pattern SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = (#const SDL_GL_FRAMEBUFFER_SRGB_CAPABLE) :: GLattr+pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR = (#const SDL_GL_CONTEXT_RELEASE_BEHAVIOR) :: GLattr++pattern SDL_HINT_DEFAULT = (#const SDL_HINT_DEFAULT) :: HintPriority+pattern SDL_HINT_NORMAL = (#const SDL_HINT_NORMAL) :: HintPriority+pattern SDL_HINT_OVERRIDE = (#const SDL_HINT_OVERRIDE) :: HintPriority++pattern SDL_INIT_TIMER = (#const SDL_INIT_TIMER) :: InitFlag+pattern SDL_INIT_AUDIO = (#const SDL_INIT_AUDIO) :: InitFlag+pattern SDL_INIT_VIDEO = (#const SDL_INIT_VIDEO) :: InitFlag+pattern SDL_INIT_JOYSTICK = (#const SDL_INIT_JOYSTICK) :: InitFlag+pattern SDL_INIT_HAPTIC = (#const SDL_INIT_HAPTIC) :: InitFlag+pattern SDL_INIT_GAMECONTROLLER = (#const SDL_INIT_GAMECONTROLLER) :: InitFlag+pattern SDL_INIT_EVENTS = (#const SDL_INIT_EVENTS) :: InitFlag+pattern SDL_INIT_NOPARACHUTE = (#const SDL_INIT_NOPARACHUTE) :: InitFlag+pattern SDL_INIT_EVERYTHING = (#const SDL_INIT_EVERYTHING) :: InitFlag++pattern SDL_JOYSTICK_POWER_UNKNOWN = (#const SDL_JOYSTICK_POWER_UNKNOWN) :: JoystickPowerLevel+pattern SDL_JOYSTICK_POWER_EMPTY = (#const SDL_JOYSTICK_POWER_EMPTY) :: JoystickPowerLevel+pattern SDL_JOYSTICK_POWER_LOW = (#const SDL_JOYSTICK_POWER_LOW) :: JoystickPowerLevel+pattern SDL_JOYSTICK_POWER_MEDIUM = (#const SDL_JOYSTICK_POWER_MEDIUM) :: JoystickPowerLevel+pattern SDL_JOYSTICK_POWER_FULL = (#const SDL_JOYSTICK_POWER_FULL) :: JoystickPowerLevel+pattern SDL_JOYSTICK_POWER_WIRED = (#const SDL_JOYSTICK_POWER_WIRED) :: JoystickPowerLevel+pattern SDL_JOYSTICK_POWER_MAX = (#const SDL_JOYSTICK_POWER_MAX) :: JoystickPowerLevel++pattern SDLK_UNKNOWN = (#const SDLK_UNKNOWN) :: Keycode+pattern SDLK_RETURN = (#const SDLK_RETURN) :: Keycode+pattern SDLK_ESCAPE = (#const SDLK_ESCAPE) :: Keycode+pattern SDLK_BACKSPACE = (#const SDLK_BACKSPACE) :: Keycode+pattern SDLK_TAB = (#const SDLK_TAB) :: Keycode+pattern SDLK_SPACE = (#const SDLK_SPACE) :: Keycode+pattern SDLK_EXCLAIM = (#const SDLK_EXCLAIM) :: Keycode+pattern SDLK_QUOTEDBL = (#const SDLK_QUOTEDBL) :: Keycode+pattern SDLK_HASH = (#const SDLK_HASH) :: Keycode+pattern SDLK_PERCENT = (#const SDLK_PERCENT) :: Keycode+pattern SDLK_DOLLAR = (#const SDLK_DOLLAR) :: Keycode+pattern SDLK_AMPERSAND = (#const SDLK_AMPERSAND) :: Keycode+pattern SDLK_QUOTE = (#const SDLK_QUOTE) :: Keycode+pattern SDLK_LEFTPAREN = (#const SDLK_LEFTPAREN) :: Keycode+pattern SDLK_RIGHTPAREN = (#const SDLK_RIGHTPAREN) :: Keycode+pattern SDLK_ASTERISK = (#const SDLK_ASTERISK) :: Keycode+pattern SDLK_PLUS = (#const SDLK_PLUS) :: Keycode+pattern SDLK_COMMA = (#const SDLK_COMMA) :: Keycode+pattern SDLK_MINUS = (#const SDLK_MINUS) :: Keycode+pattern SDLK_PERIOD = (#const SDLK_PERIOD) :: Keycode+pattern SDLK_SLASH = (#const SDLK_SLASH) :: Keycode+pattern SDLK_0 = (#const SDLK_0) :: Keycode+pattern SDLK_1 = (#const SDLK_1) :: Keycode+pattern SDLK_2 = (#const SDLK_2) :: Keycode+pattern SDLK_3 = (#const SDLK_3) :: Keycode+pattern SDLK_4 = (#const SDLK_4) :: Keycode+pattern SDLK_5 = (#const SDLK_5) :: Keycode+pattern SDLK_6 = (#const SDLK_6) :: Keycode+pattern SDLK_7 = (#const SDLK_7) :: Keycode+pattern SDLK_8 = (#const SDLK_8) :: Keycode+pattern SDLK_9 = (#const SDLK_9) :: Keycode+pattern SDLK_COLON = (#const SDLK_COLON) :: Keycode+pattern SDLK_SEMICOLON = (#const SDLK_SEMICOLON) :: Keycode+pattern SDLK_LESS = (#const SDLK_LESS) :: Keycode+pattern SDLK_EQUALS = (#const SDLK_EQUALS) :: Keycode+pattern SDLK_GREATER = (#const SDLK_GREATER) :: Keycode+pattern SDLK_QUESTION = (#const SDLK_QUESTION) :: Keycode+pattern SDLK_AT = (#const SDLK_AT) :: Keycode+pattern SDLK_LEFTBRACKET = (#const SDLK_LEFTBRACKET) :: Keycode+pattern SDLK_BACKSLASH = (#const SDLK_BACKSLASH) :: Keycode+pattern SDLK_RIGHTBRACKET = (#const SDLK_RIGHTBRACKET) :: Keycode+pattern SDLK_CARET = (#const SDLK_CARET) :: Keycode+pattern SDLK_UNDERSCORE = (#const SDLK_UNDERSCORE) :: Keycode+pattern SDLK_BACKQUOTE = (#const SDLK_BACKQUOTE) :: Keycode+pattern SDLK_a = (#const SDLK_a) :: Keycode+pattern SDLK_b = (#const SDLK_b) :: Keycode+pattern SDLK_c = (#const SDLK_c) :: Keycode+pattern SDLK_d = (#const SDLK_d) :: Keycode+pattern SDLK_e = (#const SDLK_e) :: Keycode+pattern SDLK_f = (#const SDLK_f) :: Keycode+pattern SDLK_g = (#const SDLK_g) :: Keycode+pattern SDLK_h = (#const SDLK_h) :: Keycode+pattern SDLK_i = (#const SDLK_i) :: Keycode+pattern SDLK_j = (#const SDLK_j) :: Keycode+pattern SDLK_k = (#const SDLK_k) :: Keycode+pattern SDLK_l = (#const SDLK_l) :: Keycode+pattern SDLK_m = (#const SDLK_m) :: Keycode+pattern SDLK_n = (#const SDLK_n) :: Keycode+pattern SDLK_o = (#const SDLK_o) :: Keycode+pattern SDLK_p = (#const SDLK_p) :: Keycode+pattern SDLK_q = (#const SDLK_q) :: Keycode+pattern SDLK_r = (#const SDLK_r) :: Keycode+pattern SDLK_s = (#const SDLK_s) :: Keycode+pattern SDLK_t = (#const SDLK_t) :: Keycode+pattern SDLK_u = (#const SDLK_u) :: Keycode+pattern SDLK_v = (#const SDLK_v) :: Keycode+pattern SDLK_w = (#const SDLK_w) :: Keycode+pattern SDLK_x = (#const SDLK_x) :: Keycode+pattern SDLK_y = (#const SDLK_y) :: Keycode+pattern SDLK_z = (#const SDLK_z) :: Keycode+pattern SDLK_CAPSLOCK = (#const SDLK_CAPSLOCK) :: Keycode+pattern SDLK_F1 = (#const SDLK_F1) :: Keycode+pattern SDLK_F2 = (#const SDLK_F2) :: Keycode+pattern SDLK_F3 = (#const SDLK_F3) :: Keycode+pattern SDLK_F4 = (#const SDLK_F4) :: Keycode+pattern SDLK_F5 = (#const SDLK_F5) :: Keycode+pattern SDLK_F6 = (#const SDLK_F6) :: Keycode+pattern SDLK_F7 = (#const SDLK_F7) :: Keycode+pattern SDLK_F8 = (#const SDLK_F8) :: Keycode+pattern SDLK_F9 = (#const SDLK_F9) :: Keycode+pattern SDLK_F10 = (#const SDLK_F10) :: Keycode+pattern SDLK_F11 = (#const SDLK_F11) :: Keycode+pattern SDLK_F12 = (#const SDLK_F12) :: Keycode+pattern SDLK_PRINTSCREEN = (#const SDLK_PRINTSCREEN) :: Keycode+pattern SDLK_SCROLLLOCK = (#const SDLK_SCROLLLOCK) :: Keycode+pattern SDLK_PAUSE = (#const SDLK_PAUSE) :: Keycode+pattern SDLK_INSERT = (#const SDLK_INSERT) :: Keycode+pattern SDLK_HOME = (#const SDLK_HOME) :: Keycode+pattern SDLK_PAGEUP = (#const SDLK_PAGEUP) :: Keycode+pattern SDLK_DELETE = (#const SDLK_DELETE) :: Keycode+pattern SDLK_END = (#const SDLK_END) :: Keycode+pattern SDLK_PAGEDOWN = (#const SDLK_PAGEDOWN) :: Keycode+pattern SDLK_RIGHT = (#const SDLK_RIGHT) :: Keycode+pattern SDLK_LEFT = (#const SDLK_LEFT) :: Keycode+pattern SDLK_DOWN = (#const SDLK_DOWN) :: Keycode+pattern SDLK_UP = (#const SDLK_UP) :: Keycode+pattern SDLK_NUMLOCKCLEAR = (#const SDLK_NUMLOCKCLEAR) :: Keycode+pattern SDLK_KP_DIVIDE = (#const SDLK_KP_DIVIDE) :: Keycode+pattern SDLK_KP_MULTIPLY = (#const SDLK_KP_MULTIPLY) :: Keycode+pattern SDLK_KP_MINUS = (#const SDLK_KP_MINUS) :: Keycode+pattern SDLK_KP_PLUS = (#const SDLK_KP_PLUS) :: Keycode+pattern SDLK_KP_ENTER = (#const SDLK_KP_ENTER) :: Keycode+pattern SDLK_KP_1 = (#const SDLK_KP_1) :: Keycode+pattern SDLK_KP_2 = (#const SDLK_KP_2) :: Keycode+pattern SDLK_KP_3 = (#const SDLK_KP_3) :: Keycode+pattern SDLK_KP_4 = (#const SDLK_KP_4) :: Keycode+pattern SDLK_KP_5 = (#const SDLK_KP_5) :: Keycode+pattern SDLK_KP_6 = (#const SDLK_KP_6) :: Keycode+pattern SDLK_KP_7 = (#const SDLK_KP_7) :: Keycode+pattern SDLK_KP_8 = (#const SDLK_KP_8) :: Keycode+pattern SDLK_KP_9 = (#const SDLK_KP_9) :: Keycode+pattern SDLK_KP_0 = (#const SDLK_KP_0) :: Keycode+pattern SDLK_KP_PERIOD = (#const SDLK_KP_PERIOD) :: Keycode+pattern SDLK_APPLICATION = (#const SDLK_APPLICATION) :: Keycode+pattern SDLK_POWER = (#const SDLK_POWER) :: Keycode+pattern SDLK_KP_EQUALS = (#const SDLK_KP_EQUALS) :: Keycode+pattern SDLK_F13 = (#const SDLK_F13) :: Keycode+pattern SDLK_F14 = (#const SDLK_F14) :: Keycode+pattern SDLK_F15 = (#const SDLK_F15) :: Keycode+pattern SDLK_F16 = (#const SDLK_F16) :: Keycode+pattern SDLK_F17 = (#const SDLK_F17) :: Keycode+pattern SDLK_F18 = (#const SDLK_F18) :: Keycode+pattern SDLK_F19 = (#const SDLK_F19) :: Keycode+pattern SDLK_F20 = (#const SDLK_F20) :: Keycode+pattern SDLK_F21 = (#const SDLK_F21) :: Keycode+pattern SDLK_F22 = (#const SDLK_F22) :: Keycode+pattern SDLK_F23 = (#const SDLK_F23) :: Keycode+pattern SDLK_F24 = (#const SDLK_F24) :: Keycode+pattern SDLK_EXECUTE = (#const SDLK_EXECUTE) :: Keycode+pattern SDLK_HELP = (#const SDLK_HELP) :: Keycode+pattern SDLK_MENU = (#const SDLK_MENU) :: Keycode+pattern SDLK_SELECT = (#const SDLK_SELECT) :: Keycode+pattern SDLK_STOP = (#const SDLK_STOP) :: Keycode+pattern SDLK_AGAIN = (#const SDLK_AGAIN) :: Keycode+pattern SDLK_UNDO = (#const SDLK_UNDO) :: Keycode+pattern SDLK_CUT = (#const SDLK_CUT) :: Keycode+pattern SDLK_COPY = (#const SDLK_COPY) :: Keycode+pattern SDLK_PASTE = (#const SDLK_PASTE) :: Keycode+pattern SDLK_FIND = (#const SDLK_FIND) :: Keycode+pattern SDLK_MUTE = (#const SDLK_MUTE) :: Keycode+pattern SDLK_VOLUMEUP = (#const SDLK_VOLUMEUP) :: Keycode+pattern SDLK_VOLUMEDOWN = (#const SDLK_VOLUMEDOWN) :: Keycode+pattern SDLK_KP_COMMA = (#const SDLK_KP_COMMA) :: Keycode+pattern SDLK_KP_EQUALSAS400 = (#const SDLK_KP_EQUALSAS400) :: Keycode+pattern SDLK_ALTERASE = (#const SDLK_ALTERASE) :: Keycode+pattern SDLK_SYSREQ = (#const SDLK_SYSREQ) :: Keycode+pattern SDLK_CANCEL = (#const SDLK_CANCEL) :: Keycode+pattern SDLK_CLEAR = (#const SDLK_CLEAR) :: Keycode+pattern SDLK_PRIOR = (#const SDLK_PRIOR) :: Keycode+pattern SDLK_RETURN2 = (#const SDLK_RETURN2) :: Keycode+pattern SDLK_SEPARATOR = (#const SDLK_SEPARATOR) :: Keycode+pattern SDLK_OUT = (#const SDLK_OUT) :: Keycode+pattern SDLK_OPER = (#const SDLK_OPER) :: Keycode+pattern SDLK_CLEARAGAIN = (#const SDLK_CLEARAGAIN) :: Keycode+pattern SDLK_CRSEL = (#const SDLK_CRSEL) :: Keycode+pattern SDLK_EXSEL = (#const SDLK_EXSEL) :: Keycode+pattern SDLK_KP_00 = (#const SDLK_KP_00) :: Keycode+pattern SDLK_KP_000 = (#const SDLK_KP_000) :: Keycode+pattern SDLK_THOUSANDSSEPARATOR = (#const SDLK_THOUSANDSSEPARATOR) :: Keycode+pattern SDLK_DECIMALSEPARATOR = (#const SDLK_DECIMALSEPARATOR) :: Keycode+pattern SDLK_CURRENCYUNIT = (#const SDLK_CURRENCYUNIT) :: Keycode+pattern SDLK_CURRENCYSUBUNIT = (#const SDLK_CURRENCYSUBUNIT) :: Keycode+pattern SDLK_KP_LEFTPAREN = (#const SDLK_KP_LEFTPAREN) :: Keycode+pattern SDLK_KP_RIGHTPAREN = (#const SDLK_KP_RIGHTPAREN) :: Keycode+pattern SDLK_KP_LEFTBRACE = (#const SDLK_KP_LEFTBRACE) :: Keycode+pattern SDLK_KP_RIGHTBRACE = (#const SDLK_KP_RIGHTBRACE) :: Keycode+pattern SDLK_KP_TAB = (#const SDLK_KP_TAB) :: Keycode+pattern SDLK_KP_BACKSPACE = (#const SDLK_KP_BACKSPACE) :: Keycode+pattern SDLK_KP_A = (#const SDLK_KP_A) :: Keycode+pattern SDLK_KP_B = (#const SDLK_KP_B) :: Keycode+pattern SDLK_KP_C = (#const SDLK_KP_C) :: Keycode+pattern SDLK_KP_D = (#const SDLK_KP_D) :: Keycode+pattern SDLK_KP_E = (#const SDLK_KP_E) :: Keycode+pattern SDLK_KP_F = (#const SDLK_KP_F) :: Keycode+pattern SDLK_KP_XOR = (#const SDLK_KP_XOR) :: Keycode+pattern SDLK_KP_POWER = (#const SDLK_KP_POWER) :: Keycode+pattern SDLK_KP_PERCENT = (#const SDLK_KP_PERCENT) :: Keycode+pattern SDLK_KP_LESS = (#const SDLK_KP_LESS) :: Keycode+pattern SDLK_KP_GREATER = (#const SDLK_KP_GREATER) :: Keycode+pattern SDLK_KP_AMPERSAND = (#const SDLK_KP_AMPERSAND) :: Keycode+pattern SDLK_KP_DBLAMPERSAND = (#const SDLK_KP_DBLAMPERSAND) :: Keycode+pattern SDLK_KP_VERTICALBAR = (#const SDLK_KP_VERTICALBAR) :: Keycode+pattern SDLK_KP_DBLVERTICALBAR = (#const SDLK_KP_DBLVERTICALBAR) :: Keycode+pattern SDLK_KP_COLON = (#const SDLK_KP_COLON) :: Keycode+pattern SDLK_KP_HASH = (#const SDLK_KP_HASH) :: Keycode+pattern SDLK_KP_SPACE = (#const SDLK_KP_SPACE) :: Keycode+pattern SDLK_KP_AT = (#const SDLK_KP_AT) :: Keycode+pattern SDLK_KP_EXCLAM = (#const SDLK_KP_EXCLAM) :: Keycode+pattern SDLK_KP_MEMSTORE = (#const SDLK_KP_MEMSTORE) :: Keycode+pattern SDLK_KP_MEMRECALL = (#const SDLK_KP_MEMRECALL) :: Keycode+pattern SDLK_KP_MEMCLEAR = (#const SDLK_KP_MEMCLEAR) :: Keycode+pattern SDLK_KP_MEMADD = (#const SDLK_KP_MEMADD) :: Keycode+pattern SDLK_KP_MEMSUBTRACT = (#const SDLK_KP_MEMSUBTRACT) :: Keycode+pattern SDLK_KP_MEMMULTIPLY = (#const SDLK_KP_MEMMULTIPLY) :: Keycode+pattern SDLK_KP_MEMDIVIDE = (#const SDLK_KP_MEMDIVIDE) :: Keycode+pattern SDLK_KP_PLUSMINUS = (#const SDLK_KP_PLUSMINUS) :: Keycode+pattern SDLK_KP_CLEAR = (#const SDLK_KP_CLEAR) :: Keycode+pattern SDLK_KP_CLEARENTRY = (#const SDLK_KP_CLEARENTRY) :: Keycode+pattern SDLK_KP_BINARY = (#const SDLK_KP_BINARY) :: Keycode+pattern SDLK_KP_OCTAL = (#const SDLK_KP_OCTAL) :: Keycode+pattern SDLK_KP_DECIMAL = (#const SDLK_KP_DECIMAL) :: Keycode+pattern SDLK_KP_HEXADECIMAL = (#const SDLK_KP_HEXADECIMAL) :: Keycode+pattern SDLK_LCTRL = (#const SDLK_LCTRL) :: Keycode+pattern SDLK_LSHIFT = (#const SDLK_LSHIFT) :: Keycode+pattern SDLK_LALT = (#const SDLK_LALT) :: Keycode+pattern SDLK_LGUI = (#const SDLK_LGUI) :: Keycode+pattern SDLK_RCTRL = (#const SDLK_RCTRL) :: Keycode+pattern SDLK_RSHIFT = (#const SDLK_RSHIFT) :: Keycode+pattern SDLK_RALT = (#const SDLK_RALT) :: Keycode+pattern SDLK_RGUI = (#const SDLK_RGUI) :: Keycode+pattern SDLK_MODE = (#const SDLK_MODE) :: Keycode+pattern SDLK_AUDIONEXT = (#const SDLK_AUDIONEXT) :: Keycode+pattern SDLK_AUDIOPREV = (#const SDLK_AUDIOPREV) :: Keycode+pattern SDLK_AUDIOSTOP = (#const SDLK_AUDIOSTOP) :: Keycode+pattern SDLK_AUDIOPLAY = (#const SDLK_AUDIOPLAY) :: Keycode+pattern SDLK_AUDIOMUTE = (#const SDLK_AUDIOMUTE) :: Keycode+pattern SDLK_MEDIASELECT = (#const SDLK_MEDIASELECT) :: Keycode+pattern SDLK_WWW = (#const SDLK_WWW) :: Keycode+pattern SDLK_MAIL = (#const SDLK_MAIL) :: Keycode+pattern SDLK_CALCULATOR = (#const SDLK_CALCULATOR) :: Keycode+pattern SDLK_COMPUTER = (#const SDLK_COMPUTER) :: Keycode+pattern SDLK_AC_SEARCH = (#const SDLK_AC_SEARCH) :: Keycode+pattern SDLK_AC_HOME = (#const SDLK_AC_HOME) :: Keycode+pattern SDLK_AC_BACK = (#const SDLK_AC_BACK) :: Keycode+pattern SDLK_AC_FORWARD = (#const SDLK_AC_FORWARD) :: Keycode+pattern SDLK_AC_STOP = (#const SDLK_AC_STOP) :: Keycode+pattern SDLK_AC_REFRESH = (#const SDLK_AC_REFRESH) :: Keycode+pattern SDLK_AC_BOOKMARKS = (#const SDLK_AC_BOOKMARKS) :: Keycode+pattern SDLK_BRIGHTNESSDOWN = (#const SDLK_BRIGHTNESSDOWN) :: Keycode+pattern SDLK_BRIGHTNESSUP = (#const SDLK_BRIGHTNESSUP) :: Keycode+pattern SDLK_DISPLAYSWITCH = (#const SDLK_DISPLAYSWITCH) :: Keycode+pattern SDLK_KBDILLUMTOGGLE = (#const SDLK_KBDILLUMTOGGLE) :: Keycode+pattern SDLK_KBDILLUMDOWN = (#const SDLK_KBDILLUMDOWN) :: Keycode+pattern SDLK_KBDILLUMUP = (#const SDLK_KBDILLUMUP) :: Keycode+pattern SDLK_EJECT = (#const SDLK_EJECT) :: Keycode+pattern SDLK_SLEEP = (#const SDLK_SLEEP) :: Keycode++pattern KMOD_NONE = (#const KMOD_NONE)+pattern KMOD_LSHIFT = (#const KMOD_LSHIFT)+pattern KMOD_RSHIFT = (#const KMOD_RSHIFT)+pattern KMOD_SHIFT = (#const KMOD_SHIFT)+pattern KMOD_LCTRL = (#const KMOD_LCTRL)+pattern KMOD_RCTRL = (#const KMOD_RCTRL)+pattern KMOD_CTRL = (#const KMOD_CTRL)+pattern KMOD_LALT = (#const KMOD_LALT)+pattern KMOD_RALT = (#const KMOD_RALT)+pattern KMOD_ALT = (#const KMOD_ALT)+pattern KMOD_LGUI = (#const KMOD_LGUI)+pattern KMOD_RGUI = (#const KMOD_RGUI)+pattern KMOD_GUI = (#const KMOD_GUI)+pattern KMOD_NUM = (#const KMOD_NUM)+pattern KMOD_CAPS = (#const KMOD_CAPS)+pattern KMOD_MODE = (#const KMOD_MODE)+pattern KMOD_RESERVED = (#const KMOD_RESERVED)++pattern SDL_LOG_PRIORITY_VERBOSE = (#const SDL_LOG_PRIORITY_VERBOSE) :: LogPriority+pattern SDL_LOG_PRIORITY_DEBUG = (#const SDL_LOG_PRIORITY_DEBUG) :: LogPriority+pattern SDL_LOG_PRIORITY_INFO = (#const SDL_LOG_PRIORITY_INFO) :: LogPriority+pattern SDL_LOG_PRIORITY_WARN = (#const SDL_LOG_PRIORITY_WARN) :: LogPriority+pattern SDL_LOG_PRIORITY_ERROR = (#const SDL_LOG_PRIORITY_ERROR) :: LogPriority+pattern SDL_LOG_PRIORITY_CRITICAL = (#const SDL_LOG_PRIORITY_CRITICAL) :: LogPriority+pattern SDL_NUM_LOG_PRIORITIES = (#const SDL_NUM_LOG_PRIORITIES) :: LogPriority++pattern SDL_POWERSTATE_UNKNOWN = (#const SDL_POWERSTATE_UNKNOWN) :: PowerState+pattern SDL_POWERSTATE_ON_BATTERY = (#const SDL_POWERSTATE_ON_BATTERY) :: PowerState+pattern SDL_POWERSTATE_NO_BATTERY = (#const SDL_POWERSTATE_NO_BATTERY) :: PowerState+pattern SDL_POWERSTATE_CHARGING = (#const SDL_POWERSTATE_CHARGING) :: PowerState+pattern SDL_POWERSTATE_CHARGED = (#const SDL_POWERSTATE_CHARGED) :: PowerState++pattern SDL_FLIP_NONE = (#const SDL_FLIP_NONE) :: RendererFlip+pattern SDL_FLIP_HORIZONTAL = (#const SDL_FLIP_HORIZONTAL) :: RendererFlip+pattern SDL_FLIP_VERTICAL = (#const SDL_FLIP_VERTICAL) :: RendererFlip++pattern SDL_SCANCODE_UNKNOWN = (#const SDL_SCANCODE_UNKNOWN) :: Scancode+pattern SDL_SCANCODE_A = (#const SDL_SCANCODE_A) :: Scancode+pattern SDL_SCANCODE_B = (#const SDL_SCANCODE_B) :: Scancode+pattern SDL_SCANCODE_C = (#const SDL_SCANCODE_C) :: Scancode+pattern SDL_SCANCODE_D = (#const SDL_SCANCODE_D) :: Scancode+pattern SDL_SCANCODE_E = (#const SDL_SCANCODE_E) :: Scancode+pattern SDL_SCANCODE_F = (#const SDL_SCANCODE_F) :: Scancode+pattern SDL_SCANCODE_G = (#const SDL_SCANCODE_G) :: Scancode+pattern SDL_SCANCODE_H = (#const SDL_SCANCODE_H) :: Scancode+pattern SDL_SCANCODE_I = (#const SDL_SCANCODE_I) :: Scancode+pattern SDL_SCANCODE_J = (#const SDL_SCANCODE_J) :: Scancode+pattern SDL_SCANCODE_K = (#const SDL_SCANCODE_K) :: Scancode+pattern SDL_SCANCODE_L = (#const SDL_SCANCODE_L) :: Scancode+pattern SDL_SCANCODE_M = (#const SDL_SCANCODE_M) :: Scancode+pattern SDL_SCANCODE_N = (#const SDL_SCANCODE_N) :: Scancode+pattern SDL_SCANCODE_O = (#const SDL_SCANCODE_O) :: Scancode+pattern SDL_SCANCODE_P = (#const SDL_SCANCODE_P) :: Scancode+pattern SDL_SCANCODE_Q = (#const SDL_SCANCODE_Q) :: Scancode+pattern SDL_SCANCODE_R = (#const SDL_SCANCODE_R) :: Scancode+pattern SDL_SCANCODE_S = (#const SDL_SCANCODE_S) :: Scancode+pattern SDL_SCANCODE_T = (#const SDL_SCANCODE_T) :: Scancode+pattern SDL_SCANCODE_U = (#const SDL_SCANCODE_U) :: Scancode+pattern SDL_SCANCODE_V = (#const SDL_SCANCODE_V) :: Scancode+pattern SDL_SCANCODE_W = (#const SDL_SCANCODE_W) :: Scancode+pattern SDL_SCANCODE_X = (#const SDL_SCANCODE_X) :: Scancode+pattern SDL_SCANCODE_Y = (#const SDL_SCANCODE_Y) :: Scancode+pattern SDL_SCANCODE_Z = (#const SDL_SCANCODE_Z) :: Scancode+pattern SDL_SCANCODE_1 = (#const SDL_SCANCODE_1) :: Scancode+pattern SDL_SCANCODE_2 = (#const SDL_SCANCODE_2) :: Scancode+pattern SDL_SCANCODE_3 = (#const SDL_SCANCODE_3) :: Scancode+pattern SDL_SCANCODE_4 = (#const SDL_SCANCODE_4) :: Scancode+pattern SDL_SCANCODE_5 = (#const SDL_SCANCODE_5) :: Scancode+pattern SDL_SCANCODE_6 = (#const SDL_SCANCODE_6) :: Scancode+pattern SDL_SCANCODE_7 = (#const SDL_SCANCODE_7) :: Scancode+pattern SDL_SCANCODE_8 = (#const SDL_SCANCODE_8) :: Scancode+pattern SDL_SCANCODE_9 = (#const SDL_SCANCODE_9) :: Scancode+pattern SDL_SCANCODE_0 = (#const SDL_SCANCODE_0) :: Scancode+pattern SDL_SCANCODE_RETURN = (#const SDL_SCANCODE_RETURN) :: Scancode+pattern SDL_SCANCODE_ESCAPE = (#const SDL_SCANCODE_ESCAPE) :: Scancode+pattern SDL_SCANCODE_BACKSPACE = (#const SDL_SCANCODE_BACKSPACE) :: Scancode+pattern SDL_SCANCODE_TAB = (#const SDL_SCANCODE_TAB) :: Scancode+pattern SDL_SCANCODE_SPACE = (#const SDL_SCANCODE_SPACE) :: Scancode+pattern SDL_SCANCODE_MINUS = (#const SDL_SCANCODE_MINUS) :: Scancode+pattern SDL_SCANCODE_EQUALS = (#const SDL_SCANCODE_EQUALS) :: Scancode+pattern SDL_SCANCODE_LEFTBRACKET = (#const SDL_SCANCODE_LEFTBRACKET) :: Scancode+pattern SDL_SCANCODE_RIGHTBRACKET = (#const SDL_SCANCODE_RIGHTBRACKET) :: Scancode+pattern SDL_SCANCODE_BACKSLASH = (#const SDL_SCANCODE_BACKSLASH) :: Scancode+pattern SDL_SCANCODE_NONUSHASH = (#const SDL_SCANCODE_NONUSHASH) :: Scancode+pattern SDL_SCANCODE_SEMICOLON = (#const SDL_SCANCODE_SEMICOLON) :: Scancode+pattern SDL_SCANCODE_APOSTROPHE = (#const SDL_SCANCODE_APOSTROPHE) :: Scancode+pattern SDL_SCANCODE_GRAVE = (#const SDL_SCANCODE_GRAVE) :: Scancode+pattern SDL_SCANCODE_COMMA = (#const SDL_SCANCODE_COMMA) :: Scancode+pattern SDL_SCANCODE_PERIOD = (#const SDL_SCANCODE_PERIOD) :: Scancode+pattern SDL_SCANCODE_SLASH = (#const SDL_SCANCODE_SLASH) :: Scancode+pattern SDL_SCANCODE_CAPSLOCK = (#const SDL_SCANCODE_CAPSLOCK) :: Scancode+pattern SDL_SCANCODE_F1 = (#const SDL_SCANCODE_F1) :: Scancode+pattern SDL_SCANCODE_F2 = (#const SDL_SCANCODE_F2) :: Scancode+pattern SDL_SCANCODE_F3 = (#const SDL_SCANCODE_F3) :: Scancode+pattern SDL_SCANCODE_F4 = (#const SDL_SCANCODE_F4) :: Scancode+pattern SDL_SCANCODE_F5 = (#const SDL_SCANCODE_F5) :: Scancode+pattern SDL_SCANCODE_F6 = (#const SDL_SCANCODE_F6) :: Scancode+pattern SDL_SCANCODE_F7 = (#const SDL_SCANCODE_F7) :: Scancode+pattern SDL_SCANCODE_F8 = (#const SDL_SCANCODE_F8) :: Scancode+pattern SDL_SCANCODE_F9 = (#const SDL_SCANCODE_F9) :: Scancode+pattern SDL_SCANCODE_F10 = (#const SDL_SCANCODE_F10) :: Scancode+pattern SDL_SCANCODE_F11 = (#const SDL_SCANCODE_F11) :: Scancode+pattern SDL_SCANCODE_F12 = (#const SDL_SCANCODE_F12) :: Scancode+pattern SDL_SCANCODE_PRINTSCREEN = (#const SDL_SCANCODE_PRINTSCREEN) :: Scancode+pattern SDL_SCANCODE_SCROLLLOCK = (#const SDL_SCANCODE_SCROLLLOCK) :: Scancode+pattern SDL_SCANCODE_PAUSE = (#const SDL_SCANCODE_PAUSE) :: Scancode+pattern SDL_SCANCODE_INSERT = (#const SDL_SCANCODE_INSERT) :: Scancode+pattern SDL_SCANCODE_HOME = (#const SDL_SCANCODE_HOME) :: Scancode+pattern SDL_SCANCODE_PAGEUP = (#const SDL_SCANCODE_PAGEUP) :: Scancode+pattern SDL_SCANCODE_DELETE = (#const SDL_SCANCODE_DELETE) :: Scancode+pattern SDL_SCANCODE_END = (#const SDL_SCANCODE_END) :: Scancode+pattern SDL_SCANCODE_PAGEDOWN = (#const SDL_SCANCODE_PAGEDOWN) :: Scancode+pattern SDL_SCANCODE_RIGHT = (#const SDL_SCANCODE_RIGHT) :: Scancode+pattern SDL_SCANCODE_LEFT = (#const SDL_SCANCODE_LEFT) :: Scancode+pattern SDL_SCANCODE_DOWN = (#const SDL_SCANCODE_DOWN) :: Scancode+pattern SDL_SCANCODE_UP = (#const SDL_SCANCODE_UP) :: Scancode+pattern SDL_SCANCODE_NUMLOCKCLEAR = (#const SDL_SCANCODE_NUMLOCKCLEAR) :: Scancode+pattern SDL_SCANCODE_KP_DIVIDE = (#const SDL_SCANCODE_KP_DIVIDE) :: Scancode+pattern SDL_SCANCODE_KP_MULTIPLY = (#const SDL_SCANCODE_KP_MULTIPLY) :: Scancode+pattern SDL_SCANCODE_KP_MINUS = (#const SDL_SCANCODE_KP_MINUS) :: Scancode+pattern SDL_SCANCODE_KP_PLUS = (#const SDL_SCANCODE_KP_PLUS) :: Scancode+pattern SDL_SCANCODE_KP_ENTER = (#const SDL_SCANCODE_KP_ENTER) :: Scancode+pattern SDL_SCANCODE_KP_1 = (#const SDL_SCANCODE_KP_1) :: Scancode+pattern SDL_SCANCODE_KP_2 = (#const SDL_SCANCODE_KP_2) :: Scancode+pattern SDL_SCANCODE_KP_3 = (#const SDL_SCANCODE_KP_3) :: Scancode+pattern SDL_SCANCODE_KP_4 = (#const SDL_SCANCODE_KP_4) :: Scancode+pattern SDL_SCANCODE_KP_5 = (#const SDL_SCANCODE_KP_5) :: Scancode+pattern SDL_SCANCODE_KP_6 = (#const SDL_SCANCODE_KP_6) :: Scancode+pattern SDL_SCANCODE_KP_7 = (#const SDL_SCANCODE_KP_7) :: Scancode+pattern SDL_SCANCODE_KP_8 = (#const SDL_SCANCODE_KP_8) :: Scancode+pattern SDL_SCANCODE_KP_9 = (#const SDL_SCANCODE_KP_9) :: Scancode+pattern SDL_SCANCODE_KP_0 = (#const SDL_SCANCODE_KP_0) :: Scancode+pattern SDL_SCANCODE_KP_PERIOD = (#const SDL_SCANCODE_KP_PERIOD) :: Scancode+pattern SDL_SCANCODE_NONUSBACKSLASH = (#const SDL_SCANCODE_NONUSBACKSLASH) :: Scancode+pattern SDL_SCANCODE_APPLICATION = (#const SDL_SCANCODE_APPLICATION) :: Scancode+pattern SDL_SCANCODE_POWER = (#const SDL_SCANCODE_POWER) :: Scancode+pattern SDL_SCANCODE_KP_EQUALS = (#const SDL_SCANCODE_KP_EQUALS) :: Scancode+pattern SDL_SCANCODE_F13 = (#const SDL_SCANCODE_F13) :: Scancode+pattern SDL_SCANCODE_F14 = (#const SDL_SCANCODE_F14) :: Scancode+pattern SDL_SCANCODE_F15 = (#const SDL_SCANCODE_F15) :: Scancode+pattern SDL_SCANCODE_F16 = (#const SDL_SCANCODE_F16) :: Scancode+pattern SDL_SCANCODE_F17 = (#const SDL_SCANCODE_F17) :: Scancode+pattern SDL_SCANCODE_F18 = (#const SDL_SCANCODE_F18) :: Scancode+pattern SDL_SCANCODE_F19 = (#const SDL_SCANCODE_F19) :: Scancode+pattern SDL_SCANCODE_F20 = (#const SDL_SCANCODE_F20) :: Scancode+pattern SDL_SCANCODE_F21 = (#const SDL_SCANCODE_F21) :: Scancode+pattern SDL_SCANCODE_F22 = (#const SDL_SCANCODE_F22) :: Scancode+pattern SDL_SCANCODE_F23 = (#const SDL_SCANCODE_F23) :: Scancode+pattern SDL_SCANCODE_F24 = (#const SDL_SCANCODE_F24) :: Scancode+pattern SDL_SCANCODE_EXECUTE = (#const SDL_SCANCODE_EXECUTE) :: Scancode+pattern SDL_SCANCODE_HELP = (#const SDL_SCANCODE_HELP) :: Scancode+pattern SDL_SCANCODE_MENU = (#const SDL_SCANCODE_MENU) :: Scancode+pattern SDL_SCANCODE_SELECT = (#const SDL_SCANCODE_SELECT) :: Scancode+pattern SDL_SCANCODE_STOP = (#const SDL_SCANCODE_STOP) :: Scancode+pattern SDL_SCANCODE_AGAIN = (#const SDL_SCANCODE_AGAIN) :: Scancode+pattern SDL_SCANCODE_UNDO = (#const SDL_SCANCODE_UNDO) :: Scancode+pattern SDL_SCANCODE_CUT = (#const SDL_SCANCODE_CUT) :: Scancode+pattern SDL_SCANCODE_COPY = (#const SDL_SCANCODE_COPY) :: Scancode+pattern SDL_SCANCODE_PASTE = (#const SDL_SCANCODE_PASTE) :: Scancode+pattern SDL_SCANCODE_FIND = (#const SDL_SCANCODE_FIND) :: Scancode+pattern SDL_SCANCODE_MUTE = (#const SDL_SCANCODE_MUTE) :: Scancode+pattern SDL_SCANCODE_VOLUMEUP = (#const SDL_SCANCODE_VOLUMEUP) :: Scancode+pattern SDL_SCANCODE_VOLUMEDOWN = (#const SDL_SCANCODE_VOLUMEDOWN) :: Scancode+pattern SDL_SCANCODE_KP_COMMA = (#const SDL_SCANCODE_KP_COMMA) :: Scancode+pattern SDL_SCANCODE_KP_EQUALSAS400 = (#const SDL_SCANCODE_KP_EQUALSAS400) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL1 = (#const SDL_SCANCODE_INTERNATIONAL1) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL2 = (#const SDL_SCANCODE_INTERNATIONAL2) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL3 = (#const SDL_SCANCODE_INTERNATIONAL3) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL4 = (#const SDL_SCANCODE_INTERNATIONAL4) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL5 = (#const SDL_SCANCODE_INTERNATIONAL5) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL6 = (#const SDL_SCANCODE_INTERNATIONAL6) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL7 = (#const SDL_SCANCODE_INTERNATIONAL7) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL8 = (#const SDL_SCANCODE_INTERNATIONAL8) :: Scancode+pattern SDL_SCANCODE_INTERNATIONAL9 = (#const SDL_SCANCODE_INTERNATIONAL9) :: Scancode+pattern SDL_SCANCODE_LANG1 = (#const SDL_SCANCODE_LANG1) :: Scancode+pattern SDL_SCANCODE_LANG2 = (#const SDL_SCANCODE_LANG2) :: Scancode+pattern SDL_SCANCODE_LANG3 = (#const SDL_SCANCODE_LANG3) :: Scancode+pattern SDL_SCANCODE_LANG4 = (#const SDL_SCANCODE_LANG4) :: Scancode+pattern SDL_SCANCODE_LANG5 = (#const SDL_SCANCODE_LANG5) :: Scancode+pattern SDL_SCANCODE_LANG6 = (#const SDL_SCANCODE_LANG6) :: Scancode+pattern SDL_SCANCODE_LANG7 = (#const SDL_SCANCODE_LANG7) :: Scancode+pattern SDL_SCANCODE_LANG8 = (#const SDL_SCANCODE_LANG8) :: Scancode+pattern SDL_SCANCODE_LANG9 = (#const SDL_SCANCODE_LANG9) :: Scancode+pattern SDL_SCANCODE_ALTERASE = (#const SDL_SCANCODE_ALTERASE) :: Scancode+pattern SDL_SCANCODE_SYSREQ = (#const SDL_SCANCODE_SYSREQ) :: Scancode+pattern SDL_SCANCODE_CANCEL = (#const SDL_SCANCODE_CANCEL) :: Scancode+pattern SDL_SCANCODE_CLEAR = (#const SDL_SCANCODE_CLEAR) :: Scancode+pattern SDL_SCANCODE_PRIOR = (#const SDL_SCANCODE_PRIOR) :: Scancode+pattern SDL_SCANCODE_RETURN2 = (#const SDL_SCANCODE_RETURN2) :: Scancode+pattern SDL_SCANCODE_SEPARATOR = (#const SDL_SCANCODE_SEPARATOR) :: Scancode+pattern SDL_SCANCODE_OUT = (#const SDL_SCANCODE_OUT) :: Scancode+pattern SDL_SCANCODE_OPER = (#const SDL_SCANCODE_OPER) :: Scancode+pattern SDL_SCANCODE_CLEARAGAIN = (#const SDL_SCANCODE_CLEARAGAIN) :: Scancode+pattern SDL_SCANCODE_CRSEL = (#const SDL_SCANCODE_CRSEL) :: Scancode+pattern SDL_SCANCODE_EXSEL = (#const SDL_SCANCODE_EXSEL) :: Scancode+pattern SDL_SCANCODE_KP_00 = (#const SDL_SCANCODE_KP_00) :: Scancode+pattern SDL_SCANCODE_KP_000 = (#const SDL_SCANCODE_KP_000) :: Scancode+pattern SDL_SCANCODE_THOUSANDSSEPARATOR = (#const SDL_SCANCODE_THOUSANDSSEPARATOR) :: Scancode+pattern SDL_SCANCODE_DECIMALSEPARATOR = (#const SDL_SCANCODE_DECIMALSEPARATOR) :: Scancode+pattern SDL_SCANCODE_CURRENCYUNIT = (#const SDL_SCANCODE_CURRENCYUNIT) :: Scancode+pattern SDL_SCANCODE_CURRENCYSUBUNIT = (#const SDL_SCANCODE_CURRENCYSUBUNIT) :: Scancode+pattern SDL_SCANCODE_KP_LEFTPAREN = (#const SDL_SCANCODE_KP_LEFTPAREN) :: Scancode+pattern SDL_SCANCODE_KP_RIGHTPAREN = (#const SDL_SCANCODE_KP_RIGHTPAREN) :: Scancode+pattern SDL_SCANCODE_KP_LEFTBRACE = (#const SDL_SCANCODE_KP_LEFTBRACE) :: Scancode+pattern SDL_SCANCODE_KP_RIGHTBRACE = (#const SDL_SCANCODE_KP_RIGHTBRACE) :: Scancode+pattern SDL_SCANCODE_KP_TAB = (#const SDL_SCANCODE_KP_TAB) :: Scancode+pattern SDL_SCANCODE_KP_BACKSPACE = (#const SDL_SCANCODE_KP_BACKSPACE) :: Scancode+pattern SDL_SCANCODE_KP_A = (#const SDL_SCANCODE_KP_A) :: Scancode+pattern SDL_SCANCODE_KP_B = (#const SDL_SCANCODE_KP_B) :: Scancode+pattern SDL_SCANCODE_KP_C = (#const SDL_SCANCODE_KP_C) :: Scancode+pattern SDL_SCANCODE_KP_D = (#const SDL_SCANCODE_KP_D) :: Scancode+pattern SDL_SCANCODE_KP_E = (#const SDL_SCANCODE_KP_E) :: Scancode+pattern SDL_SCANCODE_KP_F = (#const SDL_SCANCODE_KP_F) :: Scancode+pattern SDL_SCANCODE_KP_XOR = (#const SDL_SCANCODE_KP_XOR) :: Scancode+pattern SDL_SCANCODE_KP_POWER = (#const SDL_SCANCODE_KP_POWER) :: Scancode+pattern SDL_SCANCODE_KP_PERCENT = (#const SDL_SCANCODE_KP_PERCENT) :: Scancode+pattern SDL_SCANCODE_KP_LESS = (#const SDL_SCANCODE_KP_LESS) :: Scancode+pattern SDL_SCANCODE_KP_GREATER = (#const SDL_SCANCODE_KP_GREATER) :: Scancode+pattern SDL_SCANCODE_KP_AMPERSAND = (#const SDL_SCANCODE_KP_AMPERSAND) :: Scancode+pattern SDL_SCANCODE_KP_DBLAMPERSAND = (#const SDL_SCANCODE_KP_DBLAMPERSAND) :: Scancode+pattern SDL_SCANCODE_KP_VERTICALBAR = (#const SDL_SCANCODE_KP_VERTICALBAR) :: Scancode+pattern SDL_SCANCODE_KP_DBLVERTICALBAR = (#const SDL_SCANCODE_KP_DBLVERTICALBAR) :: Scancode+pattern SDL_SCANCODE_KP_COLON = (#const SDL_SCANCODE_KP_COLON) :: Scancode+pattern SDL_SCANCODE_KP_HASH = (#const SDL_SCANCODE_KP_HASH) :: Scancode+pattern SDL_SCANCODE_KP_SPACE = (#const SDL_SCANCODE_KP_SPACE) :: Scancode+pattern SDL_SCANCODE_KP_AT = (#const SDL_SCANCODE_KP_AT) :: Scancode+pattern SDL_SCANCODE_KP_EXCLAM = (#const SDL_SCANCODE_KP_EXCLAM) :: Scancode+pattern SDL_SCANCODE_KP_MEMSTORE = (#const SDL_SCANCODE_KP_MEMSTORE) :: Scancode+pattern SDL_SCANCODE_KP_MEMRECALL = (#const SDL_SCANCODE_KP_MEMRECALL) :: Scancode+pattern SDL_SCANCODE_KP_MEMCLEAR = (#const SDL_SCANCODE_KP_MEMCLEAR) :: Scancode+pattern SDL_SCANCODE_KP_MEMADD = (#const SDL_SCANCODE_KP_MEMADD) :: Scancode+pattern SDL_SCANCODE_KP_MEMSUBTRACT = (#const SDL_SCANCODE_KP_MEMSUBTRACT) :: Scancode+pattern SDL_SCANCODE_KP_MEMMULTIPLY = (#const SDL_SCANCODE_KP_MEMMULTIPLY) :: Scancode+pattern SDL_SCANCODE_KP_MEMDIVIDE = (#const SDL_SCANCODE_KP_MEMDIVIDE) :: Scancode+pattern SDL_SCANCODE_KP_PLUSMINUS = (#const SDL_SCANCODE_KP_PLUSMINUS) :: Scancode+pattern SDL_SCANCODE_KP_CLEAR = (#const SDL_SCANCODE_KP_CLEAR) :: Scancode+pattern SDL_SCANCODE_KP_CLEARENTRY = (#const SDL_SCANCODE_KP_CLEARENTRY) :: Scancode+pattern SDL_SCANCODE_KP_BINARY = (#const SDL_SCANCODE_KP_BINARY) :: Scancode+pattern SDL_SCANCODE_KP_OCTAL = (#const SDL_SCANCODE_KP_OCTAL) :: Scancode+pattern SDL_SCANCODE_KP_DECIMAL = (#const SDL_SCANCODE_KP_DECIMAL) :: Scancode+pattern SDL_SCANCODE_KP_HEXADECIMAL = (#const SDL_SCANCODE_KP_HEXADECIMAL) :: Scancode+pattern SDL_SCANCODE_LCTRL = (#const SDL_SCANCODE_LCTRL) :: Scancode+pattern SDL_SCANCODE_LSHIFT = (#const SDL_SCANCODE_LSHIFT) :: Scancode+pattern SDL_SCANCODE_LALT = (#const SDL_SCANCODE_LALT) :: Scancode+pattern SDL_SCANCODE_LGUI = (#const SDL_SCANCODE_LGUI) :: Scancode+pattern SDL_SCANCODE_RCTRL = (#const SDL_SCANCODE_RCTRL) :: Scancode+pattern SDL_SCANCODE_RSHIFT = (#const SDL_SCANCODE_RSHIFT) :: Scancode+pattern SDL_SCANCODE_RALT = (#const SDL_SCANCODE_RALT) :: Scancode+pattern SDL_SCANCODE_RGUI = (#const SDL_SCANCODE_RGUI) :: Scancode+pattern SDL_SCANCODE_MODE = (#const SDL_SCANCODE_MODE) :: Scancode+pattern SDL_SCANCODE_AUDIONEXT = (#const SDL_SCANCODE_AUDIONEXT) :: Scancode+pattern SDL_SCANCODE_AUDIOPREV = (#const SDL_SCANCODE_AUDIOPREV) :: Scancode+pattern SDL_SCANCODE_AUDIOSTOP = (#const SDL_SCANCODE_AUDIOSTOP) :: Scancode+pattern SDL_SCANCODE_AUDIOPLAY = (#const SDL_SCANCODE_AUDIOPLAY) :: Scancode+pattern SDL_SCANCODE_AUDIOMUTE = (#const SDL_SCANCODE_AUDIOMUTE) :: Scancode+pattern SDL_SCANCODE_MEDIASELECT = (#const SDL_SCANCODE_MEDIASELECT) :: Scancode+pattern SDL_SCANCODE_WWW = (#const SDL_SCANCODE_WWW) :: Scancode+pattern SDL_SCANCODE_MAIL = (#const SDL_SCANCODE_MAIL) :: Scancode+pattern SDL_SCANCODE_CALCULATOR = (#const SDL_SCANCODE_CALCULATOR) :: Scancode+pattern SDL_SCANCODE_COMPUTER = (#const SDL_SCANCODE_COMPUTER) :: Scancode+pattern SDL_SCANCODE_AC_SEARCH = (#const SDL_SCANCODE_AC_SEARCH) :: Scancode+pattern SDL_SCANCODE_AC_HOME = (#const SDL_SCANCODE_AC_HOME) :: Scancode+pattern SDL_SCANCODE_AC_BACK = (#const SDL_SCANCODE_AC_BACK) :: Scancode+pattern SDL_SCANCODE_AC_FORWARD = (#const SDL_SCANCODE_AC_FORWARD) :: Scancode+pattern SDL_SCANCODE_AC_STOP = (#const SDL_SCANCODE_AC_STOP) :: Scancode+pattern SDL_SCANCODE_AC_REFRESH = (#const SDL_SCANCODE_AC_REFRESH) :: Scancode+pattern SDL_SCANCODE_AC_BOOKMARKS = (#const SDL_SCANCODE_AC_BOOKMARKS) :: Scancode+pattern SDL_SCANCODE_BRIGHTNESSDOWN = (#const SDL_SCANCODE_BRIGHTNESSDOWN) :: Scancode+pattern SDL_SCANCODE_BRIGHTNESSUP = (#const SDL_SCANCODE_BRIGHTNESSUP) :: Scancode+pattern SDL_SCANCODE_DISPLAYSWITCH = (#const SDL_SCANCODE_DISPLAYSWITCH) :: Scancode+pattern SDL_SCANCODE_KBDILLUMTOGGLE = (#const SDL_SCANCODE_KBDILLUMTOGGLE) :: Scancode+pattern SDL_SCANCODE_KBDILLUMDOWN = (#const SDL_SCANCODE_KBDILLUMDOWN) :: Scancode+pattern SDL_SCANCODE_KBDILLUMUP = (#const SDL_SCANCODE_KBDILLUMUP) :: Scancode+pattern SDL_SCANCODE_EJECT = (#const SDL_SCANCODE_EJECT) :: Scancode+pattern SDL_SCANCODE_SLEEP = (#const SDL_SCANCODE_SLEEP) :: Scancode+pattern SDL_SCANCODE_APP1 = (#const SDL_SCANCODE_APP1) :: Scancode+pattern SDL_SCANCODE_APP2 = (#const SDL_SCANCODE_APP2) :: Scancode+pattern SDL_NUM_SCANCODES = (#const SDL_NUM_SCANCODES) :: Scancode++pattern SDL_SYSTEM_CURSOR_ARROW = (#const SDL_SYSTEM_CURSOR_ARROW) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_IBEAM = (#const SDL_SYSTEM_CURSOR_IBEAM) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_WAIT = (#const SDL_SYSTEM_CURSOR_WAIT) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_CROSSHAIR = (#const SDL_SYSTEM_CURSOR_CROSSHAIR) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_WAITARROW = (#const SDL_SYSTEM_CURSOR_WAITARROW) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_SIZENWSE = (#const SDL_SYSTEM_CURSOR_SIZENWSE) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_SIZENESW = (#const SDL_SYSTEM_CURSOR_SIZENESW) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_SIZEWE = (#const SDL_SYSTEM_CURSOR_SIZEWE) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_SIZENS = (#const SDL_SYSTEM_CURSOR_SIZENS) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_SIZEALL = (#const SDL_SYSTEM_CURSOR_SIZEALL) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_NO = (#const SDL_SYSTEM_CURSOR_NO) :: SystemCursor+pattern SDL_SYSTEM_CURSOR_HAND = (#const SDL_SYSTEM_CURSOR_HAND) :: SystemCursor+pattern SDL_NUM_SYSTEM_CURSORS = (#const SDL_NUM_SYSTEM_CURSORS) :: SystemCursor++pattern SDL_THREAD_PRIORITY_LOW = (#const SDL_THREAD_PRIORITY_LOW) :: ThreadPriority+pattern SDL_THREAD_PRIORITY_NORMAL = (#const SDL_THREAD_PRIORITY_NORMAL) :: ThreadPriority+pattern SDL_THREAD_PRIORITY_HIGH = (#const SDL_THREAD_PRIORITY_HIGH) :: ThreadPriority++pattern SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = (#const SDL_AUDIO_ALLOW_FREQUENCY_CHANGE)+pattern SDL_AUDIO_ALLOW_FORMAT_CHANGE = (#const SDL_AUDIO_ALLOW_FORMAT_CHANGE)+pattern SDL_AUDIO_ALLOW_CHANNELS_CHANGE = (#const SDL_AUDIO_ALLOW_CHANNELS_CHANGE)+pattern SDL_AUDIO_ALLOW_ANY_CHANGE = (#const SDL_AUDIO_ALLOW_ANY_CHANGE)++pattern SDL_BUTTON_LEFT = (#const SDL_BUTTON_LEFT)+pattern SDL_BUTTON_MIDDLE = (#const SDL_BUTTON_MIDDLE)+pattern SDL_BUTTON_RIGHT = (#const SDL_BUTTON_RIGHT)+pattern SDL_BUTTON_X1 = (#const SDL_BUTTON_X1)+pattern SDL_BUTTON_X2 = (#const SDL_BUTTON_X2)+pattern SDL_BUTTON_LMASK = (#const SDL_BUTTON_LMASK)+pattern SDL_BUTTON_MMASK = (#const SDL_BUTTON_MMASK)+pattern SDL_BUTTON_RMASK = (#const SDL_BUTTON_RMASK)+pattern SDL_BUTTON_X1MASK = (#const SDL_BUTTON_X1MASK)+pattern SDL_BUTTON_X2MASK = (#const SDL_BUTTON_X2MASK)++pattern SDL_MOUSEWHEEL_NORMAL = (#const SDL_MOUSEWHEEL_NORMAL)+pattern SDL_MOUSEWHEEL_FLIPPED = (#const SDL_MOUSEWHEEL_FLIPPED)++pattern SDL_FIRSTEVENT = (#const SDL_FIRSTEVENT)+pattern SDL_QUIT = (#const SDL_QUIT)+pattern SDL_APP_TERMINATING = (#const SDL_APP_TERMINATING)+pattern SDL_APP_LOWMEMORY = (#const SDL_APP_LOWMEMORY)+pattern SDL_APP_WILLENTERBACKGROUND = (#const SDL_APP_WILLENTERBACKGROUND)+pattern SDL_APP_DIDENTERBACKGROUND = (#const SDL_APP_DIDENTERBACKGROUND)+pattern SDL_APP_WILLENTERFOREGROUND = (#const SDL_APP_WILLENTERFOREGROUND)+pattern SDL_APP_DIDENTERFOREGROUND = (#const SDL_APP_DIDENTERFOREGROUND)+pattern SDL_WINDOWEVENT = (#const SDL_WINDOWEVENT)+pattern SDL_SYSWMEVENT = (#const SDL_SYSWMEVENT)+pattern SDL_KEYDOWN = (#const SDL_KEYDOWN)+pattern SDL_KEYUP = (#const SDL_KEYUP)+pattern SDL_TEXTEDITING = (#const SDL_TEXTEDITING)+pattern SDL_TEXTINPUT = (#const SDL_TEXTINPUT)+pattern SDL_KEYMAPCHANGED = (#const SDL_KEYMAPCHANGED)+pattern SDL_MOUSEMOTION = (#const SDL_MOUSEMOTION)+pattern SDL_MOUSEBUTTONDOWN = (#const SDL_MOUSEBUTTONDOWN)+pattern SDL_MOUSEBUTTONUP = (#const SDL_MOUSEBUTTONUP)+pattern SDL_MOUSEWHEEL = (#const SDL_MOUSEWHEEL)+pattern SDL_JOYAXISMOTION = (#const SDL_JOYAXISMOTION)+pattern SDL_JOYBALLMOTION = (#const SDL_JOYBALLMOTION)+pattern SDL_JOYHATMOTION = (#const SDL_JOYHATMOTION)+pattern SDL_JOYBUTTONDOWN = (#const SDL_JOYBUTTONDOWN)+pattern SDL_JOYBUTTONUP = (#const SDL_JOYBUTTONUP)+pattern SDL_JOYDEVICEADDED = (#const SDL_JOYDEVICEADDED)+pattern SDL_JOYDEVICEREMOVED = (#const SDL_JOYDEVICEREMOVED)+pattern SDL_CONTROLLERAXISMOTION = (#const SDL_CONTROLLERAXISMOTION)+pattern SDL_CONTROLLERBUTTONDOWN = (#const SDL_CONTROLLERBUTTONDOWN)+pattern SDL_CONTROLLERBUTTONUP = (#const SDL_CONTROLLERBUTTONUP)+pattern SDL_CONTROLLERDEVICEADDED = (#const SDL_CONTROLLERDEVICEADDED)+pattern SDL_CONTROLLERDEVICEREMOVED = (#const SDL_CONTROLLERDEVICEREMOVED)+pattern SDL_CONTROLLERDEVICEREMAPPED = (#const SDL_CONTROLLERDEVICEREMAPPED)+pattern SDL_FINGERDOWN = (#const SDL_FINGERDOWN)+pattern SDL_FINGERUP = (#const SDL_FINGERUP)+pattern SDL_FINGERMOTION = (#const SDL_FINGERMOTION)+pattern SDL_DOLLARGESTURE = (#const SDL_DOLLARGESTURE)+pattern SDL_DOLLARRECORD = (#const SDL_DOLLARRECORD)+pattern SDL_MULTIGESTURE = (#const SDL_MULTIGESTURE)+pattern SDL_CLIPBOARDUPDATE = (#const SDL_CLIPBOARDUPDATE)+pattern SDL_DROPFILE = (#const SDL_DROPFILE)+pattern SDL_AUDIODEVICEADDED = (#const SDL_AUDIODEVICEADDED)+pattern SDL_AUDIODEVICEREMOVED = (#const SDL_AUDIODEVICEREMOVED)+pattern SDL_RENDER_TARGETS_RESET = (#const SDL_RENDER_TARGETS_RESET)+pattern SDL_RENDER_DEVICE_RESET = (#const SDL_RENDER_DEVICE_RESET)+pattern SDL_USEREVENT = (#const SDL_USEREVENT)+pattern SDL_LASTEVENT = (#const SDL_LASTEVENT)++pattern SDL_HAT_CENTERED = (#const SDL_HAT_CENTERED)+pattern SDL_HAT_UP = (#const SDL_HAT_UP)+pattern SDL_HAT_RIGHT = (#const SDL_HAT_RIGHT)+pattern SDL_HAT_DOWN = (#const SDL_HAT_DOWN)+pattern SDL_HAT_LEFT = (#const SDL_HAT_LEFT)+pattern SDL_HAT_RIGHTUP = (#const SDL_HAT_RIGHTUP)+pattern SDL_HAT_RIGHTDOWN = (#const SDL_HAT_RIGHTDOWN)+pattern SDL_HAT_LEFTUP = (#const SDL_HAT_LEFTUP)+pattern SDL_HAT_LEFTDOWN = (#const SDL_HAT_LEFTDOWN)++pattern SDL_PRESSED = (#const SDL_PRESSED)+pattern SDL_RELEASED = (#const SDL_RELEASED)++pattern SDL_LOG_CATEGORY_APPLICATION = (#const SDL_LOG_CATEGORY_APPLICATION)+pattern SDL_LOG_CATEGORY_ERROR = (#const SDL_LOG_CATEGORY_ERROR)+pattern SDL_LOG_CATEGORY_ASSERT = (#const SDL_LOG_CATEGORY_ASSERT)+pattern SDL_LOG_CATEGORY_SYSTEM = (#const SDL_LOG_CATEGORY_SYSTEM)+pattern SDL_LOG_CATEGORY_AUDIO = (#const SDL_LOG_CATEGORY_AUDIO)+pattern SDL_LOG_CATEGORY_VIDEO = (#const SDL_LOG_CATEGORY_VIDEO)+pattern SDL_LOG_CATEGORY_RENDER = (#const SDL_LOG_CATEGORY_RENDER)+pattern SDL_LOG_CATEGORY_INPUT = (#const SDL_LOG_CATEGORY_INPUT)+pattern SDL_LOG_CATEGORY_TEST = (#const SDL_LOG_CATEGORY_TEST)+pattern SDL_LOG_CATEGORY_CUSTOM = (#const SDL_LOG_CATEGORY_CUSTOM)++pattern SDL_MESSAGEBOX_ERROR = (#const SDL_MESSAGEBOX_ERROR)+pattern SDL_MESSAGEBOX_WARNING = (#const SDL_MESSAGEBOX_WARNING)+pattern SDL_MESSAGEBOX_INFORMATION = (#const SDL_MESSAGEBOX_INFORMATION)++pattern SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = (#const SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT)+pattern SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = (#const SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT)++pattern SDL_GL_CONTEXT_PROFILE_CORE = (#const SDL_GL_CONTEXT_PROFILE_CORE)+pattern SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = (#const SDL_GL_CONTEXT_PROFILE_COMPATIBILITY)+pattern SDL_GL_CONTEXT_PROFILE_ES = (#const SDL_GL_CONTEXT_PROFILE_ES)++pattern SDL_GL_CONTEXT_DEBUG_FLAG = (#const SDL_GL_CONTEXT_DEBUG_FLAG)+pattern SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = (#const SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG)+pattern SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = (#const SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG)+pattern SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = (#const SDL_GL_CONTEXT_RESET_ISOLATION_FLAG)++pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = (#const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE)+pattern SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = (#const SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)++pattern SDL_PIXELFORMAT_UNKNOWN = (#const SDL_PIXELFORMAT_UNKNOWN)+pattern SDL_PIXELFORMAT_INDEX1LSB = (#const SDL_PIXELFORMAT_INDEX1LSB)+pattern SDL_PIXELFORMAT_INDEX1MSB = (#const SDL_PIXELFORMAT_INDEX1MSB)+pattern SDL_PIXELFORMAT_INDEX4LSB = (#const SDL_PIXELFORMAT_INDEX4LSB)+pattern SDL_PIXELFORMAT_INDEX4MSB = (#const SDL_PIXELFORMAT_INDEX4MSB)+pattern SDL_PIXELFORMAT_INDEX8 = (#const SDL_PIXELFORMAT_INDEX8)+pattern SDL_PIXELFORMAT_RGB332 = (#const SDL_PIXELFORMAT_RGB332)+pattern SDL_PIXELFORMAT_RGB444 = (#const SDL_PIXELFORMAT_RGB444)+pattern SDL_PIXELFORMAT_RGB555 = (#const SDL_PIXELFORMAT_RGB555)+pattern SDL_PIXELFORMAT_BGR555 = (#const SDL_PIXELFORMAT_BGR555)+pattern SDL_PIXELFORMAT_ARGB4444 = (#const SDL_PIXELFORMAT_ARGB4444)+pattern SDL_PIXELFORMAT_RGBA4444 = (#const SDL_PIXELFORMAT_RGBA4444)+pattern SDL_PIXELFORMAT_ABGR4444 = (#const SDL_PIXELFORMAT_ABGR4444)+pattern SDL_PIXELFORMAT_BGRA4444 = (#const SDL_PIXELFORMAT_BGRA4444)+pattern SDL_PIXELFORMAT_ARGB1555 = (#const SDL_PIXELFORMAT_ARGB1555)+pattern SDL_PIXELFORMAT_RGBA5551 = (#const SDL_PIXELFORMAT_RGBA5551)+pattern SDL_PIXELFORMAT_ABGR1555 = (#const SDL_PIXELFORMAT_ABGR1555)+pattern SDL_PIXELFORMAT_BGRA5551 = (#const SDL_PIXELFORMAT_BGRA5551)+pattern SDL_PIXELFORMAT_RGB565 = (#const SDL_PIXELFORMAT_RGB565)+pattern SDL_PIXELFORMAT_BGR565 = (#const SDL_PIXELFORMAT_BGR565)+pattern SDL_PIXELFORMAT_RGB24 = (#const SDL_PIXELFORMAT_RGB24)+pattern SDL_PIXELFORMAT_BGR24 = (#const SDL_PIXELFORMAT_BGR24)+pattern SDL_PIXELFORMAT_RGB888 = (#const SDL_PIXELFORMAT_RGB888)+pattern SDL_PIXELFORMAT_RGBX8888 = (#const SDL_PIXELFORMAT_RGBX8888)+pattern SDL_PIXELFORMAT_BGR888 = (#const SDL_PIXELFORMAT_BGR888)+pattern SDL_PIXELFORMAT_BGRX8888 = (#const SDL_PIXELFORMAT_BGRX8888)+pattern SDL_PIXELFORMAT_ARGB8888 = (#const SDL_PIXELFORMAT_ARGB8888)+pattern SDL_PIXELFORMAT_RGBA8888 = (#const SDL_PIXELFORMAT_RGBA8888)+pattern SDL_PIXELFORMAT_ABGR8888 = (#const SDL_PIXELFORMAT_ABGR8888)+pattern SDL_PIXELFORMAT_BGRA8888 = (#const SDL_PIXELFORMAT_BGRA8888)+pattern SDL_PIXELFORMAT_ARGB2101010 = (#const SDL_PIXELFORMAT_ARGB2101010)+pattern SDL_PIXELFORMAT_YV12 = (#const SDL_PIXELFORMAT_YV12)+pattern SDL_PIXELFORMAT_IYUV = (#const SDL_PIXELFORMAT_IYUV)+pattern SDL_PIXELFORMAT_YUY2 = (#const SDL_PIXELFORMAT_YUY2)+pattern SDL_PIXELFORMAT_UYVY = (#const SDL_PIXELFORMAT_UYVY)+pattern SDL_PIXELFORMAT_YVYU = (#const SDL_PIXELFORMAT_YVYU)++pattern SDL_RENDERER_SOFTWARE = (#const SDL_RENDERER_SOFTWARE)+pattern SDL_RENDERER_ACCELERATED = (#const SDL_RENDERER_ACCELERATED)+pattern SDL_RENDERER_PRESENTVSYNC = (#const SDL_RENDERER_PRESENTVSYNC)+pattern SDL_RENDERER_TARGETTEXTURE = (#const SDL_RENDERER_TARGETTEXTURE)++pattern SDL_TEXTUREACCESS_STATIC = (#const SDL_TEXTUREACCESS_STATIC)+pattern SDL_TEXTUREACCESS_STREAMING = (#const SDL_TEXTUREACCESS_STREAMING)+pattern SDL_TEXTUREACCESS_TARGET = (#const SDL_TEXTUREACCESS_TARGET)++pattern SDL_TEXTUREMODULATE_NONE = (#const SDL_TEXTUREMODULATE_NONE)+pattern SDL_TEXTUREMODULATE_COLOR = (#const SDL_TEXTUREMODULATE_COLOR)+pattern SDL_TEXTUREMODULATE_ALPHA = (#const SDL_TEXTUREMODULATE_ALPHA)++pattern SDL_TOUCH_MOUSEID = (#const SDL_TOUCH_MOUSEID)++pattern SDL_WINDOWEVENT_NONE = (#const SDL_WINDOWEVENT_NONE)+pattern SDL_WINDOWEVENT_SHOWN = (#const SDL_WINDOWEVENT_SHOWN)+pattern SDL_WINDOWEVENT_HIDDEN = (#const SDL_WINDOWEVENT_HIDDEN)+pattern SDL_WINDOWEVENT_EXPOSED = (#const SDL_WINDOWEVENT_EXPOSED)+pattern SDL_WINDOWEVENT_MOVED = (#const SDL_WINDOWEVENT_MOVED)+pattern SDL_WINDOWEVENT_RESIZED = (#const SDL_WINDOWEVENT_RESIZED)+pattern SDL_WINDOWEVENT_SIZE_CHANGED = (#const SDL_WINDOWEVENT_SIZE_CHANGED)+pattern SDL_WINDOWEVENT_MINIMIZED = (#const SDL_WINDOWEVENT_MINIMIZED)+pattern SDL_WINDOWEVENT_MAXIMIZED = (#const SDL_WINDOWEVENT_MAXIMIZED)+pattern SDL_WINDOWEVENT_RESTORED = (#const SDL_WINDOWEVENT_RESTORED)+pattern SDL_WINDOWEVENT_ENTER = (#const SDL_WINDOWEVENT_ENTER)+pattern SDL_WINDOWEVENT_LEAVE = (#const SDL_WINDOWEVENT_LEAVE)+pattern SDL_WINDOWEVENT_FOCUS_GAINED = (#const SDL_WINDOWEVENT_FOCUS_GAINED)+pattern SDL_WINDOWEVENT_FOCUS_LOST = (#const SDL_WINDOWEVENT_FOCUS_LOST)+pattern SDL_WINDOWEVENT_CLOSE = (#const SDL_WINDOWEVENT_CLOSE)++pattern SDL_WINDOW_FULLSCREEN = (#const SDL_WINDOW_FULLSCREEN)+pattern SDL_WINDOW_OPENGL = (#const SDL_WINDOW_OPENGL)+pattern SDL_WINDOW_SHOWN = (#const SDL_WINDOW_SHOWN)+pattern SDL_WINDOW_HIDDEN = (#const SDL_WINDOW_HIDDEN)+pattern SDL_WINDOW_BORDERLESS = (#const SDL_WINDOW_BORDERLESS)+pattern SDL_WINDOW_RESIZABLE = (#const SDL_WINDOW_RESIZABLE)+pattern SDL_WINDOW_MINIMIZED = (#const SDL_WINDOW_MINIMIZED)+pattern SDL_WINDOW_MAXIMIZED = (#const SDL_WINDOW_MAXIMIZED)+pattern SDL_WINDOW_INPUT_GRABBED = (#const SDL_WINDOW_INPUT_GRABBED)+pattern SDL_WINDOW_INPUT_FOCUS = (#const SDL_WINDOW_INPUT_FOCUS)+pattern SDL_WINDOW_MOUSE_FOCUS = (#const SDL_WINDOW_MOUSE_FOCUS)+pattern SDL_WINDOW_FULLSCREEN_DESKTOP = (#const SDL_WINDOW_FULLSCREEN_DESKTOP)+pattern SDL_WINDOW_FOREIGN = (#const SDL_WINDOW_FOREIGN)+pattern SDL_WINDOW_ALLOW_HIGHDPI = (#const SDL_WINDOW_ALLOW_HIGHDPI)+pattern SDL_WINDOW_MOUSE_CAPTURE = (#const SDL_WINDOW_MOUSE_CAPTURE)++pattern SDL_WINDOWPOS_UNDEFINED = (#const SDL_WINDOWPOS_UNDEFINED)+pattern SDL_WINDOWPOS_CENTERED = (#const SDL_WINDOWPOS_CENTERED)++pattern SDL_HAPTIC_CONSTANT = (#const SDL_HAPTIC_CONSTANT)
src/SDL/Raw/Error.hs view
@@ -1,44 +1,44 @@-{-# LANGUAGE DeriveDataTypeable #-}
-module SDL.Raw.Error (
-  -- * Error Handling
-  SDLError(..),
-  throwError,
-
-  -- * Manual Error Handling
-  clearError,
-  getError,
-  setError
-) where
-
-import Control.Exception
-import Control.Monad.Catch
-import Control.Monad.IO.Class
-import Data.Typeable
-import Foreign.C.String
-import Foreign.C.Types
-
--- | Note: the 'CString' is only valid until the next SDL function call. If you
--- need to preserve the error message, make a copy of it.
-newtype SDLError = SDLError CString
-  deriving (Eq, Show, Typeable)
-
-instance Exception SDLError
-
-foreign import ccall "SDL.h SDL_ClearError" clearErrorFFI :: IO ()
-foreign import ccall "SDL.h SDL_GetError" getErrorFFI :: IO CString
-foreign import ccall "sdlhelper.c SDLHelper_SetError" setErrorFFI :: CString -> IO CInt
-
-throwError :: (MonadThrow m, MonadIO m) => m ()
-throwError = getError >>= throwM . SDLError
-
-clearError :: MonadIO m => m ()
-clearError = liftIO clearErrorFFI
-{-# INLINE clearError #-}
-
-getError :: MonadIO m => m CString
-getError = liftIO getErrorFFI
-{-# INLINE getError #-}
-
-setError :: MonadIO m => CString -> m CInt
-setError v1 = liftIO $ setErrorFFI v1
-{-# INLINE setError #-}
+{-# LANGUAGE DeriveDataTypeable #-}+module SDL.Raw.Error (+  -- * Error Handling+  SDLError(..),+  throwError,++  -- * Manual Error Handling+  clearError,+  getError,+  setError+) where++import Control.Exception+import Control.Monad.Catch+import Control.Monad.IO.Class+import Data.Typeable+import Foreign.C.String+import Foreign.C.Types++-- | Note: the 'CString' is only valid until the next SDL function call. If you+-- need to preserve the error message, make a copy of it.+newtype SDLError = SDLError CString+  deriving (Eq, Show, Typeable)++instance Exception SDLError++foreign import ccall "SDL.h SDL_ClearError" clearErrorFFI :: IO ()+foreign import ccall "SDL.h SDL_GetError" getErrorFFI :: IO CString+foreign import ccall "sdlhelper.c SDLHelper_SetError" setErrorFFI :: CString -> IO CInt++throwError :: (MonadThrow m, MonadIO m) => m ()+throwError = getError >>= throwM . SDLError++clearError :: MonadIO m => m ()+clearError = liftIO clearErrorFFI+{-# INLINE clearError #-}++getError :: MonadIO m => m CString+getError = liftIO getErrorFFI+{-# INLINE getError #-}++setError :: MonadIO m => CString -> m CInt+setError v1 = liftIO $ setErrorFFI v1+{-# INLINE setError #-}
src/SDL/Raw/Event.hs view
@@ -1,675 +1,675 @@-module SDL.Raw.Event (
-  -- * Event Handling
-  addEventWatch,
-  delEventWatch,
-  eventState,
-  filterEvents,
-  flushEvent,
-  flushEvents,
-  getEventFilter,
-  getNumTouchDevices,
-  getNumTouchFingers,
-  getTouchDevice,
-  getTouchFinger,
-  hasEvent,
-  hasEvents,
-  loadDollarTemplates,
-  peepEvents,
-  pollEvent,
-  pumpEvents,
-  pushEvent,
-  quitRequested,
-  recordGesture,
-  registerEvents,
-  saveAllDollarTemplates,
-  saveDollarTemplate,
-  setEventFilter,
-  waitEvent,
-  waitEventTimeout,
-
-  -- * Keyboard Support
-  getKeyFromName,
-  getKeyFromScancode,
-  getKeyName,
-  getKeyboardFocus,
-  getKeyboardState,
-  getModState,
-  getScancodeFromKey,
-  getScancodeFromName,
-  getScancodeName,
-  hasScreenKeyboardSupport,
-  isScreenKeyboardShown,
-  isTextInputActive,
-  setModState,
-  setTextInputRect,
-  startTextInput,
-  stopTextInput,
-
-  -- * Mouse Support
-  captureMouse,
-  createColorCursor,
-  createCursor,
-  createSystemCursor,
-  freeCursor,
-  getCursor,
-  getDefaultCursor,
-  getGlobalMouseState,
-  getMouseFocus,
-  getMouseState,
-  getRelativeMouseMode,
-  getRelativeMouseState,
-  setCursor,
-  setRelativeMouseMode,
-  showCursor,
-  warpMouseGlobal,
-  warpMouseInWindow,
-
-  -- * Joystick Support
-  joystickClose,
-  joystickCurrentPowerLevel,
-  joystickEventState,
-  joystickFromInstanceID,
-  joystickGetAttached,
-  joystickGetAxis,
-  joystickGetBall,
-  joystickGetButton,
-  joystickGetDeviceGUID,
-  joystickGetGUID,
-  joystickGetGUIDFromString,
-  joystickGetGUIDString,
-  joystickGetHat,
-  joystickInstanceID,
-  joystickName,
-  joystickNameForIndex,
-  joystickNumAxes,
-  joystickNumBalls,
-  joystickNumButtons,
-  joystickNumHats,
-  joystickOpen,
-  joystickUpdate,
-  numJoysticks,
-
-  -- * Game Controller Support
-  gameControllerAddMapping,
-  gameControllerAddMappingsFromFile,
-  gameControllerAddMappingsFromRW,
-  gameControllerClose,
-  gameControllerEventState,
-  gameControllerFromInstanceID,
-  gameControllerGetAttached,
-  gameControllerGetAxis,
-  gameControllerGetAxisFromString,
-  gameControllerGetBindForAxis,
-  gameControllerGetBindForButton,
-  gameControllerGetButton,
-  gameControllerGetButtonFromString,
-  gameControllerGetJoystick,
-  gameControllerGetStringForAxis,
-  gameControllerGetStringForButton,
-  gameControllerMapping,
-  gameControllerMappingForGUID,
-  gameControllerName,
-  gameControllerNameForIndex,
-  gameControllerOpen,
-  gameControllerUpdate,
-  isGameController
-) where
-
-import Control.Monad.IO.Class
-import Data.Int
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Marshal.Alloc
-import Foreign.Ptr
-import Foreign.Storable
-import SDL.Raw.Enum
-import SDL.Raw.Filesystem
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_AddEventWatch" addEventWatchFFI :: EventFilter -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_DelEventWatch" delEventWatchFFI :: EventFilter -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_EventState" eventStateFFI :: Word32 -> CInt -> IO Word8
-foreign import ccall "SDL.h SDL_FilterEvents" filterEventsFFI :: EventFilter -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_FlushEvent" flushEventFFI :: Word32 -> IO ()
-foreign import ccall "SDL.h SDL_FlushEvents" flushEventsFFI :: Word32 -> Word32 -> IO ()
-foreign import ccall "SDL.h SDL_GetEventFilter" getEventFilterFFI :: Ptr EventFilter -> Ptr (Ptr ()) -> IO Bool
-foreign import ccall "SDL.h SDL_GetNumTouchDevices" getNumTouchDevicesFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GetNumTouchFingers" getNumTouchFingersFFI :: TouchID -> IO CInt
-foreign import ccall "SDL.h SDL_GetTouchDevice" getTouchDeviceFFI :: CInt -> IO TouchID
-foreign import ccall "SDL.h SDL_GetTouchFinger" getTouchFingerFFI :: TouchID -> CInt -> IO (Ptr Finger)
-foreign import ccall "SDL.h SDL_HasEvent" hasEventFFI :: Word32 -> IO Bool
-foreign import ccall "SDL.h SDL_HasEvents" hasEventsFFI :: Word32 -> Word32 -> IO Bool
-foreign import ccall "SDL.h SDL_LoadDollarTemplates" loadDollarTemplatesFFI :: TouchID -> Ptr RWops -> IO CInt
-foreign import ccall "SDL.h SDL_PeepEvents" peepEventsFFI :: Ptr Event -> CInt -> EventAction -> Word32 -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_PollEvent" pollEventFFI :: Ptr Event -> IO CInt
-foreign import ccall "SDL.h SDL_PumpEvents" pumpEventsFFI :: IO ()
-foreign import ccall "SDL.h SDL_PushEvent" pushEventFFI :: Ptr Event -> IO CInt
-foreign import ccall "SDL.h SDL_RecordGesture" recordGestureFFI :: TouchID -> IO CInt
-foreign import ccall "SDL.h SDL_RegisterEvents" registerEventsFFI :: CInt -> IO Word32
-foreign import ccall "SDL.h SDL_SaveAllDollarTemplates" saveAllDollarTemplatesFFI :: Ptr RWops -> IO CInt
-foreign import ccall "SDL.h SDL_SaveDollarTemplate" saveDollarTemplateFFI :: GestureID -> Ptr RWops -> IO CInt
-foreign import ccall "SDL.h SDL_SetEventFilter" setEventFilterFFI :: EventFilter -> Ptr () -> IO ()
-foreign import ccall "SDL.h SDL_WaitEvent" waitEventFFI :: Ptr Event -> IO CInt
-foreign import ccall "SDL.h SDL_WaitEventTimeout" waitEventTimeoutFFI :: Ptr Event -> CInt -> IO CInt
-
-foreign import ccall "SDL.h SDL_GetKeyFromName" getKeyFromNameFFI :: CString -> IO Keycode
-foreign import ccall "SDL.h SDL_GetKeyFromScancode" getKeyFromScancodeFFI :: Scancode -> IO Keycode
-foreign import ccall "SDL.h SDL_GetKeyName" getKeyNameFFI :: Keycode -> IO CString
-foreign import ccall "SDL.h SDL_GetKeyboardFocus" getKeyboardFocusFFI :: IO Window
-foreign import ccall "SDL.h SDL_GetKeyboardState" getKeyboardStateFFI :: Ptr CInt -> IO (Ptr Word8)
-foreign import ccall "SDL.h SDL_GetModState" getModStateFFI :: IO Keymod
-foreign import ccall "SDL.h SDL_GetScancodeFromKey" getScancodeFromKeyFFI :: Keycode -> IO Scancode
-foreign import ccall "SDL.h SDL_GetScancodeFromName" getScancodeFromNameFFI :: CString -> IO Scancode
-foreign import ccall "SDL.h SDL_GetScancodeName" getScancodeNameFFI :: Scancode -> IO CString
-foreign import ccall "SDL.h SDL_HasScreenKeyboardSupport" hasScreenKeyboardSupportFFI :: IO Bool
-foreign import ccall "SDL.h SDL_IsScreenKeyboardShown" isScreenKeyboardShownFFI :: Window -> IO Bool
-foreign import ccall "SDL.h SDL_IsTextInputActive" isTextInputActiveFFI :: IO Bool
-foreign import ccall "SDL.h SDL_SetModState" setModStateFFI :: Keymod -> IO ()
-foreign import ccall "SDL.h SDL_SetTextInputRect" setTextInputRectFFI :: Ptr Rect -> IO ()
-foreign import ccall "SDL.h SDL_StartTextInput" startTextInputFFI :: IO ()
-foreign import ccall "SDL.h SDL_StopTextInput" stopTextInputFFI :: IO ()
-
-foreign import ccall "SDL.h SDL_CaptureMouse" captureMouseFFI :: Bool -> IO CInt
-foreign import ccall "SDL.h SDL_CreateColorCursor" createColorCursorFFI :: Ptr Surface -> CInt -> CInt -> IO Cursor
-foreign import ccall "SDL.h SDL_CreateCursor" createCursorFFI :: Ptr Word8 -> Ptr Word8 -> CInt -> CInt -> CInt -> CInt -> IO Cursor
-foreign import ccall "SDL.h SDL_CreateSystemCursor" createSystemCursorFFI :: SystemCursor -> IO Cursor
-foreign import ccall "SDL.h SDL_FreeCursor" freeCursorFFI :: Cursor -> IO ()
-foreign import ccall "SDL.h SDL_GetCursor" getCursorFFI :: IO Cursor
-foreign import ccall "SDL.h SDL_GetDefaultCursor" getDefaultCursorFFI :: IO Cursor
-foreign import ccall "SDL.h SDL_GetGlobalMouseState" getGlobalMouseStateFFI :: Ptr CInt -> Ptr CInt -> IO Word32
-foreign import ccall "SDL.h SDL_GetMouseFocus" getMouseFocusFFI :: IO Window
-foreign import ccall "SDL.h SDL_GetMouseState" getMouseStateFFI :: Ptr CInt -> Ptr CInt -> IO Word32
-foreign import ccall "SDL.h SDL_GetRelativeMouseMode" getRelativeMouseModeFFI :: IO Bool
-foreign import ccall "SDL.h SDL_GetRelativeMouseState" getRelativeMouseStateFFI :: Ptr CInt -> Ptr CInt -> IO Word32
-foreign import ccall "SDL.h SDL_SetCursor" setCursorFFI :: Cursor -> IO ()
-foreign import ccall "SDL.h SDL_SetRelativeMouseMode" setRelativeMouseModeFFI :: Bool -> IO CInt
-foreign import ccall "SDL.h SDL_ShowCursor" showCursorFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_WarpMouseGlobal" warpMouseGlobalFFI :: CInt -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_WarpMouseInWindow" warpMouseInWindowFFI :: Window -> CInt -> CInt -> IO ()
-
-foreign import ccall "SDL.h SDL_JoystickClose" joystickCloseFFI :: Joystick -> IO ()
-foreign import ccall "SDL.h SDL_JoystickCurrentPowerLevel" joystickCurrentPowerLevelFFI :: Joystick -> IO JoystickPowerLevel
-foreign import ccall "SDL.h SDL_JoystickEventState" joystickEventStateFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickFromInstanceID" joystickFromInstanceIDFFI :: JoystickID -> IO Joystick
-foreign import ccall "SDL.h SDL_JoystickGetAttached" joystickGetAttachedFFI :: Joystick -> IO Bool
-foreign import ccall "SDL.h SDL_JoystickGetAxis" joystickGetAxisFFI :: Joystick -> CInt -> IO Int16
-foreign import ccall "SDL.h SDL_JoystickGetBall" joystickGetBallFFI :: Joystick -> CInt -> Ptr CInt -> Ptr CInt -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickGetButton" joystickGetButtonFFI :: Joystick -> CInt -> IO Word8
-foreign import ccall "sdlhelper.h SDLHelper_JoystickGetDeviceGUID" joystickGetDeviceGUIDFFI :: CInt -> Ptr JoystickGUID -> IO ()
-foreign import ccall "sdlhelper.h SDLHelper_JoystickGetGUID" joystickGetGUIDFFI :: Joystick -> Ptr JoystickGUID -> IO ()
-foreign import ccall "sdlhelper.h SDLHelper_JoystickGetGUIDFromString" joystickGetGUIDFromStringFFI :: CString -> Ptr JoystickGUID -> IO ()
-foreign import ccall "sdlhelper.h SDLHelper_JoystickGetGUIDString" joystickGetGUIDStringFFI :: Ptr JoystickGUID -> CString -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_JoystickGetHat" joystickGetHatFFI :: Joystick -> CInt -> IO Word8
-foreign import ccall "SDL.h SDL_JoystickInstanceID" joystickInstanceIDFFI :: Joystick -> IO JoystickID
-foreign import ccall "SDL.h SDL_JoystickName" joystickNameFFI :: Joystick -> IO CString
-foreign import ccall "SDL.h SDL_JoystickNameForIndex" joystickNameForIndexFFI :: CInt -> IO CString
-foreign import ccall "SDL.h SDL_JoystickNumAxes" joystickNumAxesFFI :: Joystick -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickNumBalls" joystickNumBallsFFI :: Joystick -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickNumButtons" joystickNumButtonsFFI :: Joystick -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickNumHats" joystickNumHatsFFI :: Joystick -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickOpen" joystickOpenFFI :: CInt -> IO Joystick
-foreign import ccall "SDL.h SDL_JoystickUpdate" joystickUpdateFFI :: IO ()
-foreign import ccall "SDL.h SDL_NumJoysticks" numJoysticksFFI :: IO CInt
-
-foreign import ccall "SDL.h SDL_GameControllerAddMapping" gameControllerAddMappingFFI :: CString -> IO CInt
-foreign import ccall "SDL.h SDL_GameControllerAddMappingsFromRW" gameControllerAddMappingsFromRWFFI :: Ptr RWops -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GameControllerClose" gameControllerCloseFFI :: GameController -> IO ()
-foreign import ccall "SDL.h SDL_GameControllerEventState" gameControllerEventStateFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GameControllerFromInstanceID" gameControllerFromInstanceIDFFI :: JoystickID -> IO GameController
-foreign import ccall "SDL.h SDL_GameControllerGetAttached" gameControllerGetAttachedFFI :: GameController -> IO Bool
-foreign import ccall "SDL.h SDL_GameControllerGetAxis" gameControllerGetAxisFFI :: GameController -> GameControllerAxis -> IO Int16
-foreign import ccall "SDL.h SDL_GameControllerGetAxisFromString" gameControllerGetAxisFromStringFFI :: CString -> IO GameControllerAxis
-foreign import ccall "sdlhelper.h SDLHelper_GameControllerGetBindForAxis" gameControllerGetBindForAxisFFI :: GameController -> GameControllerAxis -> Ptr GameControllerButtonBind -> IO ()
-foreign import ccall "sdlhelper.h SDLHelper_GameControllerGetBindForButton" gameControllerGetBindForButtonFFI :: GameController -> GameControllerButton -> Ptr GameControllerButtonBind -> IO ()
-foreign import ccall "SDL.h SDL_GameControllerGetButton" gameControllerGetButtonFFI :: GameController -> GameControllerButton -> IO Word8
-foreign import ccall "SDL.h SDL_GameControllerGetButtonFromString" gameControllerGetButtonFromStringFFI :: CString -> IO GameControllerButton
-foreign import ccall "SDL.h SDL_GameControllerGetJoystick" gameControllerGetJoystickFFI :: GameController -> IO Joystick
-foreign import ccall "SDL.h SDL_GameControllerGetStringForAxis" gameControllerGetStringForAxisFFI :: GameControllerAxis -> IO CString
-foreign import ccall "SDL.h SDL_GameControllerGetStringForButton" gameControllerGetStringForButtonFFI :: GameControllerButton -> IO CString
-foreign import ccall "SDL.h SDL_GameControllerMapping" gameControllerMappingFFI :: GameController -> IO CString
-foreign import ccall "sdlhelper.h SDLHelper_GameControllerMappingForGUID" gameControllerMappingForGUIDFFI :: Ptr JoystickGUID -> IO CString
-foreign import ccall "SDL.h SDL_GameControllerName" gameControllerNameFFI :: GameController -> IO CString
-foreign import ccall "SDL.h SDL_GameControllerNameForIndex" gameControllerNameForIndexFFI :: CInt -> IO CString
-foreign import ccall "SDL.h SDL_GameControllerOpen" gameControllerOpenFFI :: CInt -> IO GameController
-foreign import ccall "SDL.h SDL_GameControllerUpdate" gameControllerUpdateFFI :: IO ()
-foreign import ccall "SDL.h SDL_IsGameController" isGameControllerFFI :: CInt -> IO Bool
-
-addEventWatch :: MonadIO m => EventFilter -> Ptr () -> m ()
-addEventWatch v1 v2 = liftIO $ addEventWatchFFI v1 v2
-{-# INLINE addEventWatch #-}
-
-delEventWatch :: MonadIO m => EventFilter -> Ptr () -> m ()
-delEventWatch v1 v2 = liftIO $ delEventWatchFFI v1 v2
-{-# INLINE delEventWatch #-}
-
-eventState :: MonadIO m => Word32 -> CInt -> m Word8
-eventState v1 v2 = liftIO $ eventStateFFI v1 v2
-{-# INLINE eventState #-}
-
-filterEvents :: MonadIO m => EventFilter -> Ptr () -> m ()
-filterEvents v1 v2 = liftIO $ filterEventsFFI v1 v2
-{-# INLINE filterEvents #-}
-
-flushEvent :: MonadIO m => Word32 -> m ()
-flushEvent v1 = liftIO $ flushEventFFI v1
-{-# INLINE flushEvent #-}
-
-flushEvents :: MonadIO m => Word32 -> Word32 -> m ()
-flushEvents v1 v2 = liftIO $ flushEventsFFI v1 v2
-{-# INLINE flushEvents #-}
-
-getEventFilter :: MonadIO m => Ptr EventFilter -> Ptr (Ptr ()) -> m Bool
-getEventFilter v1 v2 = liftIO $ getEventFilterFFI v1 v2
-{-# INLINE getEventFilter #-}
-
-getNumTouchDevices :: MonadIO m => m CInt
-getNumTouchDevices = liftIO getNumTouchDevicesFFI
-{-# INLINE getNumTouchDevices #-}
-
-getNumTouchFingers :: MonadIO m => TouchID -> m CInt
-getNumTouchFingers v1 = liftIO $ getNumTouchFingersFFI v1
-{-# INLINE getNumTouchFingers #-}
-
-getTouchDevice :: MonadIO m => CInt -> m TouchID
-getTouchDevice v1 = liftIO $ getTouchDeviceFFI v1
-{-# INLINE getTouchDevice #-}
-
-getTouchFinger :: MonadIO m => TouchID -> CInt -> m (Ptr Finger)
-getTouchFinger v1 v2 = liftIO $ getTouchFingerFFI v1 v2
-{-# INLINE getTouchFinger #-}
-
-hasEvent :: MonadIO m => Word32 -> m Bool
-hasEvent v1 = liftIO $ hasEventFFI v1
-{-# INLINE hasEvent #-}
-
-hasEvents :: MonadIO m => Word32 -> Word32 -> m Bool
-hasEvents v1 v2 = liftIO $ hasEventsFFI v1 v2
-{-# INLINE hasEvents #-}
-
-loadDollarTemplates :: MonadIO m => TouchID -> Ptr RWops -> m CInt
-loadDollarTemplates v1 v2 = liftIO $ loadDollarTemplatesFFI v1 v2
-{-# INLINE loadDollarTemplates #-}
-
-peepEvents :: MonadIO m => Ptr Event -> CInt -> EventAction -> Word32 -> Word32 -> m CInt
-peepEvents v1 v2 v3 v4 v5 = liftIO $ peepEventsFFI v1 v2 v3 v4 v5
-{-# INLINE peepEvents #-}
-
-pollEvent :: MonadIO m => Ptr Event -> m CInt
-pollEvent v1 = liftIO $ pollEventFFI v1
-{-# INLINE pollEvent #-}
-
-pumpEvents :: MonadIO m => m ()
-pumpEvents = liftIO pumpEventsFFI
-{-# INLINE pumpEvents #-}
-
-pushEvent :: MonadIO m => Ptr Event -> m CInt
-pushEvent v1 = liftIO $ pushEventFFI v1
-{-# INLINE pushEvent #-}
-
-quitRequested :: MonadIO m => m Bool
-quitRequested = liftIO $ do
-  pumpEvents
-  ev <- peepEvents nullPtr 0 SDL_PEEKEVENT SDL_QUIT SDL_QUIT
-  return $ ev > 0
-{-# INLINE quitRequested #-}
-
-recordGesture :: MonadIO m => TouchID -> m CInt
-recordGesture v1 = liftIO $ recordGestureFFI v1
-{-# INLINE recordGesture #-}
-
-registerEvents :: MonadIO m => CInt -> m Word32
-registerEvents v1 = liftIO $ registerEventsFFI v1
-{-# INLINE registerEvents #-}
-
-saveAllDollarTemplates :: MonadIO m => Ptr RWops -> m CInt
-saveAllDollarTemplates v1 = liftIO $ saveAllDollarTemplatesFFI v1
-{-# INLINE saveAllDollarTemplates #-}
-
-saveDollarTemplate :: MonadIO m => GestureID -> Ptr RWops -> m CInt
-saveDollarTemplate v1 v2 = liftIO $ saveDollarTemplateFFI v1 v2
-{-# INLINE saveDollarTemplate #-}
-
-setEventFilter :: MonadIO m => EventFilter -> Ptr () -> m ()
-setEventFilter v1 v2 = liftIO $ setEventFilterFFI v1 v2
-{-# INLINE setEventFilter #-}
-
-waitEvent :: MonadIO m => Ptr Event -> m CInt
-waitEvent v1 = liftIO $ waitEventFFI v1
-{-# INLINE waitEvent #-}
-
-waitEventTimeout :: MonadIO m => Ptr Event -> CInt -> m CInt
-waitEventTimeout v1 v2 = liftIO $ waitEventTimeoutFFI v1 v2
-{-# INLINE waitEventTimeout #-}
-
-getKeyFromName :: MonadIO m => CString -> m Keycode
-getKeyFromName v1 = liftIO $ getKeyFromNameFFI v1
-{-# INLINE getKeyFromName #-}
-
-getKeyFromScancode :: MonadIO m => Scancode -> m Keycode
-getKeyFromScancode v1 = liftIO $ getKeyFromScancodeFFI v1
-{-# INLINE getKeyFromScancode #-}
-
-getKeyName :: MonadIO m => Keycode -> m CString
-getKeyName v1 = liftIO $ getKeyNameFFI v1
-{-# INLINE getKeyName #-}
-
-getKeyboardFocus :: MonadIO m => m Window
-getKeyboardFocus = liftIO getKeyboardFocusFFI
-{-# INLINE getKeyboardFocus #-}
-
-getKeyboardState :: MonadIO m => Ptr CInt -> m (Ptr Word8)
-getKeyboardState v1 = liftIO $ getKeyboardStateFFI v1
-{-# INLINE getKeyboardState #-}
-
-getModState :: MonadIO m => m Keymod
-getModState = liftIO getModStateFFI
-{-# INLINE getModState #-}
-
-getScancodeFromKey :: MonadIO m => Keycode -> m Scancode
-getScancodeFromKey v1 = liftIO $ getScancodeFromKeyFFI v1
-{-# INLINE getScancodeFromKey #-}
-
-getScancodeFromName :: MonadIO m => CString -> m Scancode
-getScancodeFromName v1 = liftIO $ getScancodeFromNameFFI v1
-{-# INLINE getScancodeFromName #-}
-
-getScancodeName :: MonadIO m => Scancode -> m CString
-getScancodeName v1 = liftIO $ getScancodeNameFFI v1
-{-# INLINE getScancodeName #-}
-
-hasScreenKeyboardSupport :: MonadIO m => m Bool
-hasScreenKeyboardSupport = liftIO hasScreenKeyboardSupportFFI
-{-# INLINE hasScreenKeyboardSupport #-}
-
-isScreenKeyboardShown :: MonadIO m => Window -> m Bool
-isScreenKeyboardShown v1 = liftIO $ isScreenKeyboardShownFFI v1
-{-# INLINE isScreenKeyboardShown #-}
-
-isTextInputActive :: MonadIO m => m Bool
-isTextInputActive = liftIO isTextInputActiveFFI
-{-# INLINE isTextInputActive #-}
-
-setModState :: MonadIO m => Keymod -> m ()
-setModState v1 = liftIO $ setModStateFFI v1
-{-# INLINE setModState #-}
-
-setTextInputRect :: MonadIO m => Ptr Rect -> m ()
-setTextInputRect v1 = liftIO $ setTextInputRectFFI v1
-{-# INLINE setTextInputRect #-}
-
-startTextInput :: MonadIO m => m ()
-startTextInput = liftIO startTextInputFFI
-{-# INLINE startTextInput #-}
-
-stopTextInput :: MonadIO m => m ()
-stopTextInput = liftIO stopTextInputFFI
-{-# INLINE stopTextInput #-}
-
-captureMouse :: MonadIO m => Bool -> m CInt
-captureMouse v1 = liftIO $ captureMouseFFI v1
-{-# INLINE captureMouse #-}
-
-createColorCursor :: MonadIO m => Ptr Surface -> CInt -> CInt -> m Cursor
-createColorCursor v1 v2 v3 = liftIO $ createColorCursorFFI v1 v2 v3
-{-# INLINE createColorCursor #-}
-
-createCursor :: MonadIO m => Ptr Word8 -> Ptr Word8 -> CInt -> CInt -> CInt -> CInt -> m Cursor
-createCursor v1 v2 v3 v4 v5 v6 = liftIO $ createCursorFFI v1 v2 v3 v4 v5 v6
-{-# INLINE createCursor #-}
-
-createSystemCursor :: MonadIO m => SystemCursor -> m Cursor
-createSystemCursor v1 = liftIO $ createSystemCursorFFI v1
-{-# INLINE createSystemCursor #-}
-
-freeCursor :: MonadIO m => Cursor -> m ()
-freeCursor v1 = liftIO $ freeCursorFFI v1
-{-# INLINE freeCursor #-}
-
-getCursor :: MonadIO m => m Cursor
-getCursor = liftIO getCursorFFI
-{-# INLINE getCursor #-}
-
-getDefaultCursor :: MonadIO m => m Cursor
-getDefaultCursor = liftIO getDefaultCursorFFI
-{-# INLINE getDefaultCursor #-}
-
-getGlobalMouseState :: MonadIO m => Ptr CInt -> Ptr CInt -> m Word32
-getGlobalMouseState v1 v2 = liftIO $ getGlobalMouseStateFFI v1 v2
-{-# INLINE getGlobalMouseState #-}
-
-getMouseFocus :: MonadIO m => m Window
-getMouseFocus = liftIO getMouseFocusFFI
-{-# INLINE getMouseFocus #-}
-
-getMouseState :: MonadIO m => Ptr CInt -> Ptr CInt -> m Word32
-getMouseState v1 v2 = liftIO $ getMouseStateFFI v1 v2
-{-# INLINE getMouseState #-}
-
-getRelativeMouseMode :: MonadIO m => m Bool
-getRelativeMouseMode = liftIO getRelativeMouseModeFFI
-{-# INLINE getRelativeMouseMode #-}
-
-getRelativeMouseState :: MonadIO m => Ptr CInt -> Ptr CInt -> m Word32
-getRelativeMouseState v1 v2 = liftIO $ getRelativeMouseStateFFI v1 v2
-{-# INLINE getRelativeMouseState #-}
-
-setCursor :: MonadIO m => Cursor -> m ()
-setCursor v1 = liftIO $ setCursorFFI v1
-{-# INLINE setCursor #-}
-
-setRelativeMouseMode :: MonadIO m => Bool -> m CInt
-setRelativeMouseMode v1 = liftIO $ setRelativeMouseModeFFI v1
-{-# INLINE setRelativeMouseMode #-}
-
-showCursor :: MonadIO m => CInt -> m CInt
-showCursor v1 = liftIO $ showCursorFFI v1
-{-# INLINE showCursor #-}
-
-warpMouseGlobal :: MonadIO m => CInt -> CInt -> m CInt
-warpMouseGlobal v1 v2 = liftIO $ warpMouseGlobalFFI v1 v2
-{-# INLINE warpMouseGlobal #-}
-
-warpMouseInWindow :: MonadIO m => Window -> CInt -> CInt -> m ()
-warpMouseInWindow v1 v2 v3 = liftIO $ warpMouseInWindowFFI v1 v2 v3
-{-# INLINE warpMouseInWindow #-}
-
-joystickClose :: MonadIO m => Joystick -> m ()
-joystickClose v1 = liftIO $ joystickCloseFFI v1
-{-# INLINE joystickClose #-}
-
-joystickCurrentPowerLevel :: MonadIO m => Joystick -> m JoystickPowerLevel
-joystickCurrentPowerLevel v1 = liftIO $ joystickCurrentPowerLevelFFI v1
-{-# INLINE joystickCurrentPowerLevel #-}
-
-joystickEventState :: MonadIO m => CInt -> m CInt
-joystickEventState v1 = liftIO $ joystickEventStateFFI v1
-{-# INLINE joystickEventState #-}
-
-joystickFromInstanceID :: MonadIO m => JoystickID -> m Joystick
-joystickFromInstanceID v1 = liftIO $ joystickFromInstanceIDFFI v1
-{-# INLINE joystickFromInstanceID #-}
-
-joystickGetAttached :: MonadIO m => Joystick -> m Bool
-joystickGetAttached v1 = liftIO $ joystickGetAttachedFFI v1
-{-# INLINE joystickGetAttached #-}
-
-joystickGetAxis :: MonadIO m => Joystick -> CInt -> m Int16
-joystickGetAxis v1 v2 = liftIO $ joystickGetAxisFFI v1 v2
-{-# INLINE joystickGetAxis #-}
-
-joystickGetBall :: MonadIO m => Joystick -> CInt -> Ptr CInt -> Ptr CInt -> m CInt
-joystickGetBall v1 v2 v3 v4 = liftIO $ joystickGetBallFFI v1 v2 v3 v4
-{-# INLINE joystickGetBall #-}
-
-joystickGetButton :: MonadIO m => Joystick -> CInt -> m Word8
-joystickGetButton v1 v2 = liftIO $ joystickGetButtonFFI v1 v2
-{-# INLINE joystickGetButton #-}
-
-joystickGetDeviceGUID :: MonadIO m => CInt -> m JoystickGUID
-joystickGetDeviceGUID device_index = liftIO . alloca $ \ptr -> do
-  joystickGetDeviceGUIDFFI device_index ptr
-  peek ptr
-{-# INLINE joystickGetDeviceGUID #-}
-
-joystickGetGUID :: MonadIO m => Joystick -> m JoystickGUID
-joystickGetGUID joystick = liftIO . alloca $ \ptr -> do
-  joystickGetGUIDFFI joystick ptr
-  peek ptr
-{-# INLINE joystickGetGUID #-}
-
-joystickGetGUIDFromString :: MonadIO m => CString -> m JoystickGUID
-joystickGetGUIDFromString pchGUID = liftIO . alloca $ \ptr -> do
-  joystickGetGUIDFromStringFFI pchGUID ptr
-  peek ptr
-{-# INLINE joystickGetGUIDFromString #-}
-
-joystickGetGUIDString :: MonadIO m => JoystickGUID -> CString -> CInt -> m ()
-joystickGetGUIDString guid pszGUID cbGUID = liftIO . alloca $ \ptr -> do
-  poke ptr guid
-  joystickGetGUIDStringFFI ptr pszGUID cbGUID
-{-# INLINE joystickGetGUIDString #-}
-
-joystickGetHat :: MonadIO m => Joystick -> CInt -> m Word8
-joystickGetHat v1 v2 = liftIO $ joystickGetHatFFI v1 v2
-{-# INLINE joystickGetHat #-}
-
-joystickInstanceID :: MonadIO m => Joystick -> m JoystickID
-joystickInstanceID v1 = liftIO $ joystickInstanceIDFFI v1
-{-# INLINE joystickInstanceID #-}
-
-joystickName :: MonadIO m => Joystick -> m CString
-joystickName v1 = liftIO $ joystickNameFFI v1
-{-# INLINE joystickName #-}
-
-joystickNameForIndex :: MonadIO m => CInt -> m CString
-joystickNameForIndex v1 = liftIO $ joystickNameForIndexFFI v1
-{-# INLINE joystickNameForIndex #-}
-
-joystickNumAxes :: MonadIO m => Joystick -> m CInt
-joystickNumAxes v1 = liftIO $ joystickNumAxesFFI v1
-{-# INLINE joystickNumAxes #-}
-
-joystickNumBalls :: MonadIO m => Joystick -> m CInt
-joystickNumBalls v1 = liftIO $ joystickNumBallsFFI v1
-{-# INLINE joystickNumBalls #-}
-
-joystickNumButtons :: MonadIO m => Joystick -> m CInt
-joystickNumButtons v1 = liftIO $ joystickNumButtonsFFI v1
-{-# INLINE joystickNumButtons #-}
-
-joystickNumHats :: MonadIO m => Joystick -> m CInt
-joystickNumHats v1 = liftIO $ joystickNumHatsFFI v1
-{-# INLINE joystickNumHats #-}
-
-joystickOpen :: MonadIO m => CInt -> m Joystick
-joystickOpen v1 = liftIO $ joystickOpenFFI v1
-{-# INLINE joystickOpen #-}
-
-joystickUpdate :: MonadIO m => m ()
-joystickUpdate = liftIO joystickUpdateFFI
-{-# INLINE joystickUpdate #-}
-
-numJoysticks :: MonadIO m => m CInt
-numJoysticks = liftIO numJoysticksFFI
-{-# INLINE numJoysticks #-}
-
-gameControllerAddMapping :: MonadIO m => CString -> m CInt
-gameControllerAddMapping v1 = liftIO $ gameControllerAddMappingFFI v1
-{-# INLINE gameControllerAddMapping #-}
-
-gameControllerAddMappingsFromFile :: MonadIO m => CString -> m CInt
-gameControllerAddMappingsFromFile file = liftIO $ do
-  rw <- withCString "rb" $ rwFromFile file
-  gameControllerAddMappingsFromRW rw 1
-{-# INLINE gameControllerAddMappingsFromFile #-}
-
-gameControllerAddMappingsFromRW :: MonadIO m => Ptr RWops -> CInt -> m CInt
-gameControllerAddMappingsFromRW v1 v2 = liftIO $ gameControllerAddMappingsFromRWFFI v1 v2
-{-# INLINE gameControllerAddMappingsFromRW #-}
-
-gameControllerClose :: MonadIO m => GameController -> m ()
-gameControllerClose v1 = liftIO $ gameControllerCloseFFI v1
-{-# INLINE gameControllerClose #-}
-
-gameControllerEventState :: MonadIO m => CInt -> m CInt
-gameControllerEventState v1 = liftIO $ gameControllerEventStateFFI v1
-{-# INLINE gameControllerEventState #-}
-
-gameControllerFromInstanceID :: MonadIO m => JoystickID -> m GameController
-gameControllerFromInstanceID v1 = liftIO $ gameControllerFromInstanceIDFFI v1
-{-# INLINE gameControllerFromInstanceID #-}
-
-gameControllerGetAttached :: MonadIO m => GameController -> m Bool
-gameControllerGetAttached v1 = liftIO $ gameControllerGetAttachedFFI v1
-{-# INLINE gameControllerGetAttached #-}
-
-gameControllerGetAxis :: MonadIO m => GameController -> GameControllerAxis -> m Int16
-gameControllerGetAxis v1 v2 = liftIO $ gameControllerGetAxisFFI v1 v2
-{-# INLINE gameControllerGetAxis #-}
-
-gameControllerGetAxisFromString :: MonadIO m => CString -> m GameControllerAxis
-gameControllerGetAxisFromString v1 = liftIO $ gameControllerGetAxisFromStringFFI v1
-{-# INLINE gameControllerGetAxisFromString #-}
-
-gameControllerGetBindForAxis :: MonadIO m => GameController -> GameControllerAxis -> m GameControllerButtonBind
-gameControllerGetBindForAxis gamecontroller axis = liftIO . alloca $ \ptr -> do
-  gameControllerGetBindForAxisFFI gamecontroller axis ptr
-  peek ptr
-{-# INLINE gameControllerGetBindForAxis #-}
-
-gameControllerGetBindForButton :: MonadIO m => GameController -> GameControllerButton -> m GameControllerButtonBind
-gameControllerGetBindForButton gamecontroller button = liftIO . alloca $ \ptr -> do
-  gameControllerGetBindForButtonFFI gamecontroller button ptr
-  peek ptr
-{-# INLINE gameControllerGetBindForButton #-}
-
-gameControllerGetButton :: MonadIO m => GameController -> GameControllerButton -> m Word8
-gameControllerGetButton v1 v2 = liftIO $ gameControllerGetButtonFFI v1 v2
-{-# INLINE gameControllerGetButton #-}
-
-gameControllerGetButtonFromString :: MonadIO m => CString -> m GameControllerButton
-gameControllerGetButtonFromString v1 = liftIO $ gameControllerGetButtonFromStringFFI v1
-{-# INLINE gameControllerGetButtonFromString #-}
-
-gameControllerGetJoystick :: MonadIO m => GameController -> m Joystick
-gameControllerGetJoystick v1 = liftIO $ gameControllerGetJoystickFFI v1
-{-# INLINE gameControllerGetJoystick #-}
-
-gameControllerGetStringForAxis :: MonadIO m => GameControllerAxis -> m CString
-gameControllerGetStringForAxis v1 = liftIO $ gameControllerGetStringForAxisFFI v1
-{-# INLINE gameControllerGetStringForAxis #-}
-
-gameControllerGetStringForButton :: MonadIO m => GameControllerButton -> m CString
-gameControllerGetStringForButton v1 = liftIO $ gameControllerGetStringForButtonFFI v1
-{-# INLINE gameControllerGetStringForButton #-}
-
-gameControllerMapping :: MonadIO m => GameController -> m CString
-gameControllerMapping v1 = liftIO $ gameControllerMappingFFI v1
-{-# INLINE gameControllerMapping #-}
-
-gameControllerMappingForGUID :: MonadIO m => JoystickGUID -> m CString
-gameControllerMappingForGUID guid = liftIO . alloca $ \ptr -> do
-  poke ptr guid
-  gameControllerMappingForGUIDFFI ptr
-{-# INLINE gameControllerMappingForGUID #-}
-
-gameControllerName :: MonadIO m => GameController -> m CString
-gameControllerName v1 = liftIO $ gameControllerNameFFI v1
-{-# INLINE gameControllerName #-}
-
-gameControllerNameForIndex :: MonadIO m => CInt -> m CString
-gameControllerNameForIndex v1 = liftIO $ gameControllerNameForIndexFFI v1
-{-# INLINE gameControllerNameForIndex #-}
-
-gameControllerOpen :: MonadIO m => CInt -> m GameController
-gameControllerOpen v1 = liftIO $ gameControllerOpenFFI v1
-{-# INLINE gameControllerOpen #-}
-
-gameControllerUpdate :: MonadIO m => m ()
-gameControllerUpdate = liftIO gameControllerUpdateFFI
-{-# INLINE gameControllerUpdate #-}
-
-isGameController :: MonadIO m => CInt -> m Bool
-isGameController v1 = liftIO $ isGameControllerFFI v1
-{-# INLINE isGameController #-}
+module SDL.Raw.Event (+  -- * Event Handling+  addEventWatch,+  delEventWatch,+  eventState,+  filterEvents,+  flushEvent,+  flushEvents,+  getEventFilter,+  getNumTouchDevices,+  getNumTouchFingers,+  getTouchDevice,+  getTouchFinger,+  hasEvent,+  hasEvents,+  loadDollarTemplates,+  peepEvents,+  pollEvent,+  pumpEvents,+  pushEvent,+  quitRequested,+  recordGesture,+  registerEvents,+  saveAllDollarTemplates,+  saveDollarTemplate,+  setEventFilter,+  waitEvent,+  waitEventTimeout,++  -- * Keyboard Support+  getKeyFromName,+  getKeyFromScancode,+  getKeyName,+  getKeyboardFocus,+  getKeyboardState,+  getModState,+  getScancodeFromKey,+  getScancodeFromName,+  getScancodeName,+  hasScreenKeyboardSupport,+  isScreenKeyboardShown,+  isTextInputActive,+  setModState,+  setTextInputRect,+  startTextInput,+  stopTextInput,++  -- * Mouse Support+  captureMouse,+  createColorCursor,+  createCursor,+  createSystemCursor,+  freeCursor,+  getCursor,+  getDefaultCursor,+  getGlobalMouseState,+  getMouseFocus,+  getMouseState,+  getRelativeMouseMode,+  getRelativeMouseState,+  setCursor,+  setRelativeMouseMode,+  showCursor,+  warpMouseGlobal,+  warpMouseInWindow,++  -- * Joystick Support+  joystickClose,+  joystickCurrentPowerLevel,+  joystickEventState,+  joystickFromInstanceID,+  joystickGetAttached,+  joystickGetAxis,+  joystickGetBall,+  joystickGetButton,+  joystickGetDeviceGUID,+  joystickGetGUID,+  joystickGetGUIDFromString,+  joystickGetGUIDString,+  joystickGetHat,+  joystickInstanceID,+  joystickName,+  joystickNameForIndex,+  joystickNumAxes,+  joystickNumBalls,+  joystickNumButtons,+  joystickNumHats,+  joystickOpen,+  joystickUpdate,+  numJoysticks,++  -- * Game Controller Support+  gameControllerAddMapping,+  gameControllerAddMappingsFromFile,+  gameControllerAddMappingsFromRW,+  gameControllerClose,+  gameControllerEventState,+  gameControllerFromInstanceID,+  gameControllerGetAttached,+  gameControllerGetAxis,+  gameControllerGetAxisFromString,+  gameControllerGetBindForAxis,+  gameControllerGetBindForButton,+  gameControllerGetButton,+  gameControllerGetButtonFromString,+  gameControllerGetJoystick,+  gameControllerGetStringForAxis,+  gameControllerGetStringForButton,+  gameControllerMapping,+  gameControllerMappingForGUID,+  gameControllerName,+  gameControllerNameForIndex,+  gameControllerOpen,+  gameControllerUpdate,+  isGameController+) where++import Control.Monad.IO.Class+import Data.Int+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.Marshal.Alloc+import Foreign.Ptr+import Foreign.Storable+import SDL.Raw.Enum+import SDL.Raw.Filesystem+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_AddEventWatch" addEventWatchFFI :: EventFilter -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_DelEventWatch" delEventWatchFFI :: EventFilter -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_EventState" eventStateFFI :: Word32 -> CInt -> IO Word8+foreign import ccall "SDL.h SDL_FilterEvents" filterEventsFFI :: EventFilter -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_FlushEvent" flushEventFFI :: Word32 -> IO ()+foreign import ccall "SDL.h SDL_FlushEvents" flushEventsFFI :: Word32 -> Word32 -> IO ()+foreign import ccall "SDL.h SDL_GetEventFilter" getEventFilterFFI :: Ptr EventFilter -> Ptr (Ptr ()) -> IO Bool+foreign import ccall "SDL.h SDL_GetNumTouchDevices" getNumTouchDevicesFFI :: IO CInt+foreign import ccall "SDL.h SDL_GetNumTouchFingers" getNumTouchFingersFFI :: TouchID -> IO CInt+foreign import ccall "SDL.h SDL_GetTouchDevice" getTouchDeviceFFI :: CInt -> IO TouchID+foreign import ccall "SDL.h SDL_GetTouchFinger" getTouchFingerFFI :: TouchID -> CInt -> IO (Ptr Finger)+foreign import ccall "SDL.h SDL_HasEvent" hasEventFFI :: Word32 -> IO Bool+foreign import ccall "SDL.h SDL_HasEvents" hasEventsFFI :: Word32 -> Word32 -> IO Bool+foreign import ccall "SDL.h SDL_LoadDollarTemplates" loadDollarTemplatesFFI :: TouchID -> Ptr RWops -> IO CInt+foreign import ccall "SDL.h SDL_PeepEvents" peepEventsFFI :: Ptr Event -> CInt -> EventAction -> Word32 -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_PollEvent" pollEventFFI :: Ptr Event -> IO CInt+foreign import ccall "SDL.h SDL_PumpEvents" pumpEventsFFI :: IO ()+foreign import ccall "SDL.h SDL_PushEvent" pushEventFFI :: Ptr Event -> IO CInt+foreign import ccall "SDL.h SDL_RecordGesture" recordGestureFFI :: TouchID -> IO CInt+foreign import ccall "SDL.h SDL_RegisterEvents" registerEventsFFI :: CInt -> IO Word32+foreign import ccall "SDL.h SDL_SaveAllDollarTemplates" saveAllDollarTemplatesFFI :: Ptr RWops -> IO CInt+foreign import ccall "SDL.h SDL_SaveDollarTemplate" saveDollarTemplateFFI :: GestureID -> Ptr RWops -> IO CInt+foreign import ccall "SDL.h SDL_SetEventFilter" setEventFilterFFI :: EventFilter -> Ptr () -> IO ()+foreign import ccall "SDL.h SDL_WaitEvent" waitEventFFI :: Ptr Event -> IO CInt+foreign import ccall "SDL.h SDL_WaitEventTimeout" waitEventTimeoutFFI :: Ptr Event -> CInt -> IO CInt++foreign import ccall "SDL.h SDL_GetKeyFromName" getKeyFromNameFFI :: CString -> IO Keycode+foreign import ccall "SDL.h SDL_GetKeyFromScancode" getKeyFromScancodeFFI :: Scancode -> IO Keycode+foreign import ccall "SDL.h SDL_GetKeyName" getKeyNameFFI :: Keycode -> IO CString+foreign import ccall "SDL.h SDL_GetKeyboardFocus" getKeyboardFocusFFI :: IO Window+foreign import ccall "SDL.h SDL_GetKeyboardState" getKeyboardStateFFI :: Ptr CInt -> IO (Ptr Word8)+foreign import ccall "SDL.h SDL_GetModState" getModStateFFI :: IO Keymod+foreign import ccall "SDL.h SDL_GetScancodeFromKey" getScancodeFromKeyFFI :: Keycode -> IO Scancode+foreign import ccall "SDL.h SDL_GetScancodeFromName" getScancodeFromNameFFI :: CString -> IO Scancode+foreign import ccall "SDL.h SDL_GetScancodeName" getScancodeNameFFI :: Scancode -> IO CString+foreign import ccall "SDL.h SDL_HasScreenKeyboardSupport" hasScreenKeyboardSupportFFI :: IO Bool+foreign import ccall "SDL.h SDL_IsScreenKeyboardShown" isScreenKeyboardShownFFI :: Window -> IO Bool+foreign import ccall "SDL.h SDL_IsTextInputActive" isTextInputActiveFFI :: IO Bool+foreign import ccall "SDL.h SDL_SetModState" setModStateFFI :: Keymod -> IO ()+foreign import ccall "SDL.h SDL_SetTextInputRect" setTextInputRectFFI :: Ptr Rect -> IO ()+foreign import ccall "SDL.h SDL_StartTextInput" startTextInputFFI :: IO ()+foreign import ccall "SDL.h SDL_StopTextInput" stopTextInputFFI :: IO ()++foreign import ccall "SDL.h SDL_CaptureMouse" captureMouseFFI :: Bool -> IO CInt+foreign import ccall "SDL.h SDL_CreateColorCursor" createColorCursorFFI :: Ptr Surface -> CInt -> CInt -> IO Cursor+foreign import ccall "SDL.h SDL_CreateCursor" createCursorFFI :: Ptr Word8 -> Ptr Word8 -> CInt -> CInt -> CInt -> CInt -> IO Cursor+foreign import ccall "SDL.h SDL_CreateSystemCursor" createSystemCursorFFI :: SystemCursor -> IO Cursor+foreign import ccall "SDL.h SDL_FreeCursor" freeCursorFFI :: Cursor -> IO ()+foreign import ccall "SDL.h SDL_GetCursor" getCursorFFI :: IO Cursor+foreign import ccall "SDL.h SDL_GetDefaultCursor" getDefaultCursorFFI :: IO Cursor+foreign import ccall "SDL.h SDL_GetGlobalMouseState" getGlobalMouseStateFFI :: Ptr CInt -> Ptr CInt -> IO Word32+foreign import ccall "SDL.h SDL_GetMouseFocus" getMouseFocusFFI :: IO Window+foreign import ccall "SDL.h SDL_GetMouseState" getMouseStateFFI :: Ptr CInt -> Ptr CInt -> IO Word32+foreign import ccall "SDL.h SDL_GetRelativeMouseMode" getRelativeMouseModeFFI :: IO Bool+foreign import ccall "SDL.h SDL_GetRelativeMouseState" getRelativeMouseStateFFI :: Ptr CInt -> Ptr CInt -> IO Word32+foreign import ccall "SDL.h SDL_SetCursor" setCursorFFI :: Cursor -> IO ()+foreign import ccall "SDL.h SDL_SetRelativeMouseMode" setRelativeMouseModeFFI :: Bool -> IO CInt+foreign import ccall "SDL.h SDL_ShowCursor" showCursorFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_WarpMouseGlobal" warpMouseGlobalFFI :: CInt -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_WarpMouseInWindow" warpMouseInWindowFFI :: Window -> CInt -> CInt -> IO ()++foreign import ccall "SDL.h SDL_JoystickClose" joystickCloseFFI :: Joystick -> IO ()+foreign import ccall "SDL.h SDL_JoystickCurrentPowerLevel" joystickCurrentPowerLevelFFI :: Joystick -> IO JoystickPowerLevel+foreign import ccall "SDL.h SDL_JoystickEventState" joystickEventStateFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_JoystickFromInstanceID" joystickFromInstanceIDFFI :: JoystickID -> IO Joystick+foreign import ccall "SDL.h SDL_JoystickGetAttached" joystickGetAttachedFFI :: Joystick -> IO Bool+foreign import ccall "SDL.h SDL_JoystickGetAxis" joystickGetAxisFFI :: Joystick -> CInt -> IO Int16+foreign import ccall "SDL.h SDL_JoystickGetBall" joystickGetBallFFI :: Joystick -> CInt -> Ptr CInt -> Ptr CInt -> IO CInt+foreign import ccall "SDL.h SDL_JoystickGetButton" joystickGetButtonFFI :: Joystick -> CInt -> IO Word8+foreign import ccall "sdlhelper.h SDLHelper_JoystickGetDeviceGUID" joystickGetDeviceGUIDFFI :: CInt -> Ptr JoystickGUID -> IO ()+foreign import ccall "sdlhelper.h SDLHelper_JoystickGetGUID" joystickGetGUIDFFI :: Joystick -> Ptr JoystickGUID -> IO ()+foreign import ccall "sdlhelper.h SDLHelper_JoystickGetGUIDFromString" joystickGetGUIDFromStringFFI :: CString -> Ptr JoystickGUID -> IO ()+foreign import ccall "sdlhelper.h SDLHelper_JoystickGetGUIDString" joystickGetGUIDStringFFI :: Ptr JoystickGUID -> CString -> CInt -> IO ()+foreign import ccall "SDL.h SDL_JoystickGetHat" joystickGetHatFFI :: Joystick -> CInt -> IO Word8+foreign import ccall "SDL.h SDL_JoystickInstanceID" joystickInstanceIDFFI :: Joystick -> IO JoystickID+foreign import ccall "SDL.h SDL_JoystickName" joystickNameFFI :: Joystick -> IO CString+foreign import ccall "SDL.h SDL_JoystickNameForIndex" joystickNameForIndexFFI :: CInt -> IO CString+foreign import ccall "SDL.h SDL_JoystickNumAxes" joystickNumAxesFFI :: Joystick -> IO CInt+foreign import ccall "SDL.h SDL_JoystickNumBalls" joystickNumBallsFFI :: Joystick -> IO CInt+foreign import ccall "SDL.h SDL_JoystickNumButtons" joystickNumButtonsFFI :: Joystick -> IO CInt+foreign import ccall "SDL.h SDL_JoystickNumHats" joystickNumHatsFFI :: Joystick -> IO CInt+foreign import ccall "SDL.h SDL_JoystickOpen" joystickOpenFFI :: CInt -> IO Joystick+foreign import ccall "SDL.h SDL_JoystickUpdate" joystickUpdateFFI :: IO ()+foreign import ccall "SDL.h SDL_NumJoysticks" numJoysticksFFI :: IO CInt++foreign import ccall "SDL.h SDL_GameControllerAddMapping" gameControllerAddMappingFFI :: CString -> IO CInt+foreign import ccall "SDL.h SDL_GameControllerAddMappingsFromRW" gameControllerAddMappingsFromRWFFI :: Ptr RWops -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_GameControllerClose" gameControllerCloseFFI :: GameController -> IO ()+foreign import ccall "SDL.h SDL_GameControllerEventState" gameControllerEventStateFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_GameControllerFromInstanceID" gameControllerFromInstanceIDFFI :: JoystickID -> IO GameController+foreign import ccall "SDL.h SDL_GameControllerGetAttached" gameControllerGetAttachedFFI :: GameController -> IO Bool+foreign import ccall "SDL.h SDL_GameControllerGetAxis" gameControllerGetAxisFFI :: GameController -> GameControllerAxis -> IO Int16+foreign import ccall "SDL.h SDL_GameControllerGetAxisFromString" gameControllerGetAxisFromStringFFI :: CString -> IO GameControllerAxis+foreign import ccall "sdlhelper.h SDLHelper_GameControllerGetBindForAxis" gameControllerGetBindForAxisFFI :: GameController -> GameControllerAxis -> Ptr GameControllerButtonBind -> IO ()+foreign import ccall "sdlhelper.h SDLHelper_GameControllerGetBindForButton" gameControllerGetBindForButtonFFI :: GameController -> GameControllerButton -> Ptr GameControllerButtonBind -> IO ()+foreign import ccall "SDL.h SDL_GameControllerGetButton" gameControllerGetButtonFFI :: GameController -> GameControllerButton -> IO Word8+foreign import ccall "SDL.h SDL_GameControllerGetButtonFromString" gameControllerGetButtonFromStringFFI :: CString -> IO GameControllerButton+foreign import ccall "SDL.h SDL_GameControllerGetJoystick" gameControllerGetJoystickFFI :: GameController -> IO Joystick+foreign import ccall "SDL.h SDL_GameControllerGetStringForAxis" gameControllerGetStringForAxisFFI :: GameControllerAxis -> IO CString+foreign import ccall "SDL.h SDL_GameControllerGetStringForButton" gameControllerGetStringForButtonFFI :: GameControllerButton -> IO CString+foreign import ccall "SDL.h SDL_GameControllerMapping" gameControllerMappingFFI :: GameController -> IO CString+foreign import ccall "sdlhelper.h SDLHelper_GameControllerMappingForGUID" gameControllerMappingForGUIDFFI :: Ptr JoystickGUID -> IO CString+foreign import ccall "SDL.h SDL_GameControllerName" gameControllerNameFFI :: GameController -> IO CString+foreign import ccall "SDL.h SDL_GameControllerNameForIndex" gameControllerNameForIndexFFI :: CInt -> IO CString+foreign import ccall "SDL.h SDL_GameControllerOpen" gameControllerOpenFFI :: CInt -> IO GameController+foreign import ccall "SDL.h SDL_GameControllerUpdate" gameControllerUpdateFFI :: IO ()+foreign import ccall "SDL.h SDL_IsGameController" isGameControllerFFI :: CInt -> IO Bool++addEventWatch :: MonadIO m => EventFilter -> Ptr () -> m ()+addEventWatch v1 v2 = liftIO $ addEventWatchFFI v1 v2+{-# INLINE addEventWatch #-}++delEventWatch :: MonadIO m => EventFilter -> Ptr () -> m ()+delEventWatch v1 v2 = liftIO $ delEventWatchFFI v1 v2+{-# INLINE delEventWatch #-}++eventState :: MonadIO m => Word32 -> CInt -> m Word8+eventState v1 v2 = liftIO $ eventStateFFI v1 v2+{-# INLINE eventState #-}++filterEvents :: MonadIO m => EventFilter -> Ptr () -> m ()+filterEvents v1 v2 = liftIO $ filterEventsFFI v1 v2+{-# INLINE filterEvents #-}++flushEvent :: MonadIO m => Word32 -> m ()+flushEvent v1 = liftIO $ flushEventFFI v1+{-# INLINE flushEvent #-}++flushEvents :: MonadIO m => Word32 -> Word32 -> m ()+flushEvents v1 v2 = liftIO $ flushEventsFFI v1 v2+{-# INLINE flushEvents #-}++getEventFilter :: MonadIO m => Ptr EventFilter -> Ptr (Ptr ()) -> m Bool+getEventFilter v1 v2 = liftIO $ getEventFilterFFI v1 v2+{-# INLINE getEventFilter #-}++getNumTouchDevices :: MonadIO m => m CInt+getNumTouchDevices = liftIO getNumTouchDevicesFFI+{-# INLINE getNumTouchDevices #-}++getNumTouchFingers :: MonadIO m => TouchID -> m CInt+getNumTouchFingers v1 = liftIO $ getNumTouchFingersFFI v1+{-# INLINE getNumTouchFingers #-}++getTouchDevice :: MonadIO m => CInt -> m TouchID+getTouchDevice v1 = liftIO $ getTouchDeviceFFI v1+{-# INLINE getTouchDevice #-}++getTouchFinger :: MonadIO m => TouchID -> CInt -> m (Ptr Finger)+getTouchFinger v1 v2 = liftIO $ getTouchFingerFFI v1 v2+{-# INLINE getTouchFinger #-}++hasEvent :: MonadIO m => Word32 -> m Bool+hasEvent v1 = liftIO $ hasEventFFI v1+{-# INLINE hasEvent #-}++hasEvents :: MonadIO m => Word32 -> Word32 -> m Bool+hasEvents v1 v2 = liftIO $ hasEventsFFI v1 v2+{-# INLINE hasEvents #-}++loadDollarTemplates :: MonadIO m => TouchID -> Ptr RWops -> m CInt+loadDollarTemplates v1 v2 = liftIO $ loadDollarTemplatesFFI v1 v2+{-# INLINE loadDollarTemplates #-}++peepEvents :: MonadIO m => Ptr Event -> CInt -> EventAction -> Word32 -> Word32 -> m CInt+peepEvents v1 v2 v3 v4 v5 = liftIO $ peepEventsFFI v1 v2 v3 v4 v5+{-# INLINE peepEvents #-}++pollEvent :: MonadIO m => Ptr Event -> m CInt+pollEvent v1 = liftIO $ pollEventFFI v1+{-# INLINE pollEvent #-}++pumpEvents :: MonadIO m => m ()+pumpEvents = liftIO pumpEventsFFI+{-# INLINE pumpEvents #-}++pushEvent :: MonadIO m => Ptr Event -> m CInt+pushEvent v1 = liftIO $ pushEventFFI v1+{-# INLINE pushEvent #-}++quitRequested :: MonadIO m => m Bool+quitRequested = liftIO $ do+  pumpEvents+  ev <- peepEvents nullPtr 0 SDL_PEEKEVENT SDL_QUIT SDL_QUIT+  return $ ev > 0+{-# INLINE quitRequested #-}++recordGesture :: MonadIO m => TouchID -> m CInt+recordGesture v1 = liftIO $ recordGestureFFI v1+{-# INLINE recordGesture #-}++registerEvents :: MonadIO m => CInt -> m Word32+registerEvents v1 = liftIO $ registerEventsFFI v1+{-# INLINE registerEvents #-}++saveAllDollarTemplates :: MonadIO m => Ptr RWops -> m CInt+saveAllDollarTemplates v1 = liftIO $ saveAllDollarTemplatesFFI v1+{-# INLINE saveAllDollarTemplates #-}++saveDollarTemplate :: MonadIO m => GestureID -> Ptr RWops -> m CInt+saveDollarTemplate v1 v2 = liftIO $ saveDollarTemplateFFI v1 v2+{-# INLINE saveDollarTemplate #-}++setEventFilter :: MonadIO m => EventFilter -> Ptr () -> m ()+setEventFilter v1 v2 = liftIO $ setEventFilterFFI v1 v2+{-# INLINE setEventFilter #-}++waitEvent :: MonadIO m => Ptr Event -> m CInt+waitEvent v1 = liftIO $ waitEventFFI v1+{-# INLINE waitEvent #-}++waitEventTimeout :: MonadIO m => Ptr Event -> CInt -> m CInt+waitEventTimeout v1 v2 = liftIO $ waitEventTimeoutFFI v1 v2+{-# INLINE waitEventTimeout #-}++getKeyFromName :: MonadIO m => CString -> m Keycode+getKeyFromName v1 = liftIO $ getKeyFromNameFFI v1+{-# INLINE getKeyFromName #-}++getKeyFromScancode :: MonadIO m => Scancode -> m Keycode+getKeyFromScancode v1 = liftIO $ getKeyFromScancodeFFI v1+{-# INLINE getKeyFromScancode #-}++getKeyName :: MonadIO m => Keycode -> m CString+getKeyName v1 = liftIO $ getKeyNameFFI v1+{-# INLINE getKeyName #-}++getKeyboardFocus :: MonadIO m => m Window+getKeyboardFocus = liftIO getKeyboardFocusFFI+{-# INLINE getKeyboardFocus #-}++getKeyboardState :: MonadIO m => Ptr CInt -> m (Ptr Word8)+getKeyboardState v1 = liftIO $ getKeyboardStateFFI v1+{-# INLINE getKeyboardState #-}++getModState :: MonadIO m => m Keymod+getModState = liftIO getModStateFFI+{-# INLINE getModState #-}++getScancodeFromKey :: MonadIO m => Keycode -> m Scancode+getScancodeFromKey v1 = liftIO $ getScancodeFromKeyFFI v1+{-# INLINE getScancodeFromKey #-}++getScancodeFromName :: MonadIO m => CString -> m Scancode+getScancodeFromName v1 = liftIO $ getScancodeFromNameFFI v1+{-# INLINE getScancodeFromName #-}++getScancodeName :: MonadIO m => Scancode -> m CString+getScancodeName v1 = liftIO $ getScancodeNameFFI v1+{-# INLINE getScancodeName #-}++hasScreenKeyboardSupport :: MonadIO m => m Bool+hasScreenKeyboardSupport = liftIO hasScreenKeyboardSupportFFI+{-# INLINE hasScreenKeyboardSupport #-}++isScreenKeyboardShown :: MonadIO m => Window -> m Bool+isScreenKeyboardShown v1 = liftIO $ isScreenKeyboardShownFFI v1+{-# INLINE isScreenKeyboardShown #-}++isTextInputActive :: MonadIO m => m Bool+isTextInputActive = liftIO isTextInputActiveFFI+{-# INLINE isTextInputActive #-}++setModState :: MonadIO m => Keymod -> m ()+setModState v1 = liftIO $ setModStateFFI v1+{-# INLINE setModState #-}++setTextInputRect :: MonadIO m => Ptr Rect -> m ()+setTextInputRect v1 = liftIO $ setTextInputRectFFI v1+{-# INLINE setTextInputRect #-}++startTextInput :: MonadIO m => m ()+startTextInput = liftIO startTextInputFFI+{-# INLINE startTextInput #-}++stopTextInput :: MonadIO m => m ()+stopTextInput = liftIO stopTextInputFFI+{-# INLINE stopTextInput #-}++captureMouse :: MonadIO m => Bool -> m CInt+captureMouse v1 = liftIO $ captureMouseFFI v1+{-# INLINE captureMouse #-}++createColorCursor :: MonadIO m => Ptr Surface -> CInt -> CInt -> m Cursor+createColorCursor v1 v2 v3 = liftIO $ createColorCursorFFI v1 v2 v3+{-# INLINE createColorCursor #-}++createCursor :: MonadIO m => Ptr Word8 -> Ptr Word8 -> CInt -> CInt -> CInt -> CInt -> m Cursor+createCursor v1 v2 v3 v4 v5 v6 = liftIO $ createCursorFFI v1 v2 v3 v4 v5 v6+{-# INLINE createCursor #-}++createSystemCursor :: MonadIO m => SystemCursor -> m Cursor+createSystemCursor v1 = liftIO $ createSystemCursorFFI v1+{-# INLINE createSystemCursor #-}++freeCursor :: MonadIO m => Cursor -> m ()+freeCursor v1 = liftIO $ freeCursorFFI v1+{-# INLINE freeCursor #-}++getCursor :: MonadIO m => m Cursor+getCursor = liftIO getCursorFFI+{-# INLINE getCursor #-}++getDefaultCursor :: MonadIO m => m Cursor+getDefaultCursor = liftIO getDefaultCursorFFI+{-# INLINE getDefaultCursor #-}++getGlobalMouseState :: MonadIO m => Ptr CInt -> Ptr CInt -> m Word32+getGlobalMouseState v1 v2 = liftIO $ getGlobalMouseStateFFI v1 v2+{-# INLINE getGlobalMouseState #-}++getMouseFocus :: MonadIO m => m Window+getMouseFocus = liftIO getMouseFocusFFI+{-# INLINE getMouseFocus #-}++getMouseState :: MonadIO m => Ptr CInt -> Ptr CInt -> m Word32+getMouseState v1 v2 = liftIO $ getMouseStateFFI v1 v2+{-# INLINE getMouseState #-}++getRelativeMouseMode :: MonadIO m => m Bool+getRelativeMouseMode = liftIO getRelativeMouseModeFFI+{-# INLINE getRelativeMouseMode #-}++getRelativeMouseState :: MonadIO m => Ptr CInt -> Ptr CInt -> m Word32+getRelativeMouseState v1 v2 = liftIO $ getRelativeMouseStateFFI v1 v2+{-# INLINE getRelativeMouseState #-}++setCursor :: MonadIO m => Cursor -> m ()+setCursor v1 = liftIO $ setCursorFFI v1+{-# INLINE setCursor #-}++setRelativeMouseMode :: MonadIO m => Bool -> m CInt+setRelativeMouseMode v1 = liftIO $ setRelativeMouseModeFFI v1+{-# INLINE setRelativeMouseMode #-}++showCursor :: MonadIO m => CInt -> m CInt+showCursor v1 = liftIO $ showCursorFFI v1+{-# INLINE showCursor #-}++warpMouseGlobal :: MonadIO m => CInt -> CInt -> m CInt+warpMouseGlobal v1 v2 = liftIO $ warpMouseGlobalFFI v1 v2+{-# INLINE warpMouseGlobal #-}++warpMouseInWindow :: MonadIO m => Window -> CInt -> CInt -> m ()+warpMouseInWindow v1 v2 v3 = liftIO $ warpMouseInWindowFFI v1 v2 v3+{-# INLINE warpMouseInWindow #-}++joystickClose :: MonadIO m => Joystick -> m ()+joystickClose v1 = liftIO $ joystickCloseFFI v1+{-# INLINE joystickClose #-}++joystickCurrentPowerLevel :: MonadIO m => Joystick -> m JoystickPowerLevel+joystickCurrentPowerLevel v1 = liftIO $ joystickCurrentPowerLevelFFI v1+{-# INLINE joystickCurrentPowerLevel #-}++joystickEventState :: MonadIO m => CInt -> m CInt+joystickEventState v1 = liftIO $ joystickEventStateFFI v1+{-# INLINE joystickEventState #-}++joystickFromInstanceID :: MonadIO m => JoystickID -> m Joystick+joystickFromInstanceID v1 = liftIO $ joystickFromInstanceIDFFI v1+{-# INLINE joystickFromInstanceID #-}++joystickGetAttached :: MonadIO m => Joystick -> m Bool+joystickGetAttached v1 = liftIO $ joystickGetAttachedFFI v1+{-# INLINE joystickGetAttached #-}++joystickGetAxis :: MonadIO m => Joystick -> CInt -> m Int16+joystickGetAxis v1 v2 = liftIO $ joystickGetAxisFFI v1 v2+{-# INLINE joystickGetAxis #-}++joystickGetBall :: MonadIO m => Joystick -> CInt -> Ptr CInt -> Ptr CInt -> m CInt+joystickGetBall v1 v2 v3 v4 = liftIO $ joystickGetBallFFI v1 v2 v3 v4+{-# INLINE joystickGetBall #-}++joystickGetButton :: MonadIO m => Joystick -> CInt -> m Word8+joystickGetButton v1 v2 = liftIO $ joystickGetButtonFFI v1 v2+{-# INLINE joystickGetButton #-}++joystickGetDeviceGUID :: MonadIO m => CInt -> m JoystickGUID+joystickGetDeviceGUID device_index = liftIO . alloca $ \ptr -> do+  joystickGetDeviceGUIDFFI device_index ptr+  peek ptr+{-# INLINE joystickGetDeviceGUID #-}++joystickGetGUID :: MonadIO m => Joystick -> m JoystickGUID+joystickGetGUID joystick = liftIO . alloca $ \ptr -> do+  joystickGetGUIDFFI joystick ptr+  peek ptr+{-# INLINE joystickGetGUID #-}++joystickGetGUIDFromString :: MonadIO m => CString -> m JoystickGUID+joystickGetGUIDFromString pchGUID = liftIO . alloca $ \ptr -> do+  joystickGetGUIDFromStringFFI pchGUID ptr+  peek ptr+{-# INLINE joystickGetGUIDFromString #-}++joystickGetGUIDString :: MonadIO m => JoystickGUID -> CString -> CInt -> m ()+joystickGetGUIDString guid pszGUID cbGUID = liftIO . alloca $ \ptr -> do+  poke ptr guid+  joystickGetGUIDStringFFI ptr pszGUID cbGUID+{-# INLINE joystickGetGUIDString #-}++joystickGetHat :: MonadIO m => Joystick -> CInt -> m Word8+joystickGetHat v1 v2 = liftIO $ joystickGetHatFFI v1 v2+{-# INLINE joystickGetHat #-}++joystickInstanceID :: MonadIO m => Joystick -> m JoystickID+joystickInstanceID v1 = liftIO $ joystickInstanceIDFFI v1+{-# INLINE joystickInstanceID #-}++joystickName :: MonadIO m => Joystick -> m CString+joystickName v1 = liftIO $ joystickNameFFI v1+{-# INLINE joystickName #-}++joystickNameForIndex :: MonadIO m => CInt -> m CString+joystickNameForIndex v1 = liftIO $ joystickNameForIndexFFI v1+{-# INLINE joystickNameForIndex #-}++joystickNumAxes :: MonadIO m => Joystick -> m CInt+joystickNumAxes v1 = liftIO $ joystickNumAxesFFI v1+{-# INLINE joystickNumAxes #-}++joystickNumBalls :: MonadIO m => Joystick -> m CInt+joystickNumBalls v1 = liftIO $ joystickNumBallsFFI v1+{-# INLINE joystickNumBalls #-}++joystickNumButtons :: MonadIO m => Joystick -> m CInt+joystickNumButtons v1 = liftIO $ joystickNumButtonsFFI v1+{-# INLINE joystickNumButtons #-}++joystickNumHats :: MonadIO m => Joystick -> m CInt+joystickNumHats v1 = liftIO $ joystickNumHatsFFI v1+{-# INLINE joystickNumHats #-}++joystickOpen :: MonadIO m => CInt -> m Joystick+joystickOpen v1 = liftIO $ joystickOpenFFI v1+{-# INLINE joystickOpen #-}++joystickUpdate :: MonadIO m => m ()+joystickUpdate = liftIO joystickUpdateFFI+{-# INLINE joystickUpdate #-}++numJoysticks :: MonadIO m => m CInt+numJoysticks = liftIO numJoysticksFFI+{-# INLINE numJoysticks #-}++gameControllerAddMapping :: MonadIO m => CString -> m CInt+gameControllerAddMapping v1 = liftIO $ gameControllerAddMappingFFI v1+{-# INLINE gameControllerAddMapping #-}++gameControllerAddMappingsFromFile :: MonadIO m => CString -> m CInt+gameControllerAddMappingsFromFile file = liftIO $ do+  rw <- withCString "rb" $ rwFromFile file+  gameControllerAddMappingsFromRW rw 1+{-# INLINE gameControllerAddMappingsFromFile #-}++gameControllerAddMappingsFromRW :: MonadIO m => Ptr RWops -> CInt -> m CInt+gameControllerAddMappingsFromRW v1 v2 = liftIO $ gameControllerAddMappingsFromRWFFI v1 v2+{-# INLINE gameControllerAddMappingsFromRW #-}++gameControllerClose :: MonadIO m => GameController -> m ()+gameControllerClose v1 = liftIO $ gameControllerCloseFFI v1+{-# INLINE gameControllerClose #-}++gameControllerEventState :: MonadIO m => CInt -> m CInt+gameControllerEventState v1 = liftIO $ gameControllerEventStateFFI v1+{-# INLINE gameControllerEventState #-}++gameControllerFromInstanceID :: MonadIO m => JoystickID -> m GameController+gameControllerFromInstanceID v1 = liftIO $ gameControllerFromInstanceIDFFI v1+{-# INLINE gameControllerFromInstanceID #-}++gameControllerGetAttached :: MonadIO m => GameController -> m Bool+gameControllerGetAttached v1 = liftIO $ gameControllerGetAttachedFFI v1+{-# INLINE gameControllerGetAttached #-}++gameControllerGetAxis :: MonadIO m => GameController -> GameControllerAxis -> m Int16+gameControllerGetAxis v1 v2 = liftIO $ gameControllerGetAxisFFI v1 v2+{-# INLINE gameControllerGetAxis #-}++gameControllerGetAxisFromString :: MonadIO m => CString -> m GameControllerAxis+gameControllerGetAxisFromString v1 = liftIO $ gameControllerGetAxisFromStringFFI v1+{-# INLINE gameControllerGetAxisFromString #-}++gameControllerGetBindForAxis :: MonadIO m => GameController -> GameControllerAxis -> m GameControllerButtonBind+gameControllerGetBindForAxis gamecontroller axis = liftIO . alloca $ \ptr -> do+  gameControllerGetBindForAxisFFI gamecontroller axis ptr+  peek ptr+{-# INLINE gameControllerGetBindForAxis #-}++gameControllerGetBindForButton :: MonadIO m => GameController -> GameControllerButton -> m GameControllerButtonBind+gameControllerGetBindForButton gamecontroller button = liftIO . alloca $ \ptr -> do+  gameControllerGetBindForButtonFFI gamecontroller button ptr+  peek ptr+{-# INLINE gameControllerGetBindForButton #-}++gameControllerGetButton :: MonadIO m => GameController -> GameControllerButton -> m Word8+gameControllerGetButton v1 v2 = liftIO $ gameControllerGetButtonFFI v1 v2+{-# INLINE gameControllerGetButton #-}++gameControllerGetButtonFromString :: MonadIO m => CString -> m GameControllerButton+gameControllerGetButtonFromString v1 = liftIO $ gameControllerGetButtonFromStringFFI v1+{-# INLINE gameControllerGetButtonFromString #-}++gameControllerGetJoystick :: MonadIO m => GameController -> m Joystick+gameControllerGetJoystick v1 = liftIO $ gameControllerGetJoystickFFI v1+{-# INLINE gameControllerGetJoystick #-}++gameControllerGetStringForAxis :: MonadIO m => GameControllerAxis -> m CString+gameControllerGetStringForAxis v1 = liftIO $ gameControllerGetStringForAxisFFI v1+{-# INLINE gameControllerGetStringForAxis #-}++gameControllerGetStringForButton :: MonadIO m => GameControllerButton -> m CString+gameControllerGetStringForButton v1 = liftIO $ gameControllerGetStringForButtonFFI v1+{-# INLINE gameControllerGetStringForButton #-}++gameControllerMapping :: MonadIO m => GameController -> m CString+gameControllerMapping v1 = liftIO $ gameControllerMappingFFI v1+{-# INLINE gameControllerMapping #-}++gameControllerMappingForGUID :: MonadIO m => JoystickGUID -> m CString+gameControllerMappingForGUID guid = liftIO . alloca $ \ptr -> do+  poke ptr guid+  gameControllerMappingForGUIDFFI ptr+{-# INLINE gameControllerMappingForGUID #-}++gameControllerName :: MonadIO m => GameController -> m CString+gameControllerName v1 = liftIO $ gameControllerNameFFI v1+{-# INLINE gameControllerName #-}++gameControllerNameForIndex :: MonadIO m => CInt -> m CString+gameControllerNameForIndex v1 = liftIO $ gameControllerNameForIndexFFI v1+{-# INLINE gameControllerNameForIndex #-}++gameControllerOpen :: MonadIO m => CInt -> m GameController+gameControllerOpen v1 = liftIO $ gameControllerOpenFFI v1+{-# INLINE gameControllerOpen #-}++gameControllerUpdate :: MonadIO m => m ()+gameControllerUpdate = liftIO gameControllerUpdateFFI+{-# INLINE gameControllerUpdate #-}++isGameController :: MonadIO m => CInt -> m Bool+isGameController v1 = liftIO $ isGameControllerFFI v1+{-# INLINE isGameController #-}
src/SDL/Raw/Filesystem.hs view
@@ -1,165 +1,165 @@-module SDL.Raw.Filesystem (
-  -- * Filesystem Paths
-  getBasePath,
-  getPrefPath,
-
-  -- * File I/O Abstraction
-  allocRW,
-  freeRW,
-  rwFromConstMem,
-  rwFromFP,
-  rwFromFile,
-  rwFromMem,
-  rwClose,
-  rwRead,
-  rwSeek,
-  rwTell,
-  rwWrite,
-  readBE16,
-  readBE32,
-  readBE64,
-  readLE16,
-  readLE32,
-  readLE64,
-  writeBE16,
-  writeBE32,
-  writeBE64,
-  writeLE16,
-  writeLE32,
-  writeLE64
-) where
-
-import Control.Monad.IO.Class
-import Data.Int
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_GetBasePath" getBasePathFFI :: IO CString
-foreign import ccall "SDL.h SDL_GetPrefPath" getPrefPathFFI :: CString -> CString -> IO CString
-
-foreign import ccall "SDL.h SDL_AllocRW" allocRWFFI :: IO (Ptr RWops)
-foreign import ccall "SDL.h SDL_FreeRW" freeRWFFI :: Ptr RWops -> IO ()
-foreign import ccall "SDL.h SDL_RWFromConstMem" rwFromConstMemFFI :: Ptr () -> CInt -> IO (Ptr RWops)
-foreign import ccall "SDL.h SDL_RWFromFP" rwFromFPFFI :: Ptr () -> Bool -> IO (Ptr RWops)
-foreign import ccall "SDL.h SDL_RWFromFile" rwFromFileFFI :: CString -> CString -> IO (Ptr RWops)
-foreign import ccall "SDL.h SDL_RWFromMem" rwFromMemFFI :: Ptr () -> CInt -> IO (Ptr RWops)
-foreign import ccall "sdlhelper.h SDLHelper_RWclose" rwCloseFFI :: Ptr RWops -> IO CInt
-foreign import ccall "sdlhelper.h SDLHelper_RWread" rwReadFFI :: Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize
-foreign import ccall "sdlhelper.h SDLHelper_RWseek" rwSeekFFI :: Ptr RWops -> Int64 -> CInt -> IO Int64
-foreign import ccall "sdlhelper.h SDLHelper_RWtell" rwTellFFI :: Ptr RWops -> IO Int64
-foreign import ccall "sdlhelper.h SDLHelper_RWwrite" rwWriteFFI :: Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize
-foreign import ccall "SDL.h SDL_ReadBE16" readBE16FFI :: Ptr RWops -> IO Word16
-foreign import ccall "SDL.h SDL_ReadBE32" readBE32FFI :: Ptr RWops -> IO Word32
-foreign import ccall "SDL.h SDL_ReadBE64" readBE64FFI :: Ptr RWops -> IO Word64
-foreign import ccall "SDL.h SDL_ReadLE16" readLE16FFI :: Ptr RWops -> IO Word16
-foreign import ccall "SDL.h SDL_ReadLE32" readLE32FFI :: Ptr RWops -> IO Word32
-foreign import ccall "SDL.h SDL_ReadLE64" readLE64FFI :: Ptr RWops -> IO Word64
-foreign import ccall "SDL.h SDL_WriteBE16" writeBE16FFI :: Ptr RWops -> Word16 -> IO CSize
-foreign import ccall "SDL.h SDL_WriteBE32" writeBE32FFI :: Ptr RWops -> Word32 -> IO CSize
-foreign import ccall "SDL.h SDL_WriteBE64" writeBE64FFI :: Ptr RWops -> Word64 -> IO CSize
-foreign import ccall "SDL.h SDL_WriteLE16" writeLE16FFI :: Ptr RWops -> Word16 -> IO CSize
-foreign import ccall "SDL.h SDL_WriteLE32" writeLE32FFI :: Ptr RWops -> Word32 -> IO CSize
-foreign import ccall "SDL.h SDL_WriteLE64" writeLE64FFI :: Ptr RWops -> Word64 -> IO CSize
-
-getBasePath :: MonadIO m => m CString
-getBasePath = liftIO getBasePathFFI
-{-# INLINE getBasePath #-}
-
-getPrefPath :: MonadIO m => CString -> CString -> m CString
-getPrefPath v1 v2 = liftIO $ getPrefPathFFI v1 v2
-{-# INLINE getPrefPath #-}
-
-allocRW :: MonadIO m => m (Ptr RWops)
-allocRW = liftIO allocRWFFI
-{-# INLINE allocRW #-}
-
-freeRW :: MonadIO m => Ptr RWops -> m ()
-freeRW v1 = liftIO $ freeRWFFI v1
-{-# INLINE freeRW #-}
-
-rwFromConstMem :: MonadIO m => Ptr () -> CInt -> m (Ptr RWops)
-rwFromConstMem v1 v2 = liftIO $ rwFromConstMemFFI v1 v2
-{-# INLINE rwFromConstMem #-}
-
-rwFromFP :: MonadIO m => Ptr () -> Bool -> m (Ptr RWops)
-rwFromFP v1 v2 = liftIO $ rwFromFPFFI v1 v2
-{-# INLINE rwFromFP #-}
-
-rwFromFile :: MonadIO m => CString -> CString -> m (Ptr RWops)
-rwFromFile v1 v2 = liftIO $ rwFromFileFFI v1 v2
-{-# INLINE rwFromFile #-}
-
-rwFromMem :: MonadIO m => Ptr () -> CInt -> m (Ptr RWops)
-rwFromMem v1 v2 = liftIO $ rwFromMemFFI v1 v2
-{-# INLINE rwFromMem #-}
-
-rwClose :: MonadIO m => Ptr RWops -> m CInt
-rwClose v1 = liftIO $ rwCloseFFI v1
-{-# INLINE rwClose #-}
-
-rwRead :: MonadIO m => Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize
-rwRead v1 v2 v3 v4 = liftIO $ rwReadFFI v1 v2 v3 v4
-{-# INLINE rwRead #-}
-
-rwSeek :: MonadIO m => Ptr RWops -> Int64 -> CInt -> m Int64
-rwSeek v1 v2 v3 = liftIO $ rwSeekFFI v1 v2 v3
-{-# INLINE rwSeek #-}
-
-rwTell :: MonadIO m => Ptr RWops -> m Int64
-rwTell v1 = liftIO $ rwTellFFI v1
-{-# INLINE rwTell #-}
-
-rwWrite :: MonadIO m => Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize
-rwWrite v1 v2 v3 v4 = liftIO $ rwWriteFFI v1 v2 v3 v4
-{-# INLINE rwWrite #-}
-
-readBE16 :: MonadIO m => Ptr RWops -> m Word16
-readBE16 v1 = liftIO $ readBE16FFI v1
-{-# INLINE readBE16 #-}
-
-readBE32 :: MonadIO m => Ptr RWops -> m Word32
-readBE32 v1 = liftIO $ readBE32FFI v1
-{-# INLINE readBE32 #-}
-
-readBE64 :: MonadIO m => Ptr RWops -> m Word64
-readBE64 v1 = liftIO $ readBE64FFI v1
-{-# INLINE readBE64 #-}
-
-readLE16 :: MonadIO m => Ptr RWops -> m Word16
-readLE16 v1 = liftIO $ readLE16FFI v1
-{-# INLINE readLE16 #-}
-
-readLE32 :: MonadIO m => Ptr RWops -> m Word32
-readLE32 v1 = liftIO $ readLE32FFI v1
-{-# INLINE readLE32 #-}
-
-readLE64 :: MonadIO m => Ptr RWops -> m Word64
-readLE64 v1 = liftIO $ readLE64FFI v1
-{-# INLINE readLE64 #-}
-
-writeBE16 :: MonadIO m => Ptr RWops -> Word16 -> m CSize
-writeBE16 v1 v2 = liftIO $ writeBE16FFI v1 v2
-{-# INLINE writeBE16 #-}
-
-writeBE32 :: MonadIO m => Ptr RWops -> Word32 -> m CSize
-writeBE32 v1 v2 = liftIO $ writeBE32FFI v1 v2
-{-# INLINE writeBE32 #-}
-
-writeBE64 :: MonadIO m => Ptr RWops -> Word64 -> m CSize
-writeBE64 v1 v2 = liftIO $ writeBE64FFI v1 v2
-{-# INLINE writeBE64 #-}
-
-writeLE16 :: MonadIO m => Ptr RWops -> Word16 -> m CSize
-writeLE16 v1 v2 = liftIO $ writeLE16FFI v1 v2
-{-# INLINE writeLE16 #-}
-
-writeLE32 :: MonadIO m => Ptr RWops -> Word32 -> m CSize
-writeLE32 v1 v2 = liftIO $ writeLE32FFI v1 v2
-{-# INLINE writeLE32 #-}
-
-writeLE64 :: MonadIO m => Ptr RWops -> Word64 -> m CSize
-writeLE64 v1 v2 = liftIO $ writeLE64FFI v1 v2
-{-# INLINE writeLE64 #-}
+module SDL.Raw.Filesystem (+  -- * Filesystem Paths+  getBasePath,+  getPrefPath,++  -- * File I/O Abstraction+  allocRW,+  freeRW,+  rwFromConstMem,+  rwFromFP,+  rwFromFile,+  rwFromMem,+  rwClose,+  rwRead,+  rwSeek,+  rwTell,+  rwWrite,+  readBE16,+  readBE32,+  readBE64,+  readLE16,+  readLE32,+  readLE64,+  writeBE16,+  writeBE32,+  writeBE64,+  writeLE16,+  writeLE32,+  writeLE64+) where++import Control.Monad.IO.Class+import Data.Int+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_GetBasePath" getBasePathFFI :: IO CString+foreign import ccall "SDL.h SDL_GetPrefPath" getPrefPathFFI :: CString -> CString -> IO CString++foreign import ccall "SDL.h SDL_AllocRW" allocRWFFI :: IO (Ptr RWops)+foreign import ccall "SDL.h SDL_FreeRW" freeRWFFI :: Ptr RWops -> IO ()+foreign import ccall "SDL.h SDL_RWFromConstMem" rwFromConstMemFFI :: Ptr () -> CInt -> IO (Ptr RWops)+foreign import ccall "SDL.h SDL_RWFromFP" rwFromFPFFI :: Ptr () -> Bool -> IO (Ptr RWops)+foreign import ccall "SDL.h SDL_RWFromFile" rwFromFileFFI :: CString -> CString -> IO (Ptr RWops)+foreign import ccall "SDL.h SDL_RWFromMem" rwFromMemFFI :: Ptr () -> CInt -> IO (Ptr RWops)+foreign import ccall "sdlhelper.h SDLHelper_RWclose" rwCloseFFI :: Ptr RWops -> IO CInt+foreign import ccall "sdlhelper.h SDLHelper_RWread" rwReadFFI :: Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize+foreign import ccall "sdlhelper.h SDLHelper_RWseek" rwSeekFFI :: Ptr RWops -> Int64 -> CInt -> IO Int64+foreign import ccall "sdlhelper.h SDLHelper_RWtell" rwTellFFI :: Ptr RWops -> IO Int64+foreign import ccall "sdlhelper.h SDLHelper_RWwrite" rwWriteFFI :: Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize+foreign import ccall "SDL.h SDL_ReadBE16" readBE16FFI :: Ptr RWops -> IO Word16+foreign import ccall "SDL.h SDL_ReadBE32" readBE32FFI :: Ptr RWops -> IO Word32+foreign import ccall "SDL.h SDL_ReadBE64" readBE64FFI :: Ptr RWops -> IO Word64+foreign import ccall "SDL.h SDL_ReadLE16" readLE16FFI :: Ptr RWops -> IO Word16+foreign import ccall "SDL.h SDL_ReadLE32" readLE32FFI :: Ptr RWops -> IO Word32+foreign import ccall "SDL.h SDL_ReadLE64" readLE64FFI :: Ptr RWops -> IO Word64+foreign import ccall "SDL.h SDL_WriteBE16" writeBE16FFI :: Ptr RWops -> Word16 -> IO CSize+foreign import ccall "SDL.h SDL_WriteBE32" writeBE32FFI :: Ptr RWops -> Word32 -> IO CSize+foreign import ccall "SDL.h SDL_WriteBE64" writeBE64FFI :: Ptr RWops -> Word64 -> IO CSize+foreign import ccall "SDL.h SDL_WriteLE16" writeLE16FFI :: Ptr RWops -> Word16 -> IO CSize+foreign import ccall "SDL.h SDL_WriteLE32" writeLE32FFI :: Ptr RWops -> Word32 -> IO CSize+foreign import ccall "SDL.h SDL_WriteLE64" writeLE64FFI :: Ptr RWops -> Word64 -> IO CSize++getBasePath :: MonadIO m => m CString+getBasePath = liftIO getBasePathFFI+{-# INLINE getBasePath #-}++getPrefPath :: MonadIO m => CString -> CString -> m CString+getPrefPath v1 v2 = liftIO $ getPrefPathFFI v1 v2+{-# INLINE getPrefPath #-}++allocRW :: MonadIO m => m (Ptr RWops)+allocRW = liftIO allocRWFFI+{-# INLINE allocRW #-}++freeRW :: MonadIO m => Ptr RWops -> m ()+freeRW v1 = liftIO $ freeRWFFI v1+{-# INLINE freeRW #-}++rwFromConstMem :: MonadIO m => Ptr () -> CInt -> m (Ptr RWops)+rwFromConstMem v1 v2 = liftIO $ rwFromConstMemFFI v1 v2+{-# INLINE rwFromConstMem #-}++rwFromFP :: MonadIO m => Ptr () -> Bool -> m (Ptr RWops)+rwFromFP v1 v2 = liftIO $ rwFromFPFFI v1 v2+{-# INLINE rwFromFP #-}++rwFromFile :: MonadIO m => CString -> CString -> m (Ptr RWops)+rwFromFile v1 v2 = liftIO $ rwFromFileFFI v1 v2+{-# INLINE rwFromFile #-}++rwFromMem :: MonadIO m => Ptr () -> CInt -> m (Ptr RWops)+rwFromMem v1 v2 = liftIO $ rwFromMemFFI v1 v2+{-# INLINE rwFromMem #-}++rwClose :: MonadIO m => Ptr RWops -> m CInt+rwClose v1 = liftIO $ rwCloseFFI v1+{-# INLINE rwClose #-}++rwRead :: MonadIO m => Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize+rwRead v1 v2 v3 v4 = liftIO $ rwReadFFI v1 v2 v3 v4+{-# INLINE rwRead #-}++rwSeek :: MonadIO m => Ptr RWops -> Int64 -> CInt -> m Int64+rwSeek v1 v2 v3 = liftIO $ rwSeekFFI v1 v2 v3+{-# INLINE rwSeek #-}++rwTell :: MonadIO m => Ptr RWops -> m Int64+rwTell v1 = liftIO $ rwTellFFI v1+{-# INLINE rwTell #-}++rwWrite :: MonadIO m => Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize+rwWrite v1 v2 v3 v4 = liftIO $ rwWriteFFI v1 v2 v3 v4+{-# INLINE rwWrite #-}++readBE16 :: MonadIO m => Ptr RWops -> m Word16+readBE16 v1 = liftIO $ readBE16FFI v1+{-# INLINE readBE16 #-}++readBE32 :: MonadIO m => Ptr RWops -> m Word32+readBE32 v1 = liftIO $ readBE32FFI v1+{-# INLINE readBE32 #-}++readBE64 :: MonadIO m => Ptr RWops -> m Word64+readBE64 v1 = liftIO $ readBE64FFI v1+{-# INLINE readBE64 #-}++readLE16 :: MonadIO m => Ptr RWops -> m Word16+readLE16 v1 = liftIO $ readLE16FFI v1+{-# INLINE readLE16 #-}++readLE32 :: MonadIO m => Ptr RWops -> m Word32+readLE32 v1 = liftIO $ readLE32FFI v1+{-# INLINE readLE32 #-}++readLE64 :: MonadIO m => Ptr RWops -> m Word64+readLE64 v1 = liftIO $ readLE64FFI v1+{-# INLINE readLE64 #-}++writeBE16 :: MonadIO m => Ptr RWops -> Word16 -> m CSize+writeBE16 v1 v2 = liftIO $ writeBE16FFI v1 v2+{-# INLINE writeBE16 #-}++writeBE32 :: MonadIO m => Ptr RWops -> Word32 -> m CSize+writeBE32 v1 v2 = liftIO $ writeBE32FFI v1 v2+{-# INLINE writeBE32 #-}++writeBE64 :: MonadIO m => Ptr RWops -> Word64 -> m CSize+writeBE64 v1 v2 = liftIO $ writeBE64FFI v1 v2+{-# INLINE writeBE64 #-}++writeLE16 :: MonadIO m => Ptr RWops -> Word16 -> m CSize+writeLE16 v1 v2 = liftIO $ writeLE16FFI v1 v2+{-# INLINE writeLE16 #-}++writeLE32 :: MonadIO m => Ptr RWops -> Word32 -> m CSize+writeLE32 v1 v2 = liftIO $ writeLE32FFI v1 v2+{-# INLINE writeLE32 #-}++writeLE64 :: MonadIO m => Ptr RWops -> Word64 -> m CSize+writeLE64 v1 v2 = liftIO $ writeLE64FFI v1 v2+{-# INLINE writeLE64 #-}
src/SDL/Raw/Haptic.hs view
@@ -1,191 +1,191 @@-module SDL.Raw.Haptic (
-  -- * Force Feedback Support
-  hapticClose,
-  hapticDestroyEffect,
-  hapticEffectSupported,
-  hapticGetEffectStatus,
-  hapticIndex,
-  hapticName,
-  hapticNewEffect,
-  hapticNumAxes,
-  hapticNumEffects,
-  hapticNumEffectsPlaying,
-  hapticOpen,
-  hapticOpenFromJoystick,
-  hapticOpenFromMouse,
-  hapticOpened,
-  hapticPause,
-  hapticQuery,
-  hapticRumbleInit,
-  hapticRumblePlay,
-  hapticRumbleStop,
-  hapticRumbleSupported,
-  hapticRunEffect,
-  hapticSetAutocenter,
-  hapticSetGain,
-  hapticStopAll,
-  hapticStopEffect,
-  hapticUnpause,
-  hapticUpdateEffect,
-  joystickIsHaptic,
-  mouseIsHaptic,
-  numHaptics
-) where
-
-import Control.Monad.IO.Class
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_HapticClose" hapticCloseFFI :: Haptic -> IO ()
-foreign import ccall "SDL.h SDL_HapticDestroyEffect" hapticDestroyEffectFFI :: Haptic -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_HapticEffectSupported" hapticEffectSupportedFFI :: Haptic -> Ptr HapticEffect -> IO CInt
-foreign import ccall "SDL.h SDL_HapticGetEffectStatus" hapticGetEffectStatusFFI :: Haptic -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_HapticIndex" hapticIndexFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticName" hapticNameFFI :: CInt -> IO CString
-foreign import ccall "SDL.h SDL_HapticNewEffect" hapticNewEffectFFI :: Haptic -> Ptr HapticEffect -> IO CInt
-foreign import ccall "SDL.h SDL_HapticNumAxes" hapticNumAxesFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticNumEffects" hapticNumEffectsFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticNumEffectsPlaying" hapticNumEffectsPlayingFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticOpen" hapticOpenFFI :: CInt -> IO Haptic
-foreign import ccall "SDL.h SDL_HapticOpenFromJoystick" hapticOpenFromJoystickFFI :: Joystick -> IO Haptic
-foreign import ccall "SDL.h SDL_HapticOpenFromMouse" hapticOpenFromMouseFFI :: IO Haptic
-foreign import ccall "SDL.h SDL_HapticOpened" hapticOpenedFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_HapticPause" hapticPauseFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticQuery" hapticQueryFFI :: Haptic -> IO CUInt
-foreign import ccall "SDL.h SDL_HapticRumbleInit" hapticRumbleInitFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticRumblePlay" hapticRumblePlayFFI :: Haptic -> CFloat -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_HapticRumbleStop" hapticRumbleStopFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticRumbleSupported" hapticRumbleSupportedFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticRunEffect" hapticRunEffectFFI :: Haptic -> CInt -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_HapticSetAutocenter" hapticSetAutocenterFFI :: Haptic -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_HapticSetGain" hapticSetGainFFI :: Haptic -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_HapticStopAll" hapticStopAllFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticStopEffect" hapticStopEffectFFI :: Haptic -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_HapticUnpause" hapticUnpauseFFI :: Haptic -> IO CInt
-foreign import ccall "SDL.h SDL_HapticUpdateEffect" hapticUpdateEffectFFI :: Haptic -> CInt -> Ptr HapticEffect -> IO CInt
-foreign import ccall "SDL.h SDL_JoystickIsHaptic" joystickIsHapticFFI :: Joystick -> IO CInt
-foreign import ccall "SDL.h SDL_MouseIsHaptic" mouseIsHapticFFI :: IO CInt
-foreign import ccall "SDL.h SDL_NumHaptics" numHapticsFFI :: IO CInt
-
-hapticClose :: MonadIO m => Haptic -> m ()
-hapticClose v1 = liftIO $ hapticCloseFFI v1
-{-# INLINE hapticClose #-}
-
-hapticDestroyEffect :: MonadIO m => Haptic -> CInt -> m ()
-hapticDestroyEffect v1 v2 = liftIO $ hapticDestroyEffectFFI v1 v2
-{-# INLINE hapticDestroyEffect #-}
-
-hapticEffectSupported :: MonadIO m => Haptic -> Ptr HapticEffect -> m CInt
-hapticEffectSupported v1 v2 = liftIO $ hapticEffectSupportedFFI v1 v2
-{-# INLINE hapticEffectSupported #-}
-
-hapticGetEffectStatus :: MonadIO m => Haptic -> CInt -> m CInt
-hapticGetEffectStatus v1 v2 = liftIO $ hapticGetEffectStatusFFI v1 v2
-{-# INLINE hapticGetEffectStatus #-}
-
-hapticIndex :: MonadIO m => Haptic -> m CInt
-hapticIndex v1 = liftIO $ hapticIndexFFI v1
-{-# INLINE hapticIndex #-}
-
-hapticName :: MonadIO m => CInt -> m CString
-hapticName v1 = liftIO $ hapticNameFFI v1
-{-# INLINE hapticName #-}
-
-hapticNewEffect :: MonadIO m => Haptic -> Ptr HapticEffect -> m CInt
-hapticNewEffect v1 v2 = liftIO $ hapticNewEffectFFI v1 v2
-{-# INLINE hapticNewEffect #-}
-
-hapticNumAxes :: MonadIO m => Haptic -> m CInt
-hapticNumAxes v1 = liftIO $ hapticNumAxesFFI v1
-{-# INLINE hapticNumAxes #-}
-
-hapticNumEffects :: MonadIO m => Haptic -> m CInt
-hapticNumEffects v1 = liftIO $ hapticNumEffectsFFI v1
-{-# INLINE hapticNumEffects #-}
-
-hapticNumEffectsPlaying :: MonadIO m => Haptic -> m CInt
-hapticNumEffectsPlaying v1 = liftIO $ hapticNumEffectsPlayingFFI v1
-{-# INLINE hapticNumEffectsPlaying #-}
-
-hapticOpen :: MonadIO m => CInt -> m Haptic
-hapticOpen v1 = liftIO $ hapticOpenFFI v1
-{-# INLINE hapticOpen #-}
-
-hapticOpenFromJoystick :: MonadIO m => Joystick -> m Haptic
-hapticOpenFromJoystick v1 = liftIO $ hapticOpenFromJoystickFFI v1
-{-# INLINE hapticOpenFromJoystick #-}
-
-hapticOpenFromMouse :: MonadIO m => m Haptic
-hapticOpenFromMouse = liftIO hapticOpenFromMouseFFI
-{-# INLINE hapticOpenFromMouse #-}
-
-hapticOpened :: MonadIO m => CInt -> m CInt
-hapticOpened v1 = liftIO $ hapticOpenedFFI v1
-{-# INLINE hapticOpened #-}
-
-hapticPause :: MonadIO m => Haptic -> m CInt
-hapticPause v1 = liftIO $ hapticPauseFFI v1
-{-# INLINE hapticPause #-}
-
-hapticQuery :: MonadIO m => Haptic -> m CUInt
-hapticQuery v1 = liftIO $ hapticQueryFFI v1
-{-# INLINE hapticQuery #-}
-
-hapticRumbleInit :: MonadIO m => Haptic -> m CInt
-hapticRumbleInit v1 = liftIO $ hapticRumbleInitFFI v1
-{-# INLINE hapticRumbleInit #-}
-
-hapticRumblePlay :: MonadIO m => Haptic -> CFloat -> Word32 -> m CInt
-hapticRumblePlay v1 v2 v3 = liftIO $ hapticRumblePlayFFI v1 v2 v3
-{-# INLINE hapticRumblePlay #-}
-
-hapticRumbleStop :: MonadIO m => Haptic -> m CInt
-hapticRumbleStop v1 = liftIO $ hapticRumbleStopFFI v1
-{-# INLINE hapticRumbleStop #-}
-
-hapticRumbleSupported :: MonadIO m => Haptic -> m CInt
-hapticRumbleSupported v1 = liftIO $ hapticRumbleSupportedFFI v1
-{-# INLINE hapticRumbleSupported #-}
-
-hapticRunEffect :: MonadIO m => Haptic -> CInt -> Word32 -> m CInt
-hapticRunEffect v1 v2 v3 = liftIO $ hapticRunEffectFFI v1 v2 v3
-{-# INLINE hapticRunEffect #-}
-
-hapticSetAutocenter :: MonadIO m => Haptic -> CInt -> m CInt
-hapticSetAutocenter v1 v2 = liftIO $ hapticSetAutocenterFFI v1 v2
-{-# INLINE hapticSetAutocenter #-}
-
-hapticSetGain :: MonadIO m => Haptic -> CInt -> m CInt
-hapticSetGain v1 v2 = liftIO $ hapticSetGainFFI v1 v2
-{-# INLINE hapticSetGain #-}
-
-hapticStopAll :: MonadIO m => Haptic -> m CInt
-hapticStopAll v1 = liftIO $ hapticStopAllFFI v1
-{-# INLINE hapticStopAll #-}
-
-hapticStopEffect :: MonadIO m => Haptic -> CInt -> m CInt
-hapticStopEffect v1 v2 = liftIO $ hapticStopEffectFFI v1 v2
-{-# INLINE hapticStopEffect #-}
-
-hapticUnpause :: MonadIO m => Haptic -> m CInt
-hapticUnpause v1 = liftIO $ hapticUnpauseFFI v1
-{-# INLINE hapticUnpause #-}
-
-hapticUpdateEffect :: MonadIO m => Haptic -> CInt -> Ptr HapticEffect -> m CInt
-hapticUpdateEffect v1 v2 v3 = liftIO $ hapticUpdateEffectFFI v1 v2 v3
-{-# INLINE hapticUpdateEffect #-}
-
-joystickIsHaptic :: MonadIO m => Joystick -> m CInt
-joystickIsHaptic v1 = liftIO $ joystickIsHapticFFI v1
-{-# INLINE joystickIsHaptic #-}
-
-mouseIsHaptic :: MonadIO m => m CInt
-mouseIsHaptic = liftIO mouseIsHapticFFI
-{-# INLINE mouseIsHaptic #-}
-
-numHaptics :: MonadIO m => m CInt
-numHaptics = liftIO numHapticsFFI
-{-# INLINE numHaptics #-}
+module SDL.Raw.Haptic (+  -- * Force Feedback Support+  hapticClose,+  hapticDestroyEffect,+  hapticEffectSupported,+  hapticGetEffectStatus,+  hapticIndex,+  hapticName,+  hapticNewEffect,+  hapticNumAxes,+  hapticNumEffects,+  hapticNumEffectsPlaying,+  hapticOpen,+  hapticOpenFromJoystick,+  hapticOpenFromMouse,+  hapticOpened,+  hapticPause,+  hapticQuery,+  hapticRumbleInit,+  hapticRumblePlay,+  hapticRumbleStop,+  hapticRumbleSupported,+  hapticRunEffect,+  hapticSetAutocenter,+  hapticSetGain,+  hapticStopAll,+  hapticStopEffect,+  hapticUnpause,+  hapticUpdateEffect,+  joystickIsHaptic,+  mouseIsHaptic,+  numHaptics+) where++import Control.Monad.IO.Class+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_HapticClose" hapticCloseFFI :: Haptic -> IO ()+foreign import ccall "SDL.h SDL_HapticDestroyEffect" hapticDestroyEffectFFI :: Haptic -> CInt -> IO ()+foreign import ccall "SDL.h SDL_HapticEffectSupported" hapticEffectSupportedFFI :: Haptic -> Ptr HapticEffect -> IO CInt+foreign import ccall "SDL.h SDL_HapticGetEffectStatus" hapticGetEffectStatusFFI :: Haptic -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_HapticIndex" hapticIndexFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticName" hapticNameFFI :: CInt -> IO CString+foreign import ccall "SDL.h SDL_HapticNewEffect" hapticNewEffectFFI :: Haptic -> Ptr HapticEffect -> IO CInt+foreign import ccall "SDL.h SDL_HapticNumAxes" hapticNumAxesFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticNumEffects" hapticNumEffectsFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticNumEffectsPlaying" hapticNumEffectsPlayingFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticOpen" hapticOpenFFI :: CInt -> IO Haptic+foreign import ccall "SDL.h SDL_HapticOpenFromJoystick" hapticOpenFromJoystickFFI :: Joystick -> IO Haptic+foreign import ccall "SDL.h SDL_HapticOpenFromMouse" hapticOpenFromMouseFFI :: IO Haptic+foreign import ccall "SDL.h SDL_HapticOpened" hapticOpenedFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_HapticPause" hapticPauseFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticQuery" hapticQueryFFI :: Haptic -> IO CUInt+foreign import ccall "SDL.h SDL_HapticRumbleInit" hapticRumbleInitFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticRumblePlay" hapticRumblePlayFFI :: Haptic -> CFloat -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_HapticRumbleStop" hapticRumbleStopFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticRumbleSupported" hapticRumbleSupportedFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticRunEffect" hapticRunEffectFFI :: Haptic -> CInt -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_HapticSetAutocenter" hapticSetAutocenterFFI :: Haptic -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_HapticSetGain" hapticSetGainFFI :: Haptic -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_HapticStopAll" hapticStopAllFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticStopEffect" hapticStopEffectFFI :: Haptic -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_HapticUnpause" hapticUnpauseFFI :: Haptic -> IO CInt+foreign import ccall "SDL.h SDL_HapticUpdateEffect" hapticUpdateEffectFFI :: Haptic -> CInt -> Ptr HapticEffect -> IO CInt+foreign import ccall "SDL.h SDL_JoystickIsHaptic" joystickIsHapticFFI :: Joystick -> IO CInt+foreign import ccall "SDL.h SDL_MouseIsHaptic" mouseIsHapticFFI :: IO CInt+foreign import ccall "SDL.h SDL_NumHaptics" numHapticsFFI :: IO CInt++hapticClose :: MonadIO m => Haptic -> m ()+hapticClose v1 = liftIO $ hapticCloseFFI v1+{-# INLINE hapticClose #-}++hapticDestroyEffect :: MonadIO m => Haptic -> CInt -> m ()+hapticDestroyEffect v1 v2 = liftIO $ hapticDestroyEffectFFI v1 v2+{-# INLINE hapticDestroyEffect #-}++hapticEffectSupported :: MonadIO m => Haptic -> Ptr HapticEffect -> m CInt+hapticEffectSupported v1 v2 = liftIO $ hapticEffectSupportedFFI v1 v2+{-# INLINE hapticEffectSupported #-}++hapticGetEffectStatus :: MonadIO m => Haptic -> CInt -> m CInt+hapticGetEffectStatus v1 v2 = liftIO $ hapticGetEffectStatusFFI v1 v2+{-# INLINE hapticGetEffectStatus #-}++hapticIndex :: MonadIO m => Haptic -> m CInt+hapticIndex v1 = liftIO $ hapticIndexFFI v1+{-# INLINE hapticIndex #-}++hapticName :: MonadIO m => CInt -> m CString+hapticName v1 = liftIO $ hapticNameFFI v1+{-# INLINE hapticName #-}++hapticNewEffect :: MonadIO m => Haptic -> Ptr HapticEffect -> m CInt+hapticNewEffect v1 v2 = liftIO $ hapticNewEffectFFI v1 v2+{-# INLINE hapticNewEffect #-}++hapticNumAxes :: MonadIO m => Haptic -> m CInt+hapticNumAxes v1 = liftIO $ hapticNumAxesFFI v1+{-# INLINE hapticNumAxes #-}++hapticNumEffects :: MonadIO m => Haptic -> m CInt+hapticNumEffects v1 = liftIO $ hapticNumEffectsFFI v1+{-# INLINE hapticNumEffects #-}++hapticNumEffectsPlaying :: MonadIO m => Haptic -> m CInt+hapticNumEffectsPlaying v1 = liftIO $ hapticNumEffectsPlayingFFI v1+{-# INLINE hapticNumEffectsPlaying #-}++hapticOpen :: MonadIO m => CInt -> m Haptic+hapticOpen v1 = liftIO $ hapticOpenFFI v1+{-# INLINE hapticOpen #-}++hapticOpenFromJoystick :: MonadIO m => Joystick -> m Haptic+hapticOpenFromJoystick v1 = liftIO $ hapticOpenFromJoystickFFI v1+{-# INLINE hapticOpenFromJoystick #-}++hapticOpenFromMouse :: MonadIO m => m Haptic+hapticOpenFromMouse = liftIO hapticOpenFromMouseFFI+{-# INLINE hapticOpenFromMouse #-}++hapticOpened :: MonadIO m => CInt -> m CInt+hapticOpened v1 = liftIO $ hapticOpenedFFI v1+{-# INLINE hapticOpened #-}++hapticPause :: MonadIO m => Haptic -> m CInt+hapticPause v1 = liftIO $ hapticPauseFFI v1+{-# INLINE hapticPause #-}++hapticQuery :: MonadIO m => Haptic -> m CUInt+hapticQuery v1 = liftIO $ hapticQueryFFI v1+{-# INLINE hapticQuery #-}++hapticRumbleInit :: MonadIO m => Haptic -> m CInt+hapticRumbleInit v1 = liftIO $ hapticRumbleInitFFI v1+{-# INLINE hapticRumbleInit #-}++hapticRumblePlay :: MonadIO m => Haptic -> CFloat -> Word32 -> m CInt+hapticRumblePlay v1 v2 v3 = liftIO $ hapticRumblePlayFFI v1 v2 v3+{-# INLINE hapticRumblePlay #-}++hapticRumbleStop :: MonadIO m => Haptic -> m CInt+hapticRumbleStop v1 = liftIO $ hapticRumbleStopFFI v1+{-# INLINE hapticRumbleStop #-}++hapticRumbleSupported :: MonadIO m => Haptic -> m CInt+hapticRumbleSupported v1 = liftIO $ hapticRumbleSupportedFFI v1+{-# INLINE hapticRumbleSupported #-}++hapticRunEffect :: MonadIO m => Haptic -> CInt -> Word32 -> m CInt+hapticRunEffect v1 v2 v3 = liftIO $ hapticRunEffectFFI v1 v2 v3+{-# INLINE hapticRunEffect #-}++hapticSetAutocenter :: MonadIO m => Haptic -> CInt -> m CInt+hapticSetAutocenter v1 v2 = liftIO $ hapticSetAutocenterFFI v1 v2+{-# INLINE hapticSetAutocenter #-}++hapticSetGain :: MonadIO m => Haptic -> CInt -> m CInt+hapticSetGain v1 v2 = liftIO $ hapticSetGainFFI v1 v2+{-# INLINE hapticSetGain #-}++hapticStopAll :: MonadIO m => Haptic -> m CInt+hapticStopAll v1 = liftIO $ hapticStopAllFFI v1+{-# INLINE hapticStopAll #-}++hapticStopEffect :: MonadIO m => Haptic -> CInt -> m CInt+hapticStopEffect v1 v2 = liftIO $ hapticStopEffectFFI v1 v2+{-# INLINE hapticStopEffect #-}++hapticUnpause :: MonadIO m => Haptic -> m CInt+hapticUnpause v1 = liftIO $ hapticUnpauseFFI v1+{-# INLINE hapticUnpause #-}++hapticUpdateEffect :: MonadIO m => Haptic -> CInt -> Ptr HapticEffect -> m CInt+hapticUpdateEffect v1 v2 v3 = liftIO $ hapticUpdateEffectFFI v1 v2 v3+{-# INLINE hapticUpdateEffect #-}++joystickIsHaptic :: MonadIO m => Joystick -> m CInt+joystickIsHaptic v1 = liftIO $ joystickIsHapticFFI v1+{-# INLINE joystickIsHaptic #-}++mouseIsHaptic :: MonadIO m => m CInt+mouseIsHaptic = liftIO mouseIsHapticFFI+{-# INLINE mouseIsHaptic #-}++numHaptics :: MonadIO m => m CInt+numHaptics = liftIO numHapticsFFI+{-# INLINE numHaptics #-}
src/SDL/Raw/Platform.hs view
@@ -1,13 +1,13 @@-module SDL.Raw.Platform (
-  -- * Platform Detection
-  getPlatform
-) where
-
-import Control.Monad.IO.Class
-import Foreign.C.String
-
-foreign import ccall "SDL.h SDL_GetPlatform" getPlatformFFI :: IO CString
-
-getPlatform :: MonadIO m => m CString
-getPlatform = liftIO getPlatformFFI
-{-# INLINE getPlatform #-}
+module SDL.Raw.Platform (+  -- * Platform Detection+  getPlatform+) where++import Control.Monad.IO.Class+import Foreign.C.String++foreign import ccall "SDL.h SDL_GetPlatform" getPlatformFFI :: IO CString++getPlatform :: MonadIO m => m CString+getPlatform = liftIO getPlatformFFI+{-# INLINE getPlatform #-}
src/SDL/Raw/Power.hs view
@@ -1,15 +1,15 @@-module SDL.Raw.Power (
-  -- * Power Management Status
-  getPowerInfo
-) where
-
-import Control.Monad.IO.Class
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Enum
-
-foreign import ccall "SDL.h SDL_GetPowerInfo" getPowerInfoFFI :: Ptr CInt -> Ptr CInt -> IO PowerState
-
-getPowerInfo :: MonadIO m => Ptr CInt -> Ptr CInt -> m PowerState
-getPowerInfo v1 v2 = liftIO $ getPowerInfoFFI v1 v2
-{-# INLINE getPowerInfo #-}
+module SDL.Raw.Power (+  -- * Power Management Status+  getPowerInfo+) where++import Control.Monad.IO.Class+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Enum++foreign import ccall "SDL.h SDL_GetPowerInfo" getPowerInfoFFI :: Ptr CInt -> Ptr CInt -> IO PowerState++getPowerInfo :: MonadIO m => Ptr CInt -> Ptr CInt -> m PowerState+getPowerInfo v1 v2 = liftIO $ getPowerInfoFFI v1 v2+{-# INLINE getPowerInfo #-}
src/SDL/Raw/Thread.hs view
@@ -1,258 +1,258 @@-module SDL.Raw.Thread (
-  -- * Thread Management
-  createThread,
-  detachThread,
-  getThreadID,
-  getThreadName,
-  setThreadPriority,
-  tlsCreate,
-  tlsGet,
-  tlsSet,
-  threadID,
-  waitThread,
-
-  -- * Thread Synchronization Primitives
-  condBroadcast,
-  condSignal,
-  condWait,
-  condWaitTimeout,
-  createCond,
-  createMutex,
-  createSemaphore,
-  destroyCond,
-  destroyMutex,
-  destroySemaphore,
-  lockMutex,
-  semPost,
-  semTryWait,
-  semValue,
-  semWait,
-  semWaitTimeout,
-  tryLockMutex,
-  unlockMutex,
-
-  -- * Atomic Operations
-  atomicAdd,
-  atomicCAS,
-  atomicCASPtr,
-  atomicDecRef,
-  atomicGet,
-  atomicGetPtr,
-  atomicIncRef,
-  atomicLock,
-  atomicSet,
-  atomicSetPtr,
-  atomicTryLock,
-  atomicUnlock
-) where
-
-import Control.Monad.IO.Class
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Enum
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_CreateThread" createThreadFFI :: ThreadFunction -> CString -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_DetachThread" detachThreadFFI :: Ptr Thread -> IO ()
-foreign import ccall "SDL.h SDL_GetThreadID" getThreadIDFFI :: Ptr Thread -> IO ThreadID
-foreign import ccall "SDL.h SDL_GetThreadName" getThreadNameFFI :: Ptr Thread -> IO CString
-foreign import ccall "SDL.h SDL_SetThreadPriority" setThreadPriorityFFI :: ThreadPriority -> IO CInt
-foreign import ccall "SDL.h SDL_TLSCreate" tlsCreateFFI :: IO TLSID
-foreign import ccall "SDL.h SDL_TLSGet" tlsGetFFI :: TLSID -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_TLSSet" tlsSetFFI :: TLSID -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO CInt
-foreign import ccall "SDL.h SDL_ThreadID" threadIDFFI :: IO ThreadID
-foreign import ccall "SDL.h SDL_WaitThread" waitThreadFFI :: Ptr Thread -> Ptr CInt -> IO ()
-
-foreign import ccall "SDL.h SDL_CondBroadcast" condBroadcastFFI :: Ptr Cond -> IO CInt
-foreign import ccall "SDL.h SDL_CondSignal" condSignalFFI :: Ptr Cond -> IO CInt
-foreign import ccall "SDL.h SDL_CondWait" condWaitFFI :: Ptr Cond -> Ptr Mutex -> IO CInt
-foreign import ccall "SDL.h SDL_CondWaitTimeout" condWaitTimeoutFFI :: Ptr Cond -> Ptr Mutex -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_CreateCond" createCondFFI :: IO (Ptr Cond)
-foreign import ccall "SDL.h SDL_CreateMutex" createMutexFFI :: IO (Ptr Mutex)
-foreign import ccall "SDL.h SDL_CreateSemaphore" createSemaphoreFFI :: Word32 -> IO (Ptr Sem)
-foreign import ccall "SDL.h SDL_DestroyCond" destroyCondFFI :: Ptr Cond -> IO ()
-foreign import ccall "SDL.h SDL_DestroyMutex" destroyMutexFFI :: Ptr Mutex -> IO ()
-foreign import ccall "SDL.h SDL_DestroySemaphore" destroySemaphoreFFI :: Ptr Sem -> IO ()
-foreign import ccall "SDL.h SDL_LockMutex" lockMutexFFI :: Ptr Mutex -> IO CInt
-foreign import ccall "SDL.h SDL_SemPost" semPostFFI :: Ptr Sem -> IO CInt
-foreign import ccall "SDL.h SDL_SemTryWait" semTryWaitFFI :: Ptr Sem -> IO CInt
-foreign import ccall "SDL.h SDL_SemValue" semValueFFI :: Ptr Sem -> IO Word32
-foreign import ccall "SDL.h SDL_SemWait" semWaitFFI :: Ptr Sem -> IO CInt
-foreign import ccall "SDL.h SDL_SemWaitTimeout" semWaitTimeoutFFI :: Ptr Sem -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_TryLockMutex" tryLockMutexFFI :: Ptr Mutex -> IO CInt
-foreign import ccall "SDL.h SDL_UnlockMutex" unlockMutexFFI :: Ptr Mutex -> IO CInt
-
-foreign import ccall "SDL.h SDL_AtomicAdd" atomicAddFFI :: Ptr Atomic -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_AtomicCAS" atomicCASFFI :: Ptr Atomic -> CInt -> CInt -> IO Bool
-foreign import ccall "SDL.h SDL_AtomicCASPtr" atomicCASPtrFFI :: Ptr (Ptr ()) -> Ptr () -> Ptr () -> IO Bool
-foreign import ccall "SDL.h SDL_AtomicGet" atomicGetFFI :: Ptr Atomic -> IO CInt
-foreign import ccall "SDL.h SDL_AtomicGetPtr" atomicGetPtrFFI :: Ptr (Ptr ()) -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_AtomicLock" atomicLockFFI :: Ptr SpinLock -> IO ()
-foreign import ccall "SDL.h SDL_AtomicSet" atomicSetFFI :: Ptr Atomic -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_AtomicSetPtr" atomicSetPtrFFI :: Ptr (Ptr ()) -> Ptr () -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_AtomicTryLock" atomicTryLockFFI :: Ptr SpinLock -> IO Bool
-foreign import ccall "SDL.h SDL_AtomicUnlock" atomicUnlockFFI :: Ptr SpinLock -> IO ()
-
-createThread :: MonadIO m => ThreadFunction -> CString -> m (Ptr ())
-createThread v1 v2 = liftIO $ createThreadFFI v1 v2
-{-# INLINE createThread #-}
-
-detachThread :: MonadIO m => Ptr Thread -> m ()
-detachThread v1 = liftIO $ detachThreadFFI v1
-{-# INLINE detachThread #-}
-
-getThreadID :: MonadIO m => Ptr Thread -> m ThreadID
-getThreadID v1 = liftIO $ getThreadIDFFI v1
-{-# INLINE getThreadID #-}
-
-getThreadName :: MonadIO m => Ptr Thread -> m CString
-getThreadName v1 = liftIO $ getThreadNameFFI v1
-{-# INLINE getThreadName #-}
-
-setThreadPriority :: MonadIO m => ThreadPriority -> m CInt
-setThreadPriority v1 = liftIO $ setThreadPriorityFFI v1
-{-# INLINE setThreadPriority #-}
-
-tlsCreate :: MonadIO m => m TLSID
-tlsCreate = liftIO tlsCreateFFI
-{-# INLINE tlsCreate #-}
-
-tlsGet :: MonadIO m => TLSID -> m (Ptr ())
-tlsGet v1 = liftIO $ tlsGetFFI v1
-{-# INLINE tlsGet #-}
-
-tlsSet :: MonadIO m => TLSID -> Ptr () -> FunPtr (Ptr () -> IO ()) -> m CInt
-tlsSet v1 v2 v3 = liftIO $ tlsSetFFI v1 v2 v3
-{-# INLINE tlsSet #-}
-
-threadID :: MonadIO m => m ThreadID
-threadID = liftIO threadIDFFI
-{-# INLINE threadID #-}
-
-waitThread :: MonadIO m => Ptr Thread -> Ptr CInt -> m ()
-waitThread v1 v2 = liftIO $ waitThreadFFI v1 v2
-{-# INLINE waitThread #-}
-
-condBroadcast :: MonadIO m => Ptr Cond -> m CInt
-condBroadcast v1 = liftIO $ condBroadcastFFI v1
-{-# INLINE condBroadcast #-}
-
-condSignal :: MonadIO m => Ptr Cond -> m CInt
-condSignal v1 = liftIO $ condSignalFFI v1
-{-# INLINE condSignal #-}
-
-condWait :: MonadIO m => Ptr Cond -> Ptr Mutex -> m CInt
-condWait v1 v2 = liftIO $ condWaitFFI v1 v2
-{-# INLINE condWait #-}
-
-condWaitTimeout :: MonadIO m => Ptr Cond -> Ptr Mutex -> Word32 -> m CInt
-condWaitTimeout v1 v2 v3 = liftIO $ condWaitTimeoutFFI v1 v2 v3
-{-# INLINE condWaitTimeout #-}
-
-createCond :: MonadIO m => m (Ptr Cond)
-createCond = liftIO createCondFFI
-{-# INLINE createCond #-}
-
-createMutex :: MonadIO m => m (Ptr Mutex)
-createMutex = liftIO createMutexFFI
-{-# INLINE createMutex #-}
-
-createSemaphore :: MonadIO m => Word32 -> m (Ptr Sem)
-createSemaphore v1 = liftIO $ createSemaphoreFFI v1
-{-# INLINE createSemaphore #-}
-
-destroyCond :: MonadIO m => Ptr Cond -> m ()
-destroyCond v1 = liftIO $ destroyCondFFI v1
-{-# INLINE destroyCond #-}
-
-destroyMutex :: MonadIO m => Ptr Mutex -> m ()
-destroyMutex v1 = liftIO $ destroyMutexFFI v1
-{-# INLINE destroyMutex #-}
-
-destroySemaphore :: MonadIO m => Ptr Sem -> m ()
-destroySemaphore v1 = liftIO $ destroySemaphoreFFI v1
-{-# INLINE destroySemaphore #-}
-
-lockMutex :: MonadIO m => Ptr Mutex -> m CInt
-lockMutex v1 = liftIO $ lockMutexFFI v1
-{-# INLINE lockMutex #-}
-
-semPost :: MonadIO m => Ptr Sem -> m CInt
-semPost v1 = liftIO $ semPostFFI v1
-{-# INLINE semPost #-}
-
-semTryWait :: MonadIO m => Ptr Sem -> m CInt
-semTryWait v1 = liftIO $ semTryWaitFFI v1
-{-# INLINE semTryWait #-}
-
-semValue :: MonadIO m => Ptr Sem -> m Word32
-semValue v1 = liftIO $ semValueFFI v1
-{-# INLINE semValue #-}
-
-semWait :: MonadIO m => Ptr Sem -> m CInt
-semWait v1 = liftIO $ semWaitFFI v1
-{-# INLINE semWait #-}
-
-semWaitTimeout :: MonadIO m => Ptr Sem -> Word32 -> m CInt
-semWaitTimeout v1 v2 = liftIO $ semWaitTimeoutFFI v1 v2
-{-# INLINE semWaitTimeout #-}
-
-tryLockMutex :: MonadIO m => Ptr Mutex -> m CInt
-tryLockMutex v1 = liftIO $ tryLockMutexFFI v1
-{-# INLINE tryLockMutex #-}
-
-unlockMutex :: MonadIO m => Ptr Mutex -> m CInt
-unlockMutex v1 = liftIO $ unlockMutexFFI v1
-{-# INLINE unlockMutex #-}
-
-atomicAdd :: MonadIO m => Ptr Atomic -> CInt -> m CInt
-atomicAdd v1 v2 = liftIO $ atomicAddFFI v1 v2
-{-# INLINE atomicAdd #-}
-
-atomicCAS :: MonadIO m => Ptr Atomic -> CInt -> CInt -> m Bool
-atomicCAS v1 v2 v3 = liftIO $ atomicCASFFI v1 v2 v3
-{-# INLINE atomicCAS #-}
-
-atomicCASPtr :: MonadIO m => Ptr (Ptr ()) -> Ptr () -> Ptr () -> m Bool
-atomicCASPtr v1 v2 v3 = liftIO $ atomicCASPtrFFI v1 v2 v3
-{-# INLINE atomicCASPtr #-}
-
-atomicDecRef :: Ptr Atomic -> IO Bool
-atomicDecRef a = do
-  old <- atomicAdd a (-1)
-  return $ old == 1
-{-# INLINE atomicDecRef #-}
-
-atomicGet :: MonadIO m => Ptr Atomic -> m CInt
-atomicGet v1 = liftIO $ atomicGetFFI v1
-{-# INLINE atomicGet #-}
-
-atomicGetPtr :: MonadIO m => Ptr (Ptr ()) -> m (Ptr ())
-atomicGetPtr v1 = liftIO $ atomicGetPtrFFI v1
-{-# INLINE atomicGetPtr #-}
-
-atomicIncRef :: Ptr Atomic -> IO CInt
-atomicIncRef a = atomicAdd a 1
-{-# INLINE atomicIncRef #-}
-
-atomicLock :: MonadIO m => Ptr SpinLock -> m ()
-atomicLock v1 = liftIO $ atomicLockFFI v1
-{-# INLINE atomicLock #-}
-
-atomicSet :: MonadIO m => Ptr Atomic -> CInt -> m CInt
-atomicSet v1 v2 = liftIO $ atomicSetFFI v1 v2
-{-# INLINE atomicSet #-}
-
-atomicSetPtr :: MonadIO m => Ptr (Ptr ()) -> Ptr () -> m (Ptr ())
-atomicSetPtr v1 v2 = liftIO $ atomicSetPtrFFI v1 v2
-{-# INLINE atomicSetPtr #-}
-
-atomicTryLock :: MonadIO m => Ptr SpinLock -> m Bool
-atomicTryLock v1 = liftIO $ atomicTryLockFFI v1
-{-# INLINE atomicTryLock #-}
-
-atomicUnlock :: MonadIO m => Ptr SpinLock -> m ()
-atomicUnlock v1 = liftIO $ atomicUnlockFFI v1
-{-# INLINE atomicUnlock #-}
+module SDL.Raw.Thread (+  -- * Thread Management+  createThread,+  detachThread,+  getThreadID,+  getThreadName,+  setThreadPriority,+  tlsCreate,+  tlsGet,+  tlsSet,+  threadID,+  waitThread,++  -- * Thread Synchronization Primitives+  condBroadcast,+  condSignal,+  condWait,+  condWaitTimeout,+  createCond,+  createMutex,+  createSemaphore,+  destroyCond,+  destroyMutex,+  destroySemaphore,+  lockMutex,+  semPost,+  semTryWait,+  semValue,+  semWait,+  semWaitTimeout,+  tryLockMutex,+  unlockMutex,++  -- * Atomic Operations+  atomicAdd,+  atomicCAS,+  atomicCASPtr,+  atomicDecRef,+  atomicGet,+  atomicGetPtr,+  atomicIncRef,+  atomicLock,+  atomicSet,+  atomicSetPtr,+  atomicTryLock,+  atomicUnlock+) where++import Control.Monad.IO.Class+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Enum+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_CreateThread" createThreadFFI :: ThreadFunction -> CString -> IO (Ptr ())+foreign import ccall "SDL.h SDL_DetachThread" detachThreadFFI :: Ptr Thread -> IO ()+foreign import ccall "SDL.h SDL_GetThreadID" getThreadIDFFI :: Ptr Thread -> IO ThreadID+foreign import ccall "SDL.h SDL_GetThreadName" getThreadNameFFI :: Ptr Thread -> IO CString+foreign import ccall "SDL.h SDL_SetThreadPriority" setThreadPriorityFFI :: ThreadPriority -> IO CInt+foreign import ccall "SDL.h SDL_TLSCreate" tlsCreateFFI :: IO TLSID+foreign import ccall "SDL.h SDL_TLSGet" tlsGetFFI :: TLSID -> IO (Ptr ())+foreign import ccall "SDL.h SDL_TLSSet" tlsSetFFI :: TLSID -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO CInt+foreign import ccall "SDL.h SDL_ThreadID" threadIDFFI :: IO ThreadID+foreign import ccall "SDL.h SDL_WaitThread" waitThreadFFI :: Ptr Thread -> Ptr CInt -> IO ()++foreign import ccall "SDL.h SDL_CondBroadcast" condBroadcastFFI :: Ptr Cond -> IO CInt+foreign import ccall "SDL.h SDL_CondSignal" condSignalFFI :: Ptr Cond -> IO CInt+foreign import ccall "SDL.h SDL_CondWait" condWaitFFI :: Ptr Cond -> Ptr Mutex -> IO CInt+foreign import ccall "SDL.h SDL_CondWaitTimeout" condWaitTimeoutFFI :: Ptr Cond -> Ptr Mutex -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_CreateCond" createCondFFI :: IO (Ptr Cond)+foreign import ccall "SDL.h SDL_CreateMutex" createMutexFFI :: IO (Ptr Mutex)+foreign import ccall "SDL.h SDL_CreateSemaphore" createSemaphoreFFI :: Word32 -> IO (Ptr Sem)+foreign import ccall "SDL.h SDL_DestroyCond" destroyCondFFI :: Ptr Cond -> IO ()+foreign import ccall "SDL.h SDL_DestroyMutex" destroyMutexFFI :: Ptr Mutex -> IO ()+foreign import ccall "SDL.h SDL_DestroySemaphore" destroySemaphoreFFI :: Ptr Sem -> IO ()+foreign import ccall "SDL.h SDL_LockMutex" lockMutexFFI :: Ptr Mutex -> IO CInt+foreign import ccall "SDL.h SDL_SemPost" semPostFFI :: Ptr Sem -> IO CInt+foreign import ccall "SDL.h SDL_SemTryWait" semTryWaitFFI :: Ptr Sem -> IO CInt+foreign import ccall "SDL.h SDL_SemValue" semValueFFI :: Ptr Sem -> IO Word32+foreign import ccall "SDL.h SDL_SemWait" semWaitFFI :: Ptr Sem -> IO CInt+foreign import ccall "SDL.h SDL_SemWaitTimeout" semWaitTimeoutFFI :: Ptr Sem -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_TryLockMutex" tryLockMutexFFI :: Ptr Mutex -> IO CInt+foreign import ccall "SDL.h SDL_UnlockMutex" unlockMutexFFI :: Ptr Mutex -> IO CInt++foreign import ccall "SDL.h SDL_AtomicAdd" atomicAddFFI :: Ptr Atomic -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_AtomicCAS" atomicCASFFI :: Ptr Atomic -> CInt -> CInt -> IO Bool+foreign import ccall "SDL.h SDL_AtomicCASPtr" atomicCASPtrFFI :: Ptr (Ptr ()) -> Ptr () -> Ptr () -> IO Bool+foreign import ccall "SDL.h SDL_AtomicGet" atomicGetFFI :: Ptr Atomic -> IO CInt+foreign import ccall "SDL.h SDL_AtomicGetPtr" atomicGetPtrFFI :: Ptr (Ptr ()) -> IO (Ptr ())+foreign import ccall "SDL.h SDL_AtomicLock" atomicLockFFI :: Ptr SpinLock -> IO ()+foreign import ccall "SDL.h SDL_AtomicSet" atomicSetFFI :: Ptr Atomic -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_AtomicSetPtr" atomicSetPtrFFI :: Ptr (Ptr ()) -> Ptr () -> IO (Ptr ())+foreign import ccall "SDL.h SDL_AtomicTryLock" atomicTryLockFFI :: Ptr SpinLock -> IO Bool+foreign import ccall "SDL.h SDL_AtomicUnlock" atomicUnlockFFI :: Ptr SpinLock -> IO ()++createThread :: MonadIO m => ThreadFunction -> CString -> m (Ptr ())+createThread v1 v2 = liftIO $ createThreadFFI v1 v2+{-# INLINE createThread #-}++detachThread :: MonadIO m => Ptr Thread -> m ()+detachThread v1 = liftIO $ detachThreadFFI v1+{-# INLINE detachThread #-}++getThreadID :: MonadIO m => Ptr Thread -> m ThreadID+getThreadID v1 = liftIO $ getThreadIDFFI v1+{-# INLINE getThreadID #-}++getThreadName :: MonadIO m => Ptr Thread -> m CString+getThreadName v1 = liftIO $ getThreadNameFFI v1+{-# INLINE getThreadName #-}++setThreadPriority :: MonadIO m => ThreadPriority -> m CInt+setThreadPriority v1 = liftIO $ setThreadPriorityFFI v1+{-# INLINE setThreadPriority #-}++tlsCreate :: MonadIO m => m TLSID+tlsCreate = liftIO tlsCreateFFI+{-# INLINE tlsCreate #-}++tlsGet :: MonadIO m => TLSID -> m (Ptr ())+tlsGet v1 = liftIO $ tlsGetFFI v1+{-# INLINE tlsGet #-}++tlsSet :: MonadIO m => TLSID -> Ptr () -> FunPtr (Ptr () -> IO ()) -> m CInt+tlsSet v1 v2 v3 = liftIO $ tlsSetFFI v1 v2 v3+{-# INLINE tlsSet #-}++threadID :: MonadIO m => m ThreadID+threadID = liftIO threadIDFFI+{-# INLINE threadID #-}++waitThread :: MonadIO m => Ptr Thread -> Ptr CInt -> m ()+waitThread v1 v2 = liftIO $ waitThreadFFI v1 v2+{-# INLINE waitThread #-}++condBroadcast :: MonadIO m => Ptr Cond -> m CInt+condBroadcast v1 = liftIO $ condBroadcastFFI v1+{-# INLINE condBroadcast #-}++condSignal :: MonadIO m => Ptr Cond -> m CInt+condSignal v1 = liftIO $ condSignalFFI v1+{-# INLINE condSignal #-}++condWait :: MonadIO m => Ptr Cond -> Ptr Mutex -> m CInt+condWait v1 v2 = liftIO $ condWaitFFI v1 v2+{-# INLINE condWait #-}++condWaitTimeout :: MonadIO m => Ptr Cond -> Ptr Mutex -> Word32 -> m CInt+condWaitTimeout v1 v2 v3 = liftIO $ condWaitTimeoutFFI v1 v2 v3+{-# INLINE condWaitTimeout #-}++createCond :: MonadIO m => m (Ptr Cond)+createCond = liftIO createCondFFI+{-# INLINE createCond #-}++createMutex :: MonadIO m => m (Ptr Mutex)+createMutex = liftIO createMutexFFI+{-# INLINE createMutex #-}++createSemaphore :: MonadIO m => Word32 -> m (Ptr Sem)+createSemaphore v1 = liftIO $ createSemaphoreFFI v1+{-# INLINE createSemaphore #-}++destroyCond :: MonadIO m => Ptr Cond -> m ()+destroyCond v1 = liftIO $ destroyCondFFI v1+{-# INLINE destroyCond #-}++destroyMutex :: MonadIO m => Ptr Mutex -> m ()+destroyMutex v1 = liftIO $ destroyMutexFFI v1+{-# INLINE destroyMutex #-}++destroySemaphore :: MonadIO m => Ptr Sem -> m ()+destroySemaphore v1 = liftIO $ destroySemaphoreFFI v1+{-# INLINE destroySemaphore #-}++lockMutex :: MonadIO m => Ptr Mutex -> m CInt+lockMutex v1 = liftIO $ lockMutexFFI v1+{-# INLINE lockMutex #-}++semPost :: MonadIO m => Ptr Sem -> m CInt+semPost v1 = liftIO $ semPostFFI v1+{-# INLINE semPost #-}++semTryWait :: MonadIO m => Ptr Sem -> m CInt+semTryWait v1 = liftIO $ semTryWaitFFI v1+{-# INLINE semTryWait #-}++semValue :: MonadIO m => Ptr Sem -> m Word32+semValue v1 = liftIO $ semValueFFI v1+{-# INLINE semValue #-}++semWait :: MonadIO m => Ptr Sem -> m CInt+semWait v1 = liftIO $ semWaitFFI v1+{-# INLINE semWait #-}++semWaitTimeout :: MonadIO m => Ptr Sem -> Word32 -> m CInt+semWaitTimeout v1 v2 = liftIO $ semWaitTimeoutFFI v1 v2+{-# INLINE semWaitTimeout #-}++tryLockMutex :: MonadIO m => Ptr Mutex -> m CInt+tryLockMutex v1 = liftIO $ tryLockMutexFFI v1+{-# INLINE tryLockMutex #-}++unlockMutex :: MonadIO m => Ptr Mutex -> m CInt+unlockMutex v1 = liftIO $ unlockMutexFFI v1+{-# INLINE unlockMutex #-}++atomicAdd :: MonadIO m => Ptr Atomic -> CInt -> m CInt+atomicAdd v1 v2 = liftIO $ atomicAddFFI v1 v2+{-# INLINE atomicAdd #-}++atomicCAS :: MonadIO m => Ptr Atomic -> CInt -> CInt -> m Bool+atomicCAS v1 v2 v3 = liftIO $ atomicCASFFI v1 v2 v3+{-# INLINE atomicCAS #-}++atomicCASPtr :: MonadIO m => Ptr (Ptr ()) -> Ptr () -> Ptr () -> m Bool+atomicCASPtr v1 v2 v3 = liftIO $ atomicCASPtrFFI v1 v2 v3+{-# INLINE atomicCASPtr #-}++atomicDecRef :: Ptr Atomic -> IO Bool+atomicDecRef a = do+  old <- atomicAdd a (-1)+  return $ old == 1+{-# INLINE atomicDecRef #-}++atomicGet :: MonadIO m => Ptr Atomic -> m CInt+atomicGet v1 = liftIO $ atomicGetFFI v1+{-# INLINE atomicGet #-}++atomicGetPtr :: MonadIO m => Ptr (Ptr ()) -> m (Ptr ())+atomicGetPtr v1 = liftIO $ atomicGetPtrFFI v1+{-# INLINE atomicGetPtr #-}++atomicIncRef :: Ptr Atomic -> IO CInt+atomicIncRef a = atomicAdd a 1+{-# INLINE atomicIncRef #-}++atomicLock :: MonadIO m => Ptr SpinLock -> m ()+atomicLock v1 = liftIO $ atomicLockFFI v1+{-# INLINE atomicLock #-}++atomicSet :: MonadIO m => Ptr Atomic -> CInt -> m CInt+atomicSet v1 v2 = liftIO $ atomicSetFFI v1 v2+{-# INLINE atomicSet #-}++atomicSetPtr :: MonadIO m => Ptr (Ptr ()) -> Ptr () -> m (Ptr ())+atomicSetPtr v1 v2 = liftIO $ atomicSetPtrFFI v1 v2+{-# INLINE atomicSetPtr #-}++atomicTryLock :: MonadIO m => Ptr SpinLock -> m Bool+atomicTryLock v1 = liftIO $ atomicTryLockFFI v1+{-# INLINE atomicTryLock #-}++atomicUnlock :: MonadIO m => Ptr SpinLock -> m ()+atomicUnlock v1 = liftIO $ atomicUnlockFFI v1+{-# INLINE atomicUnlock #-}
src/SDL/Raw/Timer.hs view
@@ -1,46 +1,46 @@-module SDL.Raw.Timer (
-  -- * Timer Support
-  addTimer,
-  delay,
-  getPerformanceCounter,
-  getPerformanceFrequency,
-  getTicks,
-  removeTimer
-) where
-
-import Control.Monad.IO.Class
-import Data.Word
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_AddTimer" addTimerFFI :: Word32 -> TimerCallback -> Ptr () -> IO TimerID
-foreign import ccall "SDL.h SDL_Delay" delayFFI :: Word32 -> IO ()
-foreign import ccall "SDL.h SDL_GetPerformanceCounter" getPerformanceCounterFFI :: IO Word64
-foreign import ccall "SDL.h SDL_GetPerformanceFrequency" getPerformanceFrequencyFFI :: IO Word64
-foreign import ccall "SDL.h SDL_GetTicks" getTicksFFI :: IO Word32
-foreign import ccall "SDL.h SDL_RemoveTimer" removeTimerFFI :: TimerID -> IO Bool
-
-addTimer :: MonadIO m => Word32 -> TimerCallback -> Ptr () -> m TimerID
-addTimer v1 v2 v3 = liftIO $ addTimerFFI v1 v2 v3
-{-# INLINE addTimer #-}
-
-delay :: MonadIO m => Word32 -> m ()
-delay v1 = liftIO $ delayFFI v1
-{-# INLINE delay #-}
-
-getPerformanceCounter :: MonadIO m => m Word64
-getPerformanceCounter = liftIO getPerformanceCounterFFI
-{-# INLINE getPerformanceCounter #-}
-
-getPerformanceFrequency :: MonadIO m => m Word64
-getPerformanceFrequency = liftIO getPerformanceFrequencyFFI
-{-# INLINE getPerformanceFrequency #-}
-
-getTicks :: MonadIO m => m Word32
-getTicks = liftIO getTicksFFI
-{-# INLINE getTicks #-}
-
-removeTimer :: MonadIO m => TimerID -> m Bool
-removeTimer v1 = liftIO $ removeTimerFFI v1
-{-# INLINE removeTimer #-}
+module SDL.Raw.Timer (+  -- * Timer Support+  addTimer,+  delay,+  getPerformanceCounter,+  getPerformanceFrequency,+  getTicks,+  removeTimer+) where++import Control.Monad.IO.Class+import Data.Word+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_AddTimer" addTimerFFI :: Word32 -> TimerCallback -> Ptr () -> IO TimerID+foreign import ccall "SDL.h SDL_Delay" delayFFI :: Word32 -> IO ()+foreign import ccall "SDL.h SDL_GetPerformanceCounter" getPerformanceCounterFFI :: IO Word64+foreign import ccall "SDL.h SDL_GetPerformanceFrequency" getPerformanceFrequencyFFI :: IO Word64+foreign import ccall "SDL.h SDL_GetTicks" getTicksFFI :: IO Word32+foreign import ccall "SDL.h SDL_RemoveTimer" removeTimerFFI :: TimerID -> IO Bool++addTimer :: MonadIO m => Word32 -> TimerCallback -> Ptr () -> m TimerID+addTimer v1 v2 v3 = liftIO $ addTimerFFI v1 v2 v3+{-# INLINE addTimer #-}++delay :: MonadIO m => Word32 -> m ()+delay v1 = liftIO $ delayFFI v1+{-# INLINE delay #-}++getPerformanceCounter :: MonadIO m => m Word64+getPerformanceCounter = liftIO getPerformanceCounterFFI+{-# INLINE getPerformanceCounter #-}++getPerformanceFrequency :: MonadIO m => m Word64+getPerformanceFrequency = liftIO getPerformanceFrequencyFFI+{-# INLINE getPerformanceFrequency #-}++getTicks :: MonadIO m => m Word32+getTicks = liftIO getTicksFFI+{-# INLINE getTicks #-}++removeTimer :: MonadIO m => TimerID -> m Bool+removeTimer v1 = liftIO $ removeTimerFFI v1+{-# INLINE removeTimer #-}
src/SDL/Raw/Types.hsc view
@@ -1,1453 +1,1453 @@-{-# LANGUAGE DeriveDataTypeable #-}
-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
-
-#include "SDL.h"
-
-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 _ = (#size SDL_atomic_t)
-  alignment = sizeOf
-  peek ptr = do
-    value <- (#peek SDL_atomic_t, value) ptr
-    return $! Atomic value
-  poke ptr (Atomic value) = do
-    (#poke SDL_atomic_t, value) 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, Typeable)
-
-instance Storable AudioCVT where
-  sizeOf _ = (#size SDL_AudioCVT)
-  alignment = sizeOf
-  peek ptr = do
-    needed <- (#peek SDL_AudioCVT, needed) ptr
-    src_format <- (#peek SDL_AudioCVT, src_format) ptr
-    dst_format <- (#peek SDL_AudioCVT, dst_format) ptr
-    rate_incr <- (#peek SDL_AudioCVT, rate_incr) ptr
-    buf <- (#peek SDL_AudioCVT, buf) ptr
-    len <- (#peek SDL_AudioCVT, len) ptr
-    len_cvt <- (#peek SDL_AudioCVT, len_cvt) ptr
-    len_mult <- (#peek SDL_AudioCVT, len_mult) ptr
-    len_ratio <- (#peek SDL_AudioCVT, len_ratio) 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
-    (#poke SDL_AudioCVT, needed) ptr needed
-    (#poke SDL_AudioCVT, src_format) ptr src_format
-    (#poke SDL_AudioCVT, dst_format) ptr dst_format
-    (#poke SDL_AudioCVT, rate_incr) ptr rate_incr
-    (#poke SDL_AudioCVT, buf) ptr buf
-    (#poke SDL_AudioCVT, len) ptr len
-    (#poke SDL_AudioCVT, len_cvt) ptr len_cvt
-    (#poke SDL_AudioCVT, len_mult) ptr len_mult
-    (#poke SDL_AudioCVT, len_ratio) 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, Typeable)
-
-instance Storable AudioSpec where
-  sizeOf _ = (#size SDL_AudioSpec)
-  alignment = sizeOf
-  peek ptr = do
-    freq <- (#peek SDL_AudioSpec, freq) ptr
-    format <- (#peek SDL_AudioSpec, format) ptr
-    channels <- (#peek SDL_AudioSpec, channels) ptr
-    silence <- (#peek SDL_AudioSpec, silence) ptr
-    samples <- (#peek SDL_AudioSpec, samples) ptr
-    size <- (#peek SDL_AudioSpec, size) ptr
-    callback <- (#peek SDL_AudioSpec, callback) ptr
-    userdata <- (#peek SDL_AudioSpec, userdata) ptr
-    return $! AudioSpec freq format channels silence samples size callback userdata
-  poke ptr (AudioSpec freq format channels silence samples size callback userdata) = do
-    (#poke SDL_AudioSpec, freq) ptr freq
-    (#poke SDL_AudioSpec, format) ptr format
-    (#poke SDL_AudioSpec, channels) ptr channels
-    (#poke SDL_AudioSpec, silence) ptr silence
-    (#poke SDL_AudioSpec, samples) ptr samples
-    (#poke SDL_AudioSpec, size) ptr size
-    (#poke SDL_AudioSpec, callback) ptr callback
-    (#poke SDL_AudioSpec, userdata) ptr userdata
-
-data Color = Color
-  { colorR :: !Word8
-  , colorG :: !Word8
-  , colorB :: !Word8
-  , colorA :: !Word8
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Color where
-  sizeOf _ = (#size SDL_Color)
-  alignment = sizeOf
-  peek ptr = do
-    r <- (#peek SDL_Color, r) ptr
-    g <- (#peek SDL_Color, g) ptr
-    b <- (#peek SDL_Color, b) ptr
-    a <- (#peek SDL_Color, a) ptr
-    return $! Color r g b a
-  poke ptr (Color r g b a) = do
-    (#poke SDL_Color, r) ptr r
-    (#poke SDL_Color, g) ptr g
-    (#poke SDL_Color, b) ptr b
-    (#poke SDL_Color, a) ptr a
-
-data DisplayMode = DisplayMode
-  { displayModeFormat :: !Word32
-  , displayModeW :: !CInt
-  , displayModeH :: !CInt
-  , displayModeRefreshRate :: !CInt
-  , displayModeDriverData :: !(Ptr ())
-  } deriving (Eq, Show, Typeable)
-
-instance Storable DisplayMode where
-  sizeOf _ = (#size SDL_DisplayMode)
-  alignment = sizeOf
-  peek ptr = do
-    format <- (#peek SDL_DisplayMode, format) ptr
-    w <- (#peek SDL_DisplayMode, w) ptr
-    h <- (#peek SDL_DisplayMode, h) ptr
-    refresh_rate <- (#peek SDL_DisplayMode, refresh_rate) ptr
-    driverdata <- (#peek SDL_DisplayMode, driverdata) ptr
-    return $! DisplayMode format w h refresh_rate driverdata
-  poke ptr (DisplayMode format w h refresh_rate driverdata) = do
-    (#poke SDL_DisplayMode, format) ptr format
-    (#poke SDL_DisplayMode, w) ptr w
-    (#poke SDL_DisplayMode, h) ptr h
-    (#poke SDL_DisplayMode, refresh_rate) ptr refresh_rate
-    (#poke SDL_DisplayMode, driverdata) 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]
-    }
-  | 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 _ = (#size SDL_Event)
-  alignment = sizeOf
-  peek ptr = do
-    typ <- (#peek SDL_Event, common.type) ptr
-    timestamp <- (#peek SDL_Event, common.timestamp) ptr
-    case typ of
-      (#const SDL_QUIT) ->
-        return $! QuitEvent typ timestamp
-      (#const SDL_WINDOWEVENT) -> do
-        wid <- (#peek SDL_Event, window.windowID) ptr
-        event <- (#peek SDL_Event, window.event) ptr
-        data1 <- (#peek SDL_Event, window.data1) ptr
-        data2 <- (#peek SDL_Event, window.data2) ptr
-        return $! WindowEvent typ timestamp wid event data1 data2
-      (#const SDL_SYSWMEVENT) -> do
-        msg <- (#peek SDL_Event, syswm.msg) ptr
-        return $! SysWMEvent typ timestamp msg
-      (#const SDL_KEYDOWN) -> key $ KeyboardEvent typ timestamp
-      (#const SDL_KEYUP) -> key $ KeyboardEvent typ timestamp
-      (#const SDL_TEXTEDITING) -> do
-        wid <- (#peek SDL_Event, edit.windowID) ptr
-        text <- peekArray (#const SDL_TEXTEDITINGEVENT_TEXT_SIZE) $ (#ptr SDL_Event, edit.text) ptr
-        start <- (#peek SDL_Event, edit.start) ptr
-        len <- (#peek SDL_Event, edit.length) ptr
-        let upToNull = takeWhile (/= 0) text
-        return $! TextEditingEvent typ timestamp wid upToNull start len
-      (#const SDL_TEXTINPUT) -> do
-        wid <- (#peek SDL_Event, text.windowID) ptr
-        text <- peekArray (#const SDL_TEXTINPUTEVENT_TEXT_SIZE) $ (#ptr SDL_Event, text.text) ptr
-        let upToNull = takeWhile (/= 0) text
-        return $! TextInputEvent typ timestamp wid upToNull
-      (#const SDL_KEYMAPCHANGED) ->
-        return $! KeymapChangedEvent typ timestamp
-      (#const SDL_MOUSEMOTION) -> do
-        wid <- (#peek SDL_Event, motion.windowID) ptr
-        which <- (#peek SDL_Event, motion.which) ptr
-        state <- (#peek SDL_Event, motion.state) ptr
-        x <- (#peek SDL_Event, motion.x) ptr
-        y <- (#peek SDL_Event, motion.y) ptr
-        xrel <- (#peek SDL_Event, motion.xrel) ptr
-        yrel <- (#peek SDL_Event, motion.yrel) ptr
-        return $! MouseMotionEvent typ timestamp wid which state x y xrel yrel
-      (#const SDL_MOUSEBUTTONDOWN) -> mouse $ MouseButtonEvent typ timestamp
-      (#const SDL_MOUSEBUTTONUP) -> mouse $ MouseButtonEvent typ timestamp
-      (#const SDL_MOUSEWHEEL) -> do
-        wid <- (#peek SDL_Event, wheel.windowID) ptr
-        which <- (#peek SDL_Event, wheel.which) ptr
-        x <- (#peek SDL_Event, wheel.x) ptr
-        y <- (#peek SDL_Event, wheel.y) ptr
-        direction <- (#peek SDL_Event, wheel.direction) ptr
-        return $! MouseWheelEvent typ timestamp wid which x y direction
-      (#const SDL_JOYAXISMOTION) -> do
-        which <- (#peek SDL_Event, jaxis.which) ptr
-        axis <- (#peek SDL_Event, jaxis.axis) ptr
-        value <- (#peek SDL_Event, jaxis.value) ptr
-        return $! JoyAxisEvent typ timestamp which axis value
-      (#const SDL_JOYBALLMOTION) -> do
-        which <- (#peek SDL_Event, jball.which) ptr
-        ball <- (#peek SDL_Event, jball.ball) ptr
-        xrel <- (#peek SDL_Event, jball.xrel) ptr
-        yrel <- (#peek SDL_Event, jball.yrel) ptr
-        return $! JoyBallEvent typ timestamp which ball xrel yrel
-      (#const SDL_JOYHATMOTION) -> do
-        which <- (#peek SDL_Event, jhat.which) ptr
-        hat <- (#peek SDL_Event, jhat.hat) ptr
-        value <- (#peek SDL_Event, jhat.value) ptr
-        return $! JoyHatEvent typ timestamp which hat value
-      (#const SDL_JOYBUTTONDOWN) -> joybutton $ JoyButtonEvent typ timestamp
-      (#const SDL_JOYBUTTONUP) -> joybutton $ JoyButtonEvent typ timestamp
-      (#const SDL_JOYDEVICEADDED) -> joydevice $ JoyDeviceEvent typ timestamp
-      (#const SDL_JOYDEVICEREMOVED) -> joydevice $ JoyDeviceEvent typ timestamp
-      (#const SDL_CONTROLLERAXISMOTION) -> do
-        which <- (#peek SDL_Event, caxis.which) ptr
-        axis <- (#peek SDL_Event, caxis.axis) ptr
-        value <- (#peek SDL_Event, caxis.value) ptr
-        return $! ControllerButtonEvent typ timestamp which axis value
-      (#const SDL_CONTROLLERBUTTONDOWN) -> controllerbutton $ ControllerButtonEvent typ timestamp
-      (#const SDL_CONTROLLERBUTTONUP) -> controllerbutton $ ControllerButtonEvent typ timestamp
-      (#const SDL_CONTROLLERDEVICEADDED) -> controllerdevice $ ControllerDeviceEvent typ timestamp
-      (#const SDL_CONTROLLERDEVICEREMOVED) -> controllerdevice $ ControllerDeviceEvent typ timestamp
-      (#const SDL_CONTROLLERDEVICEREMAPPED) -> controllerdevice $ ControllerDeviceEvent typ timestamp
-      (#const SDL_AUDIODEVICEADDED) -> audiodevice $ AudioDeviceEvent typ timestamp
-      (#const SDL_AUDIODEVICEREMOVED) -> audiodevice $ AudioDeviceEvent typ timestamp
-      (#const SDL_FINGERDOWN) -> finger $ TouchFingerEvent typ timestamp
-      (#const SDL_FINGERUP) -> finger $ TouchFingerEvent typ timestamp
-      (#const SDL_FINGERMOTION) -> finger $ TouchFingerEvent typ timestamp
-      (#const SDL_DOLLARGESTURE) -> dollargesture $ DollarGestureEvent typ timestamp
-      (#const SDL_DOLLARRECORD) -> dollargesture $ DollarGestureEvent typ timestamp
-      (#const SDL_MULTIGESTURE) -> do
-        touchId <- (#peek SDL_Event, mgesture.touchId) ptr
-        dTheta <- (#peek SDL_Event, mgesture.dTheta) ptr
-        dDist <- (#peek SDL_Event, mgesture.dDist) ptr
-        x <- (#peek SDL_Event, mgesture.x) ptr
-        y <- (#peek SDL_Event, mgesture.y) ptr
-        numFingers <- (#peek SDL_Event, mgesture.numFingers) ptr
-        return $! MultiGestureEvent typ timestamp touchId dTheta dDist x y numFingers
-      (#const SDL_CLIPBOARDUPDATE) ->
-        return $! ClipboardUpdateEvent typ timestamp
-      (#const SDL_DROPFILE) -> do
-        file <- (#peek SDL_Event, drop.file) ptr
-        return $! DropEvent typ timestamp file
-      x | x >= (#const SDL_USEREVENT) -> do
-        wid <- (#peek SDL_Event, user.windowID) ptr
-        code <- (#peek SDL_Event, user.code) ptr
-        data1 <- (#peek SDL_Event, user.data1) ptr
-        data2 <- (#peek SDL_Event, user.data2) ptr
-        return $! UserEvent typ timestamp wid code data1 data2
-      _ -> return $! UnknownEvent typ timestamp
-    where
-    key f = do
-      wid <- (#peek SDL_Event, key.windowID) ptr
-      state <- (#peek SDL_Event, key.state) ptr
-      repeat' <- (#peek SDL_Event, key.repeat) ptr
-      keysym <- (#peek SDL_Event, key.keysym) ptr
-      return $! f wid state repeat' keysym
-
-    mouse f = do
-      wid <- (#peek SDL_Event, button.windowID) ptr
-      which <- (#peek SDL_Event, button.which) ptr
-      button <- (#peek SDL_Event, button.button) ptr
-      state <- (#peek SDL_Event, button.state) ptr
-      clicks <- (#peek SDL_Event, button.clicks) ptr
-      x <- (#peek SDL_Event, button.x) ptr
-      y <- (#peek SDL_Event, button.y) ptr
-      return $! f wid which button state clicks x y
-
-    joybutton f = do
-      which <- (#peek SDL_Event, jbutton.which) ptr
-      button <- (#peek SDL_Event, jbutton.button) ptr
-      state <- (#peek SDL_Event, jbutton.state) ptr
-      return $! f which button state
-
-    joydevice f = do
-      which <- (#peek SDL_Event, jdevice.which) ptr
-      return $! f which
-
-    controllerbutton f = do
-      which <- (#peek SDL_Event, cbutton.which) ptr
-      button <- (#peek SDL_Event, cbutton.button) ptr
-      state <- (#peek SDL_Event, cbutton.state) ptr
-      return $! f which button state
-
-    controllerdevice f = do
-      which <- (#peek SDL_Event, cdevice.which) ptr
-      return $! f which
-
-    audiodevice f = do
-      which <- (#peek SDL_Event, adevice.which) ptr
-      iscapture <- (#peek SDL_Event, adevice.iscapture) ptr
-      return $! f which iscapture
-
-    finger f = do
-      touchId <- (#peek SDL_Event, tfinger.touchId) ptr
-      fingerId <- (#peek SDL_Event, tfinger.fingerId) ptr
-      x <- (#peek SDL_Event, tfinger.x) ptr
-      y <- (#peek SDL_Event, tfinger.y) ptr
-      dx <- (#peek SDL_Event, tfinger.dx) ptr
-      dy <- (#peek SDL_Event, tfinger.dy) ptr
-      pressure <- (#peek SDL_Event, tfinger.pressure) ptr
-      return $! f touchId fingerId x y dx dy pressure
-
-    dollargesture f = do
-      touchId <- (#peek SDL_Event, dgesture.touchId) ptr
-      gestureId <- (#peek SDL_Event, dgesture.gestureId) ptr
-      numFingers <- (#peek SDL_Event, dgesture.numFingers) ptr
-      err <- (#peek SDL_Event, dgesture.error) ptr
-      x <- (#peek SDL_Event, dgesture.x) ptr
-      y <- (#peek SDL_Event, dgesture.y) ptr
-      return $! f touchId gestureId numFingers err x y
-  poke ptr ev = case ev of
-    WindowEvent typ timestamp wid event data1 data2 -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, window.windowID) ptr wid
-      (#poke SDL_Event, window.event) ptr event
-      (#poke SDL_Event, window.data1) ptr data1
-      (#poke SDL_Event, window.data2) ptr data2
-    KeyboardEvent typ timestamp wid state repeat' keysym -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, key.windowID) ptr wid
-      (#poke SDL_Event, key.state) ptr state
-      (#poke SDL_Event, key.repeat) ptr repeat'
-      (#poke SDL_Event, key.keysym) ptr keysym
-    TextEditingEvent typ timestamp wid text start len -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, edit.windowID) ptr wid
-      pokeArray ((#ptr SDL_Event, edit.text) ptr) text
-      (#poke SDL_Event, edit.start) ptr start
-      (#poke SDL_Event, edit.length) ptr len
-    TextInputEvent typ timestamp wid text -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, text.windowID) ptr wid
-      pokeArray ((#ptr SDL_Event, text.text) ptr) text
-    KeymapChangedEvent typ timestamp -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-    MouseMotionEvent typ timestamp wid which state x y xrel yrel -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, motion.windowID) ptr wid
-      (#poke SDL_Event, motion.which) ptr which
-      (#poke SDL_Event, motion.state) ptr state
-      (#poke SDL_Event, motion.x) ptr x
-      (#poke SDL_Event, motion.y) ptr y
-      (#poke SDL_Event, motion.xrel) ptr xrel
-      (#poke SDL_Event, motion.yrel) ptr yrel
-    MouseButtonEvent typ timestamp wid which button state clicks x y -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, button.windowID) ptr wid
-      (#poke SDL_Event, button.which) ptr which
-      (#poke SDL_Event, button.button) ptr button
-      (#poke SDL_Event, button.state) ptr state
-      (#poke SDL_Event, button.clicks) ptr clicks
-      (#poke SDL_Event, button.x) ptr x
-      (#poke SDL_Event, button.y) ptr y
-    MouseWheelEvent typ timestamp wid which x y direction -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, wheel.windowID) ptr wid
-      (#poke SDL_Event, wheel.which) ptr which
-      (#poke SDL_Event, wheel.x) ptr x
-      (#poke SDL_Event, wheel.y) ptr y
-      (#poke SDL_Event, wheel.direction) ptr direction
-    JoyAxisEvent typ timestamp which axis value -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, jaxis.which) ptr which
-      (#poke SDL_Event, jaxis.axis) ptr axis
-      (#poke SDL_Event, jaxis.value) ptr value
-    JoyBallEvent typ timestamp which ball xrel yrel -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, jball.which) ptr which
-      (#poke SDL_Event, jball.ball) ptr ball
-      (#poke SDL_Event, jball.xrel) ptr xrel
-      (#poke SDL_Event, jball.yrel) ptr yrel
-    JoyHatEvent typ timestamp which hat value -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, jhat.which) ptr which
-      (#poke SDL_Event, jhat.hat) ptr hat
-      (#poke SDL_Event, jhat.value) ptr value
-    JoyButtonEvent typ timestamp which button state -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, jbutton.which) ptr which
-      (#poke SDL_Event, jbutton.button) ptr button
-      (#poke SDL_Event, jbutton.state) ptr state
-    JoyDeviceEvent typ timestamp which -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, jdevice.which) ptr which
-    ControllerAxisEvent typ timestamp which axis value -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, caxis.which) ptr which
-      (#poke SDL_Event, caxis.axis) ptr axis
-      (#poke SDL_Event, caxis.value) ptr value
-    ControllerButtonEvent typ timestamp which button state -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, cbutton.which) ptr which
-      (#poke SDL_Event, cbutton.button) ptr button
-      (#poke SDL_Event, cbutton.state) ptr state
-    ControllerDeviceEvent typ timestamp which -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, cdevice.which) ptr which
-    AudioDeviceEvent typ timestamp which iscapture -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, adevice.which) ptr which
-      (#poke SDL_Event, adevice.iscapture) ptr iscapture
-    QuitEvent typ timestamp -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-    UserEvent typ timestamp wid code data1 data2 -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, user.windowID) ptr wid
-      (#poke SDL_Event, user.code) ptr code
-      (#poke SDL_Event, user.data1) ptr data1
-      (#poke SDL_Event, user.data2) ptr data2
-    SysWMEvent typ timestamp msg -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, syswm.msg) ptr msg
-    TouchFingerEvent typ timestamp touchid fingerid x y dx dy pressure -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, tfinger.touchId) ptr touchid
-      (#poke SDL_Event, tfinger.fingerId) ptr fingerid
-      (#poke SDL_Event, tfinger.x) ptr x
-      (#poke SDL_Event, tfinger.y) ptr y
-      (#poke SDL_Event, tfinger.dx) ptr dx
-      (#poke SDL_Event, tfinger.dy) ptr dy
-      (#poke SDL_Event, tfinger.pressure) ptr pressure
-    MultiGestureEvent typ timestamp touchid dtheta ddist x y numfingers -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, mgesture.touchId) ptr touchid
-      (#poke SDL_Event, mgesture.dTheta) ptr dtheta
-      (#poke SDL_Event, mgesture.dDist) ptr ddist
-      (#poke SDL_Event, mgesture.x) ptr x
-      (#poke SDL_Event, mgesture.y) ptr y
-      (#poke SDL_Event, mgesture.numFingers) ptr numfingers
-    DollarGestureEvent typ timestamp touchid gestureid numfingers err x y -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, dgesture.touchId) ptr touchid
-      (#poke SDL_Event, dgesture.gestureId) ptr gestureid
-      (#poke SDL_Event, dgesture.numFingers) ptr numfingers
-      (#poke SDL_Event, dgesture.error) ptr err
-      (#poke SDL_Event, dgesture.x) ptr x
-      (#poke SDL_Event, dgesture.y) ptr y
-    ClipboardUpdateEvent typ timestamp -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-    DropEvent typ timestamp file -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-      (#poke SDL_Event, drop.file) ptr file
-    UnknownEvent typ timestamp -> do
-      (#poke SDL_Event, common.type) ptr typ
-      (#poke SDL_Event, common.timestamp) ptr timestamp
-
-data Finger = Finger
-  { fingerID :: !FingerID
-  , fingerX :: !CFloat
-  , fingerY :: !CFloat
-  , fingerPressure :: !CFloat
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Finger where
-  sizeOf _ = (#size SDL_Finger)
-  alignment = sizeOf
-  peek ptr = do
-    fingerId <- (#peek SDL_Finger, id) ptr
-    x <- (#peek SDL_Finger, x) ptr
-    y <- (#peek SDL_Finger, y) ptr
-    pressure <- (#peek SDL_Finger, pressure) ptr
-    return $! Finger fingerId x y pressure
-  poke ptr (Finger fingerId x y pressure) = do
-    (#poke SDL_Finger, id) ptr fingerId
-    (#poke SDL_Finger, x) ptr x
-    (#poke SDL_Finger, y) ptr y
-    (#poke SDL_Finger, pressure) ptr pressure
-
-data GameControllerButtonBind
-  = GameControllerButtonBindNone
-  | GameControllerButtonBindButton
-    { gameControllerButtonBindButton :: !CInt
-    }
-  | GameControllerButtonBindAxis
-    { gameControllerButtonBindAxis :: !CInt
-    }
-  | GameControllerButtonBindHat
-    { gameControllerButtonBindHat :: !CInt
-    , gameControllerButtonBindHatMask :: !CInt
-    }
-  deriving (Eq, Show, Typeable)
-
-instance Storable GameControllerButtonBind where
-  sizeOf _ = (#size SDL_GameControllerButtonBind)
-  alignment = sizeOf
-  peek ptr = do
-    bind_type <- (#peek SDL_GameControllerButtonBind, bindType) ptr
-    case bind_type :: (#type SDL_GameControllerBindType) of
-      (#const SDL_CONTROLLER_BINDTYPE_NONE) -> do
-        return $! GameControllerButtonBindNone
-      (#const SDL_CONTROLLER_BINDTYPE_BUTTON) -> do
-        button <- (#peek SDL_GameControllerButtonBind, value.button) ptr
-        return $! GameControllerButtonBindButton button
-      (#const SDL_CONTROLLER_BINDTYPE_AXIS) -> do
-        axis <- (#peek SDL_GameControllerButtonBind, value.axis) ptr
-        return $! GameControllerButtonBindAxis axis
-      (#const SDL_CONTROLLER_BINDTYPE_HAT) -> do
-        hat <- (#peek SDL_GameControllerButtonBind, value.hat.hat) ptr
-        hat_mask <- (#peek SDL_GameControllerButtonBind, value.hat.hat_mask) ptr
-        return $! GameControllerButtonBindHat hat hat_mask
-      _ -> error $ "Unknown type " ++ show bind_type ++ " for SDL_GameControllerButtonBind"
-  poke ptr bind = case bind of
-    GameControllerButtonBindNone -> do
-      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_NONE) :: (#type SDL_GameControllerBindType))
-    GameControllerButtonBindButton button -> do
-      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_BUTTON) :: (#type SDL_GameControllerBindType))
-      (#poke SDL_GameControllerButtonBind, value.button) ptr button
-    GameControllerButtonBindAxis axis -> do
-      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_AXIS) :: (#type SDL_GameControllerBindType))
-      (#poke SDL_GameControllerButtonBind, value.axis) ptr axis
-    GameControllerButtonBindHat hat hat_mask -> do
-      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_HAT) :: (#type SDL_GameControllerBindType))
-      (#poke SDL_GameControllerButtonBind, value.hat.hat) ptr hat
-      (#poke SDL_GameControllerButtonBind, value.hat.hat_mask) ptr hat_mask
-
-data HapticDirection = HapticDirection
-  { hapticDirectionType :: !Word8
-  , hapticDirectionX :: !Int32
-  , hapticDirectionY :: !Int32
-  , hapticDirectionZ :: !Int32
-  } deriving (Eq, Show, Typeable)
-
-instance Storable HapticDirection where
-  sizeOf _ = (#size SDL_HapticDirection)
-  alignment = sizeOf
-  peek ptr = do
-    typ <- (#peek SDL_HapticDirection, type) ptr
-    x <- (#peek SDL_HapticDirection, dir[0]) ptr
-    y <- (#peek SDL_HapticDirection, dir[1]) ptr
-    z <- (#peek SDL_HapticDirection, dir[2]) ptr
-    return $! HapticDirection typ x y z
-  poke ptr (HapticDirection typ x y z) = do
-    (#poke SDL_HapticDirection, type) ptr typ
-    (#poke SDL_HapticDirection, dir[0]) ptr x
-    (#poke SDL_HapticDirection, dir[1]) ptr y
-    (#poke SDL_HapticDirection, dir[2]) 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, Typeable)
-
-instance Storable HapticEffect where
-  sizeOf _ = (#size SDL_HapticEffect)
-  alignment = sizeOf
-  peek ptr = do
-    typ <- (#peek SDL_HapticEffect, type) ptr
-    case typ of
-      (#const SDL_HAPTIC_CONSTANT) -> do
-        direction <- (#peek SDL_HapticEffect, constant.direction) ptr
-        len <- (#peek SDL_HapticEffect, constant.length) ptr
-        delay <- (#peek SDL_HapticEffect, constant.delay) ptr
-        button <- (#peek SDL_HapticEffect, constant.button) ptr
-        interval <- (#peek SDL_HapticEffect, constant.interval) ptr
-        level <- (#peek SDL_HapticEffect, constant.level) ptr
-        attack_length <- (#peek SDL_HapticEffect, constant.attack_length) ptr
-        attack_level <- (#peek SDL_HapticEffect, constant.attack_level) ptr
-        fade_length <- (#peek SDL_HapticEffect, constant.fade_length) ptr
-        fade_level <- (#peek SDL_HapticEffect, constant.fade_level) ptr
-        return $! HapticConstant typ direction len delay button interval level attack_length attack_level fade_length fade_level
-
-      (#const SDL_HAPTIC_SINE) -> hapticperiodic $ HapticPeriodic typ
-      (#const SDL_HAPTIC_TRIANGLE) -> hapticperiodic $ HapticPeriodic typ
-      (#const SDL_HAPTIC_SAWTOOTHUP) -> hapticperiodic $ HapticPeriodic typ
-      (#const SDL_HAPTIC_SAWTOOTHDOWN) -> hapticperiodic $ HapticPeriodic typ
-
-      (#const SDL_HAPTIC_RAMP) -> do
-        direction <- (#peek SDL_HapticEffect, ramp.direction) ptr
-        len <- (#peek SDL_HapticEffect, ramp.length) ptr
-        delay <- (#peek SDL_HapticEffect, ramp.delay) ptr
-        button <- (#peek SDL_HapticEffect, ramp.button) ptr
-        interval <- (#peek SDL_HapticEffect, ramp.interval) ptr
-        start <- (#peek SDL_HapticEffect, ramp.start) ptr
-        end <- (#peek SDL_HapticEffect, ramp.end) ptr
-        attack_length <- (#peek SDL_HapticEffect, ramp.attack_length) ptr
-        attack_level <- (#peek SDL_HapticEffect, ramp.attack_level) ptr
-        fade_length <- (#peek SDL_HapticEffect, ramp.fade_length) ptr
-        fade_level <- (#peek SDL_HapticEffect, ramp.fade_level) ptr
-        return $! HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level
-
-      (#const SDL_HAPTIC_SPRING) -> hapticcondition $ HapticCondition typ
-      (#const SDL_HAPTIC_DAMPER) -> hapticcondition $ HapticCondition typ
-      (#const SDL_HAPTIC_INERTIA) -> hapticcondition $ HapticCondition typ
-      (#const SDL_HAPTIC_FRICTION) -> hapticcondition $ HapticCondition typ
-
-      (#const SDL_HAPTIC_LEFTRIGHT) -> do
-        len <- (#peek SDL_HapticEffect, leftright.length) ptr
-        large_magnitude <- (#peek SDL_HapticEffect, leftright.large_magnitude) ptr
-        small_magnitude <- (#peek SDL_HapticEffect, leftright.small_magnitude) ptr
-        return $! HapticLeftRight typ len large_magnitude small_magnitude
-
-      (#const SDL_HAPTIC_CUSTOM) -> do
-        direction <- (#peek SDL_HapticEffect, custom.direction) ptr
-        len <- (#peek SDL_HapticEffect, custom.length) ptr
-        delay <- (#peek SDL_HapticEffect, custom.delay) ptr
-        button <- (#peek SDL_HapticEffect, custom.button) ptr
-        interval <- (#peek SDL_HapticEffect, custom.interval) ptr
-        channels <- (#peek SDL_HapticEffect, custom.channels) ptr
-        period <- (#peek SDL_HapticEffect, custom.period) ptr
-        samples <- (#peek SDL_HapticEffect, custom.samples) ptr
-        datum <- (#peek SDL_HapticEffect, custom.data) ptr
-        attack_length <- (#peek SDL_HapticEffect, custom.attack_length) ptr
-        attack_level <- (#peek SDL_HapticEffect, custom.attack_level) ptr
-        fade_length <- (#peek SDL_HapticEffect, custom.fade_length) ptr
-        fade_level <- (#peek SDL_HapticEffect, custom.fade_level) 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 <- (#peek SDL_HapticEffect, periodic.direction) ptr
-      len <- (#peek SDL_HapticEffect, periodic.length) ptr
-      delay <- (#peek SDL_HapticEffect, periodic.delay) ptr
-      button <- (#peek SDL_HapticEffect, periodic.button) ptr
-      interval <- (#peek SDL_HapticEffect, periodic.interval) ptr
-      period <- (#peek SDL_HapticEffect, periodic.period) ptr
-      magnitude <- (#peek SDL_HapticEffect, periodic.magnitude) ptr
-      offset <- (#peek SDL_HapticEffect, periodic.offset) ptr
-      phase <- (#peek SDL_HapticEffect, periodic.phase) ptr
-      attack_length <- (#peek SDL_HapticEffect, periodic.attack_length) ptr
-      attack_level <- (#peek SDL_HapticEffect, periodic.attack_level) ptr
-      fade_length <- (#peek SDL_HapticEffect, periodic.fade_length) ptr
-      fade_level <- (#peek SDL_HapticEffect, periodic.fade_level) ptr
-      return $! f direction len delay button interval period magnitude offset phase attack_length attack_level fade_length fade_level
-
-    hapticcondition f = do
-      len <- (#peek SDL_HapticEffect, condition.length) ptr
-      delay <- (#peek SDL_HapticEffect, condition.delay) ptr
-      button <- (#peek SDL_HapticEffect, condition.button) ptr
-      interval <- (#peek SDL_HapticEffect, condition.interval) ptr
-      right_sat <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.right_sat) ptr
-      left_sat <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.left_sat) ptr
-      right_coeff <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.right_coeff) ptr
-      left_coeff <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.left_coeff) ptr
-      deadband <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.deadband) ptr
-      center <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.center) 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
-      (#poke SDL_HapticEffect, type) ptr typ
-      (#poke SDL_HapticEffect, constant.direction) ptr direction
-      (#poke SDL_HapticEffect, constant.length) ptr len
-      (#poke SDL_HapticEffect, constant.delay) ptr delay
-      (#poke SDL_HapticEffect, constant.button) ptr button
-      (#poke SDL_HapticEffect, constant.interval) ptr interval
-      (#poke SDL_HapticEffect, constant.level) ptr level
-      (#poke SDL_HapticEffect, constant.attack_length) ptr attack_length
-      (#poke SDL_HapticEffect, constant.attack_level) ptr attack_level
-      (#poke SDL_HapticEffect, constant.fade_length) ptr fade_length
-      (#poke SDL_HapticEffect, constant.fade_level) ptr fade_level
-    HapticPeriodic typ direction len delay button interval period magnitude offset phase attack_length attack_level fade_length fade_level -> do
-      (#poke SDL_HapticEffect, type) ptr typ
-      (#poke SDL_HapticEffect, periodic.direction) ptr direction
-      (#poke SDL_HapticEffect, periodic.length) ptr len
-      (#poke SDL_HapticEffect, periodic.delay) ptr delay
-      (#poke SDL_HapticEffect, periodic.button) ptr button
-      (#poke SDL_HapticEffect, periodic.interval) ptr interval
-      (#poke SDL_HapticEffect, periodic.period) ptr period
-      (#poke SDL_HapticEffect, periodic.magnitude) ptr magnitude
-      (#poke SDL_HapticEffect, periodic.offset) ptr offset
-      (#poke SDL_HapticEffect, periodic.phase) ptr phase
-      (#poke SDL_HapticEffect, periodic.attack_length) ptr attack_length
-      (#poke SDL_HapticEffect, periodic.attack_level) ptr attack_level
-      (#poke SDL_HapticEffect, periodic.fade_length) ptr fade_length
-      (#poke SDL_HapticEffect, periodic.fade_level) ptr fade_level
-    HapticCondition typ len delay button interval right_sat left_sat right_coeff left_coeff deadband center -> do
-      (#poke SDL_HapticEffect, type) ptr typ
-      (#poke SDL_HapticEffect, condition.length) ptr len
-      (#poke SDL_HapticEffect, condition.delay) ptr delay
-      (#poke SDL_HapticEffect, condition.button) ptr button
-      (#poke SDL_HapticEffect, condition.interval) ptr interval
-      pokeArray ((#ptr SDL_HapticEffect, condition.right_sat) ptr) right_sat
-      pokeArray ((#ptr SDL_HapticEffect, condition.left_sat) ptr) left_sat
-      pokeArray ((#ptr SDL_HapticEffect, condition.right_coeff) ptr) right_coeff
-      pokeArray ((#ptr SDL_HapticEffect, condition.left_coeff) ptr) left_coeff
-      pokeArray ((#ptr SDL_HapticEffect, condition.deadband) ptr) deadband
-      pokeArray ((#ptr SDL_HapticEffect, condition.center) ptr) center
-    HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level -> do
-      (#poke SDL_HapticEffect, type) ptr typ
-      (#poke SDL_HapticEffect, ramp.direction) ptr direction
-      (#poke SDL_HapticEffect, ramp.length) ptr len
-      (#poke SDL_HapticEffect, ramp.delay) ptr delay
-      (#poke SDL_HapticEffect, ramp.button) ptr button
-      (#poke SDL_HapticEffect, ramp.interval) ptr interval
-      (#poke SDL_HapticEffect, ramp.start) ptr start
-      (#poke SDL_HapticEffect, ramp.end) ptr end
-      (#poke SDL_HapticEffect, ramp.attack_length) ptr attack_length
-      (#poke SDL_HapticEffect, ramp.attack_level) ptr attack_level
-      (#poke SDL_HapticEffect, ramp.fade_length) ptr fade_length
-      (#poke SDL_HapticEffect, ramp.fade_level) ptr fade_level
-    HapticLeftRight typ len large_magnitude small_magnitude -> do
-      (#poke SDL_HapticEffect, type) ptr typ
-      (#poke SDL_HapticEffect, leftright.length) ptr len
-      (#poke SDL_HapticEffect, leftright.large_magnitude) ptr large_magnitude
-      (#poke SDL_HapticEffect, leftright.small_magnitude) ptr small_magnitude
-    HapticCustom typ direction len delay button interval channels period samples datum attack_length attack_level fade_length fade_level -> do
-      (#poke SDL_HapticEffect, type) ptr typ
-      (#poke SDL_HapticEffect, custom.direction) ptr direction
-      (#poke SDL_HapticEffect, custom.length) ptr len
-      (#poke SDL_HapticEffect, custom.delay) ptr delay
-      (#poke SDL_HapticEffect, custom.button) ptr button
-      (#poke SDL_HapticEffect, custom.interval) ptr interval
-      (#poke SDL_HapticEffect, custom.channels) ptr channels
-      (#poke SDL_HapticEffect, custom.period) ptr period
-      (#poke SDL_HapticEffect, custom.samples) ptr samples
-      (#poke SDL_HapticEffect, custom.data) ptr datum
-      (#poke SDL_HapticEffect, custom.attack_length) ptr attack_length
-      (#poke SDL_HapticEffect, custom.attack_level) ptr attack_level
-      (#poke SDL_HapticEffect, custom.fade_length) ptr fade_length
-      (#poke SDL_HapticEffect, custom.fade_level) ptr fade_level
-
-data JoystickGUID = JoystickGUID
-  { joystickGUID :: ![Word8]
-  } deriving (Eq, Show, Typeable)
-
-instance Storable JoystickGUID where
-  sizeOf _ = (#size SDL_JoystickGUID)
-  alignment = sizeOf
-  peek ptr = do
-    guid <- peekArray 16 $ (#ptr SDL_JoystickGUID, data) ptr
-    return $! JoystickGUID guid
-  poke ptr (JoystickGUID guid) =
-    pokeArray ((#ptr SDL_JoystickGUID, data) ptr) guid
-
-data Keysym = Keysym
-  { keysymScancode :: !Scancode
-  , keysymKeycode :: !Keycode
-  , keysymMod :: !Word16
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Keysym where
-  sizeOf _ = (#size SDL_Keysym)
-  alignment = sizeOf
-  peek ptr = do
-    scancode <- (#peek SDL_Keysym, scancode) ptr
-    sym <- (#peek SDL_Keysym, sym) ptr
-    mod' <- (#peek SDL_Keysym, mod) ptr
-    return $! Keysym scancode sym mod'
-  poke ptr (Keysym scancode sym mod') = do
-    (#poke SDL_Keysym, scancode) ptr scancode
-    (#poke SDL_Keysym, sym) ptr sym
-    (#poke SDL_Keysym, mod) ptr mod'
-
-data MessageBoxButtonData = MessageBoxButtonData
-  { messageBoxButtonDataFlags :: !Word32
-  , messageBoxButtonButtonID :: !CInt
-  , messageBoxButtonText :: !CString
-  } deriving (Eq, Show, Typeable)
-
-instance Storable MessageBoxButtonData where
-  sizeOf _ = (#size SDL_MessageBoxButtonData)
-  alignment = sizeOf
-  peek ptr = do
-    flags <- (#peek SDL_MessageBoxButtonData, flags) ptr
-    buttonid <- (#peek SDL_MessageBoxButtonData, buttonid) ptr
-    text <- (#peek SDL_MessageBoxButtonData, text) ptr
-    return $! MessageBoxButtonData flags buttonid text
-  poke ptr (MessageBoxButtonData flags buttonid text) = do
-    (#poke SDL_MessageBoxButtonData, flags) ptr flags
-    (#poke SDL_MessageBoxButtonData, buttonid) ptr buttonid
-    (#poke SDL_MessageBoxButtonData, text) ptr text
-
-data MessageBoxColor = MessageBoxColor
-  { messageBoxColorR :: !Word8
-  , messageBoxColorG :: !Word8
-  , messageBoxColorB :: !Word8
-  } deriving (Eq, Show, Typeable)
-
-instance Storable MessageBoxColor where
-  sizeOf _ = (#size SDL_MessageBoxColor)
-  alignment = sizeOf
-  peek ptr = do
-    r <- (#peek SDL_MessageBoxColor, r) ptr
-    g <- (#peek SDL_MessageBoxColor, g) ptr
-    b <- (#peek SDL_MessageBoxColor, b) ptr
-    return $! MessageBoxColor r g b
-  poke ptr (MessageBoxColor r g b) = do
-    (#poke SDL_MessageBoxColor, r) ptr r
-    (#poke SDL_MessageBoxColor, g) ptr g
-    (#poke SDL_MessageBoxColor, b) ptr b
-
-data MessageBoxColorScheme = MessageBoxColorScheme
-  { messageBoxColorSchemeColorBackground :: !MessageBoxColor
-  , messageBoxColorSchemeColorText :: !MessageBoxColor
-  , messageBoxColorSchemeColorButtonBorder :: !MessageBoxColor
-  , messageBoxColorSchemeColorButtonBackground :: !MessageBoxColor
-  , messageBoxColorSchemeColorButtonSelected :: !MessageBoxColor
-  } deriving (Eq, Show, Typeable)
-
-instance Storable MessageBoxColorScheme where
-  sizeOf _ = (#size SDL_MessageBoxColorScheme)
-  alignment = sizeOf
-  peek ptr = do
-    background <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BACKGROUND]) ptr
-    text <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_TEXT]) ptr
-    button_border <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER]) ptr
-    button_background <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND]) ptr
-    button_selected <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED]) ptr
-    return $! MessageBoxColorScheme background text button_border button_background button_selected
-  poke ptr (MessageBoxColorScheme background text button_border button_background button_selected) = do
-    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BACKGROUND]) ptr background
-    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_TEXT]) ptr text
-    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER]) ptr button_border
-    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND]) ptr button_background
-    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED]) 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, Typeable)
-
-instance Storable MessageBoxData where
-  sizeOf _ = (#size SDL_MessageBoxData)
-  alignment = sizeOf
-  peek ptr = do
-    flags <- (#peek SDL_MessageBoxData, flags) ptr
-    window <- (#peek SDL_MessageBoxData, window) ptr
-    title <- (#peek SDL_MessageBoxData, title) ptr
-    message <- (#peek SDL_MessageBoxData, message) ptr
-    numbuttons <- (#peek SDL_MessageBoxData, numbuttons) ptr
-    buttons <- (#peek SDL_MessageBoxData, buttons) ptr
-    color_scheme <- (#peek SDL_MessageBoxData, colorScheme) ptr
-    return $! MessageBoxData flags window title message numbuttons buttons color_scheme
-  poke ptr (MessageBoxData flags window title message numbuttons buttons color_scheme) = do
-    (#poke SDL_MessageBoxData, flags) ptr flags
-    (#poke SDL_MessageBoxData, window) ptr window
-    (#poke SDL_MessageBoxData, title) ptr title
-    (#poke SDL_MessageBoxData, message) ptr message
-    (#poke SDL_MessageBoxData, numbuttons) ptr numbuttons
-    (#poke SDL_MessageBoxData, buttons) ptr buttons
-    (#poke SDL_MessageBoxData, colorScheme) ptr color_scheme
-
-data Palette = Palette
-  { paletteNColors :: !CInt
-  , paletteColors :: !(Ptr Color)
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Palette where
-  sizeOf _ = (#size SDL_Palette)
-  alignment = sizeOf
-  peek ptr = do
-    ncolors <- (#peek SDL_Palette, ncolors) ptr
-    colors <- (#peek SDL_Palette, colors) ptr
-    return $! Palette ncolors colors
-  poke ptr (Palette ncolors colors) = do
-    (#poke SDL_Palette, ncolors) ptr ncolors
-    (#poke SDL_Palette, colors) 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, Typeable)
-
-instance Storable PixelFormat where
-  sizeOf _ = (#size SDL_PixelFormat)
-  alignment = sizeOf
-  peek ptr = do
-    format <- (#peek SDL_PixelFormat, format) ptr
-    palette <- (#peek SDL_PixelFormat, palette) ptr
-    bits_per_pixel <- (#peek SDL_PixelFormat, BitsPerPixel) ptr
-    bytes_per_pixel <- (#peek SDL_PixelFormat, BytesPerPixel) ptr
-    rmask <- (#peek SDL_PixelFormat, Rmask) ptr
-    gmask <- (#peek SDL_PixelFormat, Gmask) ptr
-    bmask <- (#peek SDL_PixelFormat, Bmask) ptr
-    amask <- (#peek SDL_PixelFormat, Amask) 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
-    (#poke SDL_PixelFormat, format) ptr format
-    (#poke SDL_PixelFormat, palette) ptr palette
-    (#poke SDL_PixelFormat, BitsPerPixel) ptr bits_per_pixel
-    (#poke SDL_PixelFormat, BytesPerPixel) ptr bytes_per_pixel
-    (#poke SDL_PixelFormat, Rmask) ptr rmask
-    (#poke SDL_PixelFormat, Gmask) ptr gmask
-    (#poke SDL_PixelFormat, Bmask) ptr bmask
-    (#poke SDL_PixelFormat, Amask) ptr amask
-
-data Point = Point
-  { pointX :: !CInt
-  , pointY :: !CInt
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Point where
-  sizeOf _ = (#size SDL_Point)
-  alignment = sizeOf
-  peek ptr = do
-    x <- (#peek SDL_Point, x) ptr
-    y <- (#peek SDL_Point, y) ptr
-    return $! Point x y
-  poke ptr (Point x y) = do
-    (#poke SDL_Point, x) ptr x
-    (#poke SDL_Point, y) ptr y
-
-data Rect = Rect
-  { rectX :: !CInt
-  , rectY :: !CInt
-  , rectW :: !CInt
-  , rectH :: !CInt
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Rect where
-  sizeOf _ = (#size SDL_Rect)
-  alignment = sizeOf
-  peek ptr = do
-    x <- (#peek SDL_Rect, x) ptr
-    y <- (#peek SDL_Rect, y) ptr
-    w <- (#peek SDL_Rect, w) ptr
-    h <- (#peek SDL_Rect, h) ptr
-    return $! Rect x y w h
-  poke ptr (Rect x y w h) = do
-    (#poke SDL_Rect, x) ptr x
-    (#poke SDL_Rect, y) ptr y
-    (#poke SDL_Rect, w) ptr w
-    (#poke SDL_Rect, h) ptr h
-
-data RendererInfo = RendererInfo
-  { rendererInfoName :: !CString
-  , rendererInfoFlags :: !Word32
-  , rendererInfoNumTextureFormats :: !Word32
-  , rendererInfoTextureFormats :: ![Word32]
-  , rendererInfoMaxTextureWidth :: !CInt
-  , rendererInfoMaxTextureHeight :: !CInt
-  } deriving (Eq, Show, Typeable)
-
-instance Storable RendererInfo where
-  sizeOf _ = (#size SDL_RendererInfo)
-  alignment = sizeOf
-  peek ptr = do
-    name <- (#peek SDL_RendererInfo, name) ptr
-    flags <- (#peek SDL_RendererInfo, flags) ptr
-    num_texture_formats <- (#peek SDL_RendererInfo, num_texture_formats) ptr
-    texture_formats <- peekArray 16 $ (#ptr SDL_RendererInfo, texture_formats) ptr
-    max_texture_width <- (#peek SDL_RendererInfo, max_texture_width) ptr
-    max_texture_height <- (#peek SDL_RendererInfo, max_texture_height) 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
-    (#poke SDL_RendererInfo, name) ptr name
-    (#poke SDL_RendererInfo, flags) ptr flags
-    (#poke SDL_RendererInfo, num_texture_formats) ptr num_texture_formats
-    pokeArray ((#ptr SDL_RendererInfo, texture_formats) ptr) texture_formats
-    (#poke SDL_RendererInfo, max_texture_width) ptr max_texture_width
-    (#poke SDL_RendererInfo, max_texture_height) 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, Typeable)
-
-instance Storable RWops where
-  sizeOf _ = (#size SDL_RWops)
-  alignment = sizeOf
-  peek ptr = do
-    size <- (#peek SDL_RWops, size) ptr
-    seek <- (#peek SDL_RWops, seek) ptr
-    read' <- (#peek SDL_RWops, read) ptr
-    write <- (#peek SDL_RWops, write) ptr
-    close <- (#peek SDL_RWops, close) ptr
-    typ <- (#peek SDL_RWops, type) ptr
-    return $! RWops size seek read' write close typ
-  poke ptr (RWops size seek read' write close typ) = do
-    (#poke SDL_RWops, size) ptr size
-    (#poke SDL_RWops, seek) ptr seek
-    (#poke SDL_RWops, read) ptr read'
-    (#poke SDL_RWops, write) ptr write
-    (#poke SDL_RWops, close) ptr close
-    (#poke SDL_RWops, type) ptr typ
-
-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 _ = (#size SDL_Surface)
-  alignment = sizeOf
-  peek ptr = do
-    format <- (#peek SDL_Surface, format) ptr
-    w <- (#peek SDL_Surface, w) ptr
-    h <- (#peek SDL_Surface, h) ptr
-    pixels <- (#peek SDL_Surface, pixels) ptr
-    userdata <- (#peek SDL_Surface, userdata) ptr
-    cliprect <- (#peek SDL_Surface, clip_rect) ptr
-    refcount <- (#peek SDL_Surface, refcount) ptr
-    return $! Surface format w h pixels userdata cliprect refcount
-  poke ptr (Surface format w h pixels userdata cliprect refcount) = do
-    (#poke SDL_Surface, format) ptr format
-    (#poke SDL_Surface, w) ptr w
-    (#poke SDL_Surface, h) ptr h
-    (#poke SDL_Surface, pixels) ptr pixels
-    (#poke SDL_Surface, userdata) ptr userdata
-    (#poke SDL_Surface, clip_rect) ptr cliprect
-    (#poke SDL_Surface, refcount) ptr refcount
-
-data Version = Version
-  { versionMajor :: !Word8
-  , versionMinor :: !Word8
-  , versionPatch :: !Word8
-  } deriving (Eq, Show, Typeable)
-
-instance Storable Version where
-  sizeOf _ = (#size SDL_version)
-  alignment = sizeOf
-  peek ptr = do
-    major <- (#peek SDL_version, major) ptr
-    minor <- (#peek SDL_version, minor) ptr
-    patch <- (#peek SDL_version, patch) ptr
-    return $! Version major minor patch
-  poke ptr (Version major minor patch) = do
-    (#poke SDL_version, major) ptr major
-    (#poke SDL_version, minor) ptr minor
-    (#poke SDL_version, patch) ptr patch
+{-# LANGUAGE DeriveDataTypeable #-}+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++#include "SDL.h"++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 _ = (#size SDL_atomic_t)+  alignment = sizeOf+  peek ptr = do+    value <- (#peek SDL_atomic_t, value) ptr+    return $! Atomic value+  poke ptr (Atomic value) = do+    (#poke SDL_atomic_t, value) 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, Typeable)++instance Storable AudioCVT where+  sizeOf _ = (#size SDL_AudioCVT)+  alignment = sizeOf+  peek ptr = do+    needed <- (#peek SDL_AudioCVT, needed) ptr+    src_format <- (#peek SDL_AudioCVT, src_format) ptr+    dst_format <- (#peek SDL_AudioCVT, dst_format) ptr+    rate_incr <- (#peek SDL_AudioCVT, rate_incr) ptr+    buf <- (#peek SDL_AudioCVT, buf) ptr+    len <- (#peek SDL_AudioCVT, len) ptr+    len_cvt <- (#peek SDL_AudioCVT, len_cvt) ptr+    len_mult <- (#peek SDL_AudioCVT, len_mult) ptr+    len_ratio <- (#peek SDL_AudioCVT, len_ratio) 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+    (#poke SDL_AudioCVT, needed) ptr needed+    (#poke SDL_AudioCVT, src_format) ptr src_format+    (#poke SDL_AudioCVT, dst_format) ptr dst_format+    (#poke SDL_AudioCVT, rate_incr) ptr rate_incr+    (#poke SDL_AudioCVT, buf) ptr buf+    (#poke SDL_AudioCVT, len) ptr len+    (#poke SDL_AudioCVT, len_cvt) ptr len_cvt+    (#poke SDL_AudioCVT, len_mult) ptr len_mult+    (#poke SDL_AudioCVT, len_ratio) 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, Typeable)++instance Storable AudioSpec where+  sizeOf _ = (#size SDL_AudioSpec)+  alignment = sizeOf+  peek ptr = do+    freq <- (#peek SDL_AudioSpec, freq) ptr+    format <- (#peek SDL_AudioSpec, format) ptr+    channels <- (#peek SDL_AudioSpec, channels) ptr+    silence <- (#peek SDL_AudioSpec, silence) ptr+    samples <- (#peek SDL_AudioSpec, samples) ptr+    size <- (#peek SDL_AudioSpec, size) ptr+    callback <- (#peek SDL_AudioSpec, callback) ptr+    userdata <- (#peek SDL_AudioSpec, userdata) ptr+    return $! AudioSpec freq format channels silence samples size callback userdata+  poke ptr (AudioSpec freq format channels silence samples size callback userdata) = do+    (#poke SDL_AudioSpec, freq) ptr freq+    (#poke SDL_AudioSpec, format) ptr format+    (#poke SDL_AudioSpec, channels) ptr channels+    (#poke SDL_AudioSpec, silence) ptr silence+    (#poke SDL_AudioSpec, samples) ptr samples+    (#poke SDL_AudioSpec, size) ptr size+    (#poke SDL_AudioSpec, callback) ptr callback+    (#poke SDL_AudioSpec, userdata) ptr userdata++data Color = Color+  { colorR :: !Word8+  , colorG :: !Word8+  , colorB :: !Word8+  , colorA :: !Word8+  } deriving (Eq, Show, Typeable)++instance Storable Color where+  sizeOf _ = (#size SDL_Color)+  alignment = sizeOf+  peek ptr = do+    r <- (#peek SDL_Color, r) ptr+    g <- (#peek SDL_Color, g) ptr+    b <- (#peek SDL_Color, b) ptr+    a <- (#peek SDL_Color, a) ptr+    return $! Color r g b a+  poke ptr (Color r g b a) = do+    (#poke SDL_Color, r) ptr r+    (#poke SDL_Color, g) ptr g+    (#poke SDL_Color, b) ptr b+    (#poke SDL_Color, a) ptr a++data DisplayMode = DisplayMode+  { displayModeFormat :: !Word32+  , displayModeW :: !CInt+  , displayModeH :: !CInt+  , displayModeRefreshRate :: !CInt+  , displayModeDriverData :: !(Ptr ())+  } deriving (Eq, Show, Typeable)++instance Storable DisplayMode where+  sizeOf _ = (#size SDL_DisplayMode)+  alignment = sizeOf+  peek ptr = do+    format <- (#peek SDL_DisplayMode, format) ptr+    w <- (#peek SDL_DisplayMode, w) ptr+    h <- (#peek SDL_DisplayMode, h) ptr+    refresh_rate <- (#peek SDL_DisplayMode, refresh_rate) ptr+    driverdata <- (#peek SDL_DisplayMode, driverdata) ptr+    return $! DisplayMode format w h refresh_rate driverdata+  poke ptr (DisplayMode format w h refresh_rate driverdata) = do+    (#poke SDL_DisplayMode, format) ptr format+    (#poke SDL_DisplayMode, w) ptr w+    (#poke SDL_DisplayMode, h) ptr h+    (#poke SDL_DisplayMode, refresh_rate) ptr refresh_rate+    (#poke SDL_DisplayMode, driverdata) 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]+    }+  | 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 _ = (#size SDL_Event)+  alignment = sizeOf+  peek ptr = do+    typ <- (#peek SDL_Event, common.type) ptr+    timestamp <- (#peek SDL_Event, common.timestamp) ptr+    case typ of+      (#const SDL_QUIT) ->+        return $! QuitEvent typ timestamp+      (#const SDL_WINDOWEVENT) -> do+        wid <- (#peek SDL_Event, window.windowID) ptr+        event <- (#peek SDL_Event, window.event) ptr+        data1 <- (#peek SDL_Event, window.data1) ptr+        data2 <- (#peek SDL_Event, window.data2) ptr+        return $! WindowEvent typ timestamp wid event data1 data2+      (#const SDL_SYSWMEVENT) -> do+        msg <- (#peek SDL_Event, syswm.msg) ptr+        return $! SysWMEvent typ timestamp msg+      (#const SDL_KEYDOWN) -> key $ KeyboardEvent typ timestamp+      (#const SDL_KEYUP) -> key $ KeyboardEvent typ timestamp+      (#const SDL_TEXTEDITING) -> do+        wid <- (#peek SDL_Event, edit.windowID) ptr+        text <- peekArray (#const SDL_TEXTEDITINGEVENT_TEXT_SIZE) $ (#ptr SDL_Event, edit.text) ptr+        start <- (#peek SDL_Event, edit.start) ptr+        len <- (#peek SDL_Event, edit.length) ptr+        let upToNull = takeWhile (/= 0) text+        return $! TextEditingEvent typ timestamp wid upToNull start len+      (#const SDL_TEXTINPUT) -> do+        wid <- (#peek SDL_Event, text.windowID) ptr+        text <- peekArray (#const SDL_TEXTINPUTEVENT_TEXT_SIZE) $ (#ptr SDL_Event, text.text) ptr+        let upToNull = takeWhile (/= 0) text+        return $! TextInputEvent typ timestamp wid upToNull+      (#const SDL_KEYMAPCHANGED) ->+        return $! KeymapChangedEvent typ timestamp+      (#const SDL_MOUSEMOTION) -> do+        wid <- (#peek SDL_Event, motion.windowID) ptr+        which <- (#peek SDL_Event, motion.which) ptr+        state <- (#peek SDL_Event, motion.state) ptr+        x <- (#peek SDL_Event, motion.x) ptr+        y <- (#peek SDL_Event, motion.y) ptr+        xrel <- (#peek SDL_Event, motion.xrel) ptr+        yrel <- (#peek SDL_Event, motion.yrel) ptr+        return $! MouseMotionEvent typ timestamp wid which state x y xrel yrel+      (#const SDL_MOUSEBUTTONDOWN) -> mouse $ MouseButtonEvent typ timestamp+      (#const SDL_MOUSEBUTTONUP) -> mouse $ MouseButtonEvent typ timestamp+      (#const SDL_MOUSEWHEEL) -> do+        wid <- (#peek SDL_Event, wheel.windowID) ptr+        which <- (#peek SDL_Event, wheel.which) ptr+        x <- (#peek SDL_Event, wheel.x) ptr+        y <- (#peek SDL_Event, wheel.y) ptr+        direction <- (#peek SDL_Event, wheel.direction) ptr+        return $! MouseWheelEvent typ timestamp wid which x y direction+      (#const SDL_JOYAXISMOTION) -> do+        which <- (#peek SDL_Event, jaxis.which) ptr+        axis <- (#peek SDL_Event, jaxis.axis) ptr+        value <- (#peek SDL_Event, jaxis.value) ptr+        return $! JoyAxisEvent typ timestamp which axis value+      (#const SDL_JOYBALLMOTION) -> do+        which <- (#peek SDL_Event, jball.which) ptr+        ball <- (#peek SDL_Event, jball.ball) ptr+        xrel <- (#peek SDL_Event, jball.xrel) ptr+        yrel <- (#peek SDL_Event, jball.yrel) ptr+        return $! JoyBallEvent typ timestamp which ball xrel yrel+      (#const SDL_JOYHATMOTION) -> do+        which <- (#peek SDL_Event, jhat.which) ptr+        hat <- (#peek SDL_Event, jhat.hat) ptr+        value <- (#peek SDL_Event, jhat.value) ptr+        return $! JoyHatEvent typ timestamp which hat value+      (#const SDL_JOYBUTTONDOWN) -> joybutton $ JoyButtonEvent typ timestamp+      (#const SDL_JOYBUTTONUP) -> joybutton $ JoyButtonEvent typ timestamp+      (#const SDL_JOYDEVICEADDED) -> joydevice $ JoyDeviceEvent typ timestamp+      (#const SDL_JOYDEVICEREMOVED) -> joydevice $ JoyDeviceEvent typ timestamp+      (#const SDL_CONTROLLERAXISMOTION) -> do+        which <- (#peek SDL_Event, caxis.which) ptr+        axis <- (#peek SDL_Event, caxis.axis) ptr+        value <- (#peek SDL_Event, caxis.value) ptr+        return $! ControllerButtonEvent typ timestamp which axis value+      (#const SDL_CONTROLLERBUTTONDOWN) -> controllerbutton $ ControllerButtonEvent typ timestamp+      (#const SDL_CONTROLLERBUTTONUP) -> controllerbutton $ ControllerButtonEvent typ timestamp+      (#const SDL_CONTROLLERDEVICEADDED) -> controllerdevice $ ControllerDeviceEvent typ timestamp+      (#const SDL_CONTROLLERDEVICEREMOVED) -> controllerdevice $ ControllerDeviceEvent typ timestamp+      (#const SDL_CONTROLLERDEVICEREMAPPED) -> controllerdevice $ ControllerDeviceEvent typ timestamp+      (#const SDL_AUDIODEVICEADDED) -> audiodevice $ AudioDeviceEvent typ timestamp+      (#const SDL_AUDIODEVICEREMOVED) -> audiodevice $ AudioDeviceEvent typ timestamp+      (#const SDL_FINGERDOWN) -> finger $ TouchFingerEvent typ timestamp+      (#const SDL_FINGERUP) -> finger $ TouchFingerEvent typ timestamp+      (#const SDL_FINGERMOTION) -> finger $ TouchFingerEvent typ timestamp+      (#const SDL_DOLLARGESTURE) -> dollargesture $ DollarGestureEvent typ timestamp+      (#const SDL_DOLLARRECORD) -> dollargesture $ DollarGestureEvent typ timestamp+      (#const SDL_MULTIGESTURE) -> do+        touchId <- (#peek SDL_Event, mgesture.touchId) ptr+        dTheta <- (#peek SDL_Event, mgesture.dTheta) ptr+        dDist <- (#peek SDL_Event, mgesture.dDist) ptr+        x <- (#peek SDL_Event, mgesture.x) ptr+        y <- (#peek SDL_Event, mgesture.y) ptr+        numFingers <- (#peek SDL_Event, mgesture.numFingers) ptr+        return $! MultiGestureEvent typ timestamp touchId dTheta dDist x y numFingers+      (#const SDL_CLIPBOARDUPDATE) ->+        return $! ClipboardUpdateEvent typ timestamp+      (#const SDL_DROPFILE) -> do+        file <- (#peek SDL_Event, drop.file) ptr+        return $! DropEvent typ timestamp file+      x | x >= (#const SDL_USEREVENT) -> do+        wid <- (#peek SDL_Event, user.windowID) ptr+        code <- (#peek SDL_Event, user.code) ptr+        data1 <- (#peek SDL_Event, user.data1) ptr+        data2 <- (#peek SDL_Event, user.data2) ptr+        return $! UserEvent typ timestamp wid code data1 data2+      _ -> return $! UnknownEvent typ timestamp+    where+    key f = do+      wid <- (#peek SDL_Event, key.windowID) ptr+      state <- (#peek SDL_Event, key.state) ptr+      repeat' <- (#peek SDL_Event, key.repeat) ptr+      keysym <- (#peek SDL_Event, key.keysym) ptr+      return $! f wid state repeat' keysym++    mouse f = do+      wid <- (#peek SDL_Event, button.windowID) ptr+      which <- (#peek SDL_Event, button.which) ptr+      button <- (#peek SDL_Event, button.button) ptr+      state <- (#peek SDL_Event, button.state) ptr+      clicks <- (#peek SDL_Event, button.clicks) ptr+      x <- (#peek SDL_Event, button.x) ptr+      y <- (#peek SDL_Event, button.y) ptr+      return $! f wid which button state clicks x y++    joybutton f = do+      which <- (#peek SDL_Event, jbutton.which) ptr+      button <- (#peek SDL_Event, jbutton.button) ptr+      state <- (#peek SDL_Event, jbutton.state) ptr+      return $! f which button state++    joydevice f = do+      which <- (#peek SDL_Event, jdevice.which) ptr+      return $! f which++    controllerbutton f = do+      which <- (#peek SDL_Event, cbutton.which) ptr+      button <- (#peek SDL_Event, cbutton.button) ptr+      state <- (#peek SDL_Event, cbutton.state) ptr+      return $! f which button state++    controllerdevice f = do+      which <- (#peek SDL_Event, cdevice.which) ptr+      return $! f which++    audiodevice f = do+      which <- (#peek SDL_Event, adevice.which) ptr+      iscapture <- (#peek SDL_Event, adevice.iscapture) ptr+      return $! f which iscapture++    finger f = do+      touchId <- (#peek SDL_Event, tfinger.touchId) ptr+      fingerId <- (#peek SDL_Event, tfinger.fingerId) ptr+      x <- (#peek SDL_Event, tfinger.x) ptr+      y <- (#peek SDL_Event, tfinger.y) ptr+      dx <- (#peek SDL_Event, tfinger.dx) ptr+      dy <- (#peek SDL_Event, tfinger.dy) ptr+      pressure <- (#peek SDL_Event, tfinger.pressure) ptr+      return $! f touchId fingerId x y dx dy pressure++    dollargesture f = do+      touchId <- (#peek SDL_Event, dgesture.touchId) ptr+      gestureId <- (#peek SDL_Event, dgesture.gestureId) ptr+      numFingers <- (#peek SDL_Event, dgesture.numFingers) ptr+      err <- (#peek SDL_Event, dgesture.error) ptr+      x <- (#peek SDL_Event, dgesture.x) ptr+      y <- (#peek SDL_Event, dgesture.y) ptr+      return $! f touchId gestureId numFingers err x y+  poke ptr ev = case ev of+    WindowEvent typ timestamp wid event data1 data2 -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, window.windowID) ptr wid+      (#poke SDL_Event, window.event) ptr event+      (#poke SDL_Event, window.data1) ptr data1+      (#poke SDL_Event, window.data2) ptr data2+    KeyboardEvent typ timestamp wid state repeat' keysym -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, key.windowID) ptr wid+      (#poke SDL_Event, key.state) ptr state+      (#poke SDL_Event, key.repeat) ptr repeat'+      (#poke SDL_Event, key.keysym) ptr keysym+    TextEditingEvent typ timestamp wid text start len -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, edit.windowID) ptr wid+      pokeArray ((#ptr SDL_Event, edit.text) ptr) text+      (#poke SDL_Event, edit.start) ptr start+      (#poke SDL_Event, edit.length) ptr len+    TextInputEvent typ timestamp wid text -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, text.windowID) ptr wid+      pokeArray ((#ptr SDL_Event, text.text) ptr) text+    KeymapChangedEvent typ timestamp -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+    MouseMotionEvent typ timestamp wid which state x y xrel yrel -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, motion.windowID) ptr wid+      (#poke SDL_Event, motion.which) ptr which+      (#poke SDL_Event, motion.state) ptr state+      (#poke SDL_Event, motion.x) ptr x+      (#poke SDL_Event, motion.y) ptr y+      (#poke SDL_Event, motion.xrel) ptr xrel+      (#poke SDL_Event, motion.yrel) ptr yrel+    MouseButtonEvent typ timestamp wid which button state clicks x y -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, button.windowID) ptr wid+      (#poke SDL_Event, button.which) ptr which+      (#poke SDL_Event, button.button) ptr button+      (#poke SDL_Event, button.state) ptr state+      (#poke SDL_Event, button.clicks) ptr clicks+      (#poke SDL_Event, button.x) ptr x+      (#poke SDL_Event, button.y) ptr y+    MouseWheelEvent typ timestamp wid which x y direction -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, wheel.windowID) ptr wid+      (#poke SDL_Event, wheel.which) ptr which+      (#poke SDL_Event, wheel.x) ptr x+      (#poke SDL_Event, wheel.y) ptr y+      (#poke SDL_Event, wheel.direction) ptr direction+    JoyAxisEvent typ timestamp which axis value -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, jaxis.which) ptr which+      (#poke SDL_Event, jaxis.axis) ptr axis+      (#poke SDL_Event, jaxis.value) ptr value+    JoyBallEvent typ timestamp which ball xrel yrel -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, jball.which) ptr which+      (#poke SDL_Event, jball.ball) ptr ball+      (#poke SDL_Event, jball.xrel) ptr xrel+      (#poke SDL_Event, jball.yrel) ptr yrel+    JoyHatEvent typ timestamp which hat value -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, jhat.which) ptr which+      (#poke SDL_Event, jhat.hat) ptr hat+      (#poke SDL_Event, jhat.value) ptr value+    JoyButtonEvent typ timestamp which button state -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, jbutton.which) ptr which+      (#poke SDL_Event, jbutton.button) ptr button+      (#poke SDL_Event, jbutton.state) ptr state+    JoyDeviceEvent typ timestamp which -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, jdevice.which) ptr which+    ControllerAxisEvent typ timestamp which axis value -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, caxis.which) ptr which+      (#poke SDL_Event, caxis.axis) ptr axis+      (#poke SDL_Event, caxis.value) ptr value+    ControllerButtonEvent typ timestamp which button state -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, cbutton.which) ptr which+      (#poke SDL_Event, cbutton.button) ptr button+      (#poke SDL_Event, cbutton.state) ptr state+    ControllerDeviceEvent typ timestamp which -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, cdevice.which) ptr which+    AudioDeviceEvent typ timestamp which iscapture -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, adevice.which) ptr which+      (#poke SDL_Event, adevice.iscapture) ptr iscapture+    QuitEvent typ timestamp -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+    UserEvent typ timestamp wid code data1 data2 -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, user.windowID) ptr wid+      (#poke SDL_Event, user.code) ptr code+      (#poke SDL_Event, user.data1) ptr data1+      (#poke SDL_Event, user.data2) ptr data2+    SysWMEvent typ timestamp msg -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, syswm.msg) ptr msg+    TouchFingerEvent typ timestamp touchid fingerid x y dx dy pressure -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, tfinger.touchId) ptr touchid+      (#poke SDL_Event, tfinger.fingerId) ptr fingerid+      (#poke SDL_Event, tfinger.x) ptr x+      (#poke SDL_Event, tfinger.y) ptr y+      (#poke SDL_Event, tfinger.dx) ptr dx+      (#poke SDL_Event, tfinger.dy) ptr dy+      (#poke SDL_Event, tfinger.pressure) ptr pressure+    MultiGestureEvent typ timestamp touchid dtheta ddist x y numfingers -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, mgesture.touchId) ptr touchid+      (#poke SDL_Event, mgesture.dTheta) ptr dtheta+      (#poke SDL_Event, mgesture.dDist) ptr ddist+      (#poke SDL_Event, mgesture.x) ptr x+      (#poke SDL_Event, mgesture.y) ptr y+      (#poke SDL_Event, mgesture.numFingers) ptr numfingers+    DollarGestureEvent typ timestamp touchid gestureid numfingers err x y -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, dgesture.touchId) ptr touchid+      (#poke SDL_Event, dgesture.gestureId) ptr gestureid+      (#poke SDL_Event, dgesture.numFingers) ptr numfingers+      (#poke SDL_Event, dgesture.error) ptr err+      (#poke SDL_Event, dgesture.x) ptr x+      (#poke SDL_Event, dgesture.y) ptr y+    ClipboardUpdateEvent typ timestamp -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+    DropEvent typ timestamp file -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp+      (#poke SDL_Event, drop.file) ptr file+    UnknownEvent typ timestamp -> do+      (#poke SDL_Event, common.type) ptr typ+      (#poke SDL_Event, common.timestamp) ptr timestamp++data Finger = Finger+  { fingerID :: !FingerID+  , fingerX :: !CFloat+  , fingerY :: !CFloat+  , fingerPressure :: !CFloat+  } deriving (Eq, Show, Typeable)++instance Storable Finger where+  sizeOf _ = (#size SDL_Finger)+  alignment = sizeOf+  peek ptr = do+    fingerId <- (#peek SDL_Finger, id) ptr+    x <- (#peek SDL_Finger, x) ptr+    y <- (#peek SDL_Finger, y) ptr+    pressure <- (#peek SDL_Finger, pressure) ptr+    return $! Finger fingerId x y pressure+  poke ptr (Finger fingerId x y pressure) = do+    (#poke SDL_Finger, id) ptr fingerId+    (#poke SDL_Finger, x) ptr x+    (#poke SDL_Finger, y) ptr y+    (#poke SDL_Finger, pressure) ptr pressure++data GameControllerButtonBind+  = GameControllerButtonBindNone+  | GameControllerButtonBindButton+    { gameControllerButtonBindButton :: !CInt+    }+  | GameControllerButtonBindAxis+    { gameControllerButtonBindAxis :: !CInt+    }+  | GameControllerButtonBindHat+    { gameControllerButtonBindHat :: !CInt+    , gameControllerButtonBindHatMask :: !CInt+    }+  deriving (Eq, Show, Typeable)++instance Storable GameControllerButtonBind where+  sizeOf _ = (#size SDL_GameControllerButtonBind)+  alignment = sizeOf+  peek ptr = do+    bind_type <- (#peek SDL_GameControllerButtonBind, bindType) ptr+    case bind_type :: (#type SDL_GameControllerBindType) of+      (#const SDL_CONTROLLER_BINDTYPE_NONE) -> do+        return $! GameControllerButtonBindNone+      (#const SDL_CONTROLLER_BINDTYPE_BUTTON) -> do+        button <- (#peek SDL_GameControllerButtonBind, value.button) ptr+        return $! GameControllerButtonBindButton button+      (#const SDL_CONTROLLER_BINDTYPE_AXIS) -> do+        axis <- (#peek SDL_GameControllerButtonBind, value.axis) ptr+        return $! GameControllerButtonBindAxis axis+      (#const SDL_CONTROLLER_BINDTYPE_HAT) -> do+        hat <- (#peek SDL_GameControllerButtonBind, value.hat.hat) ptr+        hat_mask <- (#peek SDL_GameControllerButtonBind, value.hat.hat_mask) ptr+        return $! GameControllerButtonBindHat hat hat_mask+      _ -> error $ "Unknown type " ++ show bind_type ++ " for SDL_GameControllerButtonBind"+  poke ptr bind = case bind of+    GameControllerButtonBindNone -> do+      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_NONE) :: (#type SDL_GameControllerBindType))+    GameControllerButtonBindButton button -> do+      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_BUTTON) :: (#type SDL_GameControllerBindType))+      (#poke SDL_GameControllerButtonBind, value.button) ptr button+    GameControllerButtonBindAxis axis -> do+      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_AXIS) :: (#type SDL_GameControllerBindType))+      (#poke SDL_GameControllerButtonBind, value.axis) ptr axis+    GameControllerButtonBindHat hat hat_mask -> do+      (#poke SDL_GameControllerButtonBind, bindType) ptr ((#const SDL_CONTROLLER_BINDTYPE_HAT) :: (#type SDL_GameControllerBindType))+      (#poke SDL_GameControllerButtonBind, value.hat.hat) ptr hat+      (#poke SDL_GameControllerButtonBind, value.hat.hat_mask) ptr hat_mask++data HapticDirection = HapticDirection+  { hapticDirectionType :: !Word8+  , hapticDirectionX :: !Int32+  , hapticDirectionY :: !Int32+  , hapticDirectionZ :: !Int32+  } deriving (Eq, Show, Typeable)++instance Storable HapticDirection where+  sizeOf _ = (#size SDL_HapticDirection)+  alignment = sizeOf+  peek ptr = do+    typ <- (#peek SDL_HapticDirection, type) ptr+    x <- (#peek SDL_HapticDirection, dir[0]) ptr+    y <- (#peek SDL_HapticDirection, dir[1]) ptr+    z <- (#peek SDL_HapticDirection, dir[2]) ptr+    return $! HapticDirection typ x y z+  poke ptr (HapticDirection typ x y z) = do+    (#poke SDL_HapticDirection, type) ptr typ+    (#poke SDL_HapticDirection, dir[0]) ptr x+    (#poke SDL_HapticDirection, dir[1]) ptr y+    (#poke SDL_HapticDirection, dir[2]) 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, Typeable)++instance Storable HapticEffect where+  sizeOf _ = (#size SDL_HapticEffect)+  alignment = sizeOf+  peek ptr = do+    typ <- (#peek SDL_HapticEffect, type) ptr+    case typ of+      (#const SDL_HAPTIC_CONSTANT) -> do+        direction <- (#peek SDL_HapticEffect, constant.direction) ptr+        len <- (#peek SDL_HapticEffect, constant.length) ptr+        delay <- (#peek SDL_HapticEffect, constant.delay) ptr+        button <- (#peek SDL_HapticEffect, constant.button) ptr+        interval <- (#peek SDL_HapticEffect, constant.interval) ptr+        level <- (#peek SDL_HapticEffect, constant.level) ptr+        attack_length <- (#peek SDL_HapticEffect, constant.attack_length) ptr+        attack_level <- (#peek SDL_HapticEffect, constant.attack_level) ptr+        fade_length <- (#peek SDL_HapticEffect, constant.fade_length) ptr+        fade_level <- (#peek SDL_HapticEffect, constant.fade_level) ptr+        return $! HapticConstant typ direction len delay button interval level attack_length attack_level fade_length fade_level++      (#const SDL_HAPTIC_SINE) -> hapticperiodic $ HapticPeriodic typ+      (#const SDL_HAPTIC_TRIANGLE) -> hapticperiodic $ HapticPeriodic typ+      (#const SDL_HAPTIC_SAWTOOTHUP) -> hapticperiodic $ HapticPeriodic typ+      (#const SDL_HAPTIC_SAWTOOTHDOWN) -> hapticperiodic $ HapticPeriodic typ++      (#const SDL_HAPTIC_RAMP) -> do+        direction <- (#peek SDL_HapticEffect, ramp.direction) ptr+        len <- (#peek SDL_HapticEffect, ramp.length) ptr+        delay <- (#peek SDL_HapticEffect, ramp.delay) ptr+        button <- (#peek SDL_HapticEffect, ramp.button) ptr+        interval <- (#peek SDL_HapticEffect, ramp.interval) ptr+        start <- (#peek SDL_HapticEffect, ramp.start) ptr+        end <- (#peek SDL_HapticEffect, ramp.end) ptr+        attack_length <- (#peek SDL_HapticEffect, ramp.attack_length) ptr+        attack_level <- (#peek SDL_HapticEffect, ramp.attack_level) ptr+        fade_length <- (#peek SDL_HapticEffect, ramp.fade_length) ptr+        fade_level <- (#peek SDL_HapticEffect, ramp.fade_level) ptr+        return $! HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level++      (#const SDL_HAPTIC_SPRING) -> hapticcondition $ HapticCondition typ+      (#const SDL_HAPTIC_DAMPER) -> hapticcondition $ HapticCondition typ+      (#const SDL_HAPTIC_INERTIA) -> hapticcondition $ HapticCondition typ+      (#const SDL_HAPTIC_FRICTION) -> hapticcondition $ HapticCondition typ++      (#const SDL_HAPTIC_LEFTRIGHT) -> do+        len <- (#peek SDL_HapticEffect, leftright.length) ptr+        large_magnitude <- (#peek SDL_HapticEffect, leftright.large_magnitude) ptr+        small_magnitude <- (#peek SDL_HapticEffect, leftright.small_magnitude) ptr+        return $! HapticLeftRight typ len large_magnitude small_magnitude++      (#const SDL_HAPTIC_CUSTOM) -> do+        direction <- (#peek SDL_HapticEffect, custom.direction) ptr+        len <- (#peek SDL_HapticEffect, custom.length) ptr+        delay <- (#peek SDL_HapticEffect, custom.delay) ptr+        button <- (#peek SDL_HapticEffect, custom.button) ptr+        interval <- (#peek SDL_HapticEffect, custom.interval) ptr+        channels <- (#peek SDL_HapticEffect, custom.channels) ptr+        period <- (#peek SDL_HapticEffect, custom.period) ptr+        samples <- (#peek SDL_HapticEffect, custom.samples) ptr+        datum <- (#peek SDL_HapticEffect, custom.data) ptr+        attack_length <- (#peek SDL_HapticEffect, custom.attack_length) ptr+        attack_level <- (#peek SDL_HapticEffect, custom.attack_level) ptr+        fade_length <- (#peek SDL_HapticEffect, custom.fade_length) ptr+        fade_level <- (#peek SDL_HapticEffect, custom.fade_level) 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 <- (#peek SDL_HapticEffect, periodic.direction) ptr+      len <- (#peek SDL_HapticEffect, periodic.length) ptr+      delay <- (#peek SDL_HapticEffect, periodic.delay) ptr+      button <- (#peek SDL_HapticEffect, periodic.button) ptr+      interval <- (#peek SDL_HapticEffect, periodic.interval) ptr+      period <- (#peek SDL_HapticEffect, periodic.period) ptr+      magnitude <- (#peek SDL_HapticEffect, periodic.magnitude) ptr+      offset <- (#peek SDL_HapticEffect, periodic.offset) ptr+      phase <- (#peek SDL_HapticEffect, periodic.phase) ptr+      attack_length <- (#peek SDL_HapticEffect, periodic.attack_length) ptr+      attack_level <- (#peek SDL_HapticEffect, periodic.attack_level) ptr+      fade_length <- (#peek SDL_HapticEffect, periodic.fade_length) ptr+      fade_level <- (#peek SDL_HapticEffect, periodic.fade_level) ptr+      return $! f direction len delay button interval period magnitude offset phase attack_length attack_level fade_length fade_level++    hapticcondition f = do+      len <- (#peek SDL_HapticEffect, condition.length) ptr+      delay <- (#peek SDL_HapticEffect, condition.delay) ptr+      button <- (#peek SDL_HapticEffect, condition.button) ptr+      interval <- (#peek SDL_HapticEffect, condition.interval) ptr+      right_sat <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.right_sat) ptr+      left_sat <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.left_sat) ptr+      right_coeff <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.right_coeff) ptr+      left_coeff <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.left_coeff) ptr+      deadband <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.deadband) ptr+      center <- peekArray 3 $ (#ptr SDL_HapticEffect, condition.center) 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+      (#poke SDL_HapticEffect, type) ptr typ+      (#poke SDL_HapticEffect, constant.direction) ptr direction+      (#poke SDL_HapticEffect, constant.length) ptr len+      (#poke SDL_HapticEffect, constant.delay) ptr delay+      (#poke SDL_HapticEffect, constant.button) ptr button+      (#poke SDL_HapticEffect, constant.interval) ptr interval+      (#poke SDL_HapticEffect, constant.level) ptr level+      (#poke SDL_HapticEffect, constant.attack_length) ptr attack_length+      (#poke SDL_HapticEffect, constant.attack_level) ptr attack_level+      (#poke SDL_HapticEffect, constant.fade_length) ptr fade_length+      (#poke SDL_HapticEffect, constant.fade_level) ptr fade_level+    HapticPeriodic typ direction len delay button interval period magnitude offset phase attack_length attack_level fade_length fade_level -> do+      (#poke SDL_HapticEffect, type) ptr typ+      (#poke SDL_HapticEffect, periodic.direction) ptr direction+      (#poke SDL_HapticEffect, periodic.length) ptr len+      (#poke SDL_HapticEffect, periodic.delay) ptr delay+      (#poke SDL_HapticEffect, periodic.button) ptr button+      (#poke SDL_HapticEffect, periodic.interval) ptr interval+      (#poke SDL_HapticEffect, periodic.period) ptr period+      (#poke SDL_HapticEffect, periodic.magnitude) ptr magnitude+      (#poke SDL_HapticEffect, periodic.offset) ptr offset+      (#poke SDL_HapticEffect, periodic.phase) ptr phase+      (#poke SDL_HapticEffect, periodic.attack_length) ptr attack_length+      (#poke SDL_HapticEffect, periodic.attack_level) ptr attack_level+      (#poke SDL_HapticEffect, periodic.fade_length) ptr fade_length+      (#poke SDL_HapticEffect, periodic.fade_level) ptr fade_level+    HapticCondition typ len delay button interval right_sat left_sat right_coeff left_coeff deadband center -> do+      (#poke SDL_HapticEffect, type) ptr typ+      (#poke SDL_HapticEffect, condition.length) ptr len+      (#poke SDL_HapticEffect, condition.delay) ptr delay+      (#poke SDL_HapticEffect, condition.button) ptr button+      (#poke SDL_HapticEffect, condition.interval) ptr interval+      pokeArray ((#ptr SDL_HapticEffect, condition.right_sat) ptr) right_sat+      pokeArray ((#ptr SDL_HapticEffect, condition.left_sat) ptr) left_sat+      pokeArray ((#ptr SDL_HapticEffect, condition.right_coeff) ptr) right_coeff+      pokeArray ((#ptr SDL_HapticEffect, condition.left_coeff) ptr) left_coeff+      pokeArray ((#ptr SDL_HapticEffect, condition.deadband) ptr) deadband+      pokeArray ((#ptr SDL_HapticEffect, condition.center) ptr) center+    HapticRamp typ direction len delay button interval start end attack_length attack_level fade_length fade_level -> do+      (#poke SDL_HapticEffect, type) ptr typ+      (#poke SDL_HapticEffect, ramp.direction) ptr direction+      (#poke SDL_HapticEffect, ramp.length) ptr len+      (#poke SDL_HapticEffect, ramp.delay) ptr delay+      (#poke SDL_HapticEffect, ramp.button) ptr button+      (#poke SDL_HapticEffect, ramp.interval) ptr interval+      (#poke SDL_HapticEffect, ramp.start) ptr start+      (#poke SDL_HapticEffect, ramp.end) ptr end+      (#poke SDL_HapticEffect, ramp.attack_length) ptr attack_length+      (#poke SDL_HapticEffect, ramp.attack_level) ptr attack_level+      (#poke SDL_HapticEffect, ramp.fade_length) ptr fade_length+      (#poke SDL_HapticEffect, ramp.fade_level) ptr fade_level+    HapticLeftRight typ len large_magnitude small_magnitude -> do+      (#poke SDL_HapticEffect, type) ptr typ+      (#poke SDL_HapticEffect, leftright.length) ptr len+      (#poke SDL_HapticEffect, leftright.large_magnitude) ptr large_magnitude+      (#poke SDL_HapticEffect, leftright.small_magnitude) ptr small_magnitude+    HapticCustom typ direction len delay button interval channels period samples datum attack_length attack_level fade_length fade_level -> do+      (#poke SDL_HapticEffect, type) ptr typ+      (#poke SDL_HapticEffect, custom.direction) ptr direction+      (#poke SDL_HapticEffect, custom.length) ptr len+      (#poke SDL_HapticEffect, custom.delay) ptr delay+      (#poke SDL_HapticEffect, custom.button) ptr button+      (#poke SDL_HapticEffect, custom.interval) ptr interval+      (#poke SDL_HapticEffect, custom.channels) ptr channels+      (#poke SDL_HapticEffect, custom.period) ptr period+      (#poke SDL_HapticEffect, custom.samples) ptr samples+      (#poke SDL_HapticEffect, custom.data) ptr datum+      (#poke SDL_HapticEffect, custom.attack_length) ptr attack_length+      (#poke SDL_HapticEffect, custom.attack_level) ptr attack_level+      (#poke SDL_HapticEffect, custom.fade_length) ptr fade_length+      (#poke SDL_HapticEffect, custom.fade_level) ptr fade_level++data JoystickGUID = JoystickGUID+  { joystickGUID :: ![Word8]+  } deriving (Eq, Show, Typeable)++instance Storable JoystickGUID where+  sizeOf _ = (#size SDL_JoystickGUID)+  alignment = sizeOf+  peek ptr = do+    guid <- peekArray 16 $ (#ptr SDL_JoystickGUID, data) ptr+    return $! JoystickGUID guid+  poke ptr (JoystickGUID guid) =+    pokeArray ((#ptr SDL_JoystickGUID, data) ptr) guid++data Keysym = Keysym+  { keysymScancode :: !Scancode+  , keysymKeycode :: !Keycode+  , keysymMod :: !Word16+  } deriving (Eq, Show, Typeable)++instance Storable Keysym where+  sizeOf _ = (#size SDL_Keysym)+  alignment = sizeOf+  peek ptr = do+    scancode <- (#peek SDL_Keysym, scancode) ptr+    sym <- (#peek SDL_Keysym, sym) ptr+    mod' <- (#peek SDL_Keysym, mod) ptr+    return $! Keysym scancode sym mod'+  poke ptr (Keysym scancode sym mod') = do+    (#poke SDL_Keysym, scancode) ptr scancode+    (#poke SDL_Keysym, sym) ptr sym+    (#poke SDL_Keysym, mod) ptr mod'++data MessageBoxButtonData = MessageBoxButtonData+  { messageBoxButtonDataFlags :: !Word32+  , messageBoxButtonButtonID :: !CInt+  , messageBoxButtonText :: !CString+  } deriving (Eq, Show, Typeable)++instance Storable MessageBoxButtonData where+  sizeOf _ = (#size SDL_MessageBoxButtonData)+  alignment = sizeOf+  peek ptr = do+    flags <- (#peek SDL_MessageBoxButtonData, flags) ptr+    buttonid <- (#peek SDL_MessageBoxButtonData, buttonid) ptr+    text <- (#peek SDL_MessageBoxButtonData, text) ptr+    return $! MessageBoxButtonData flags buttonid text+  poke ptr (MessageBoxButtonData flags buttonid text) = do+    (#poke SDL_MessageBoxButtonData, flags) ptr flags+    (#poke SDL_MessageBoxButtonData, buttonid) ptr buttonid+    (#poke SDL_MessageBoxButtonData, text) ptr text++data MessageBoxColor = MessageBoxColor+  { messageBoxColorR :: !Word8+  , messageBoxColorG :: !Word8+  , messageBoxColorB :: !Word8+  } deriving (Eq, Show, Typeable)++instance Storable MessageBoxColor where+  sizeOf _ = (#size SDL_MessageBoxColor)+  alignment = sizeOf+  peek ptr = do+    r <- (#peek SDL_MessageBoxColor, r) ptr+    g <- (#peek SDL_MessageBoxColor, g) ptr+    b <- (#peek SDL_MessageBoxColor, b) ptr+    return $! MessageBoxColor r g b+  poke ptr (MessageBoxColor r g b) = do+    (#poke SDL_MessageBoxColor, r) ptr r+    (#poke SDL_MessageBoxColor, g) ptr g+    (#poke SDL_MessageBoxColor, b) ptr b++data MessageBoxColorScheme = MessageBoxColorScheme+  { messageBoxColorSchemeColorBackground :: !MessageBoxColor+  , messageBoxColorSchemeColorText :: !MessageBoxColor+  , messageBoxColorSchemeColorButtonBorder :: !MessageBoxColor+  , messageBoxColorSchemeColorButtonBackground :: !MessageBoxColor+  , messageBoxColorSchemeColorButtonSelected :: !MessageBoxColor+  } deriving (Eq, Show, Typeable)++instance Storable MessageBoxColorScheme where+  sizeOf _ = (#size SDL_MessageBoxColorScheme)+  alignment = sizeOf+  peek ptr = do+    background <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BACKGROUND]) ptr+    text <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_TEXT]) ptr+    button_border <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER]) ptr+    button_background <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND]) ptr+    button_selected <- (#peek SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED]) ptr+    return $! MessageBoxColorScheme background text button_border button_background button_selected+  poke ptr (MessageBoxColorScheme background text button_border button_background button_selected) = do+    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BACKGROUND]) ptr background+    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_TEXT]) ptr text+    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER]) ptr button_border+    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND]) ptr button_background+    (#poke SDL_MessageBoxColorScheme, colors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED]) 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, Typeable)++instance Storable MessageBoxData where+  sizeOf _ = (#size SDL_MessageBoxData)+  alignment = sizeOf+  peek ptr = do+    flags <- (#peek SDL_MessageBoxData, flags) ptr+    window <- (#peek SDL_MessageBoxData, window) ptr+    title <- (#peek SDL_MessageBoxData, title) ptr+    message <- (#peek SDL_MessageBoxData, message) ptr+    numbuttons <- (#peek SDL_MessageBoxData, numbuttons) ptr+    buttons <- (#peek SDL_MessageBoxData, buttons) ptr+    color_scheme <- (#peek SDL_MessageBoxData, colorScheme) ptr+    return $! MessageBoxData flags window title message numbuttons buttons color_scheme+  poke ptr (MessageBoxData flags window title message numbuttons buttons color_scheme) = do+    (#poke SDL_MessageBoxData, flags) ptr flags+    (#poke SDL_MessageBoxData, window) ptr window+    (#poke SDL_MessageBoxData, title) ptr title+    (#poke SDL_MessageBoxData, message) ptr message+    (#poke SDL_MessageBoxData, numbuttons) ptr numbuttons+    (#poke SDL_MessageBoxData, buttons) ptr buttons+    (#poke SDL_MessageBoxData, colorScheme) ptr color_scheme++data Palette = Palette+  { paletteNColors :: !CInt+  , paletteColors :: !(Ptr Color)+  } deriving (Eq, Show, Typeable)++instance Storable Palette where+  sizeOf _ = (#size SDL_Palette)+  alignment = sizeOf+  peek ptr = do+    ncolors <- (#peek SDL_Palette, ncolors) ptr+    colors <- (#peek SDL_Palette, colors) ptr+    return $! Palette ncolors colors+  poke ptr (Palette ncolors colors) = do+    (#poke SDL_Palette, ncolors) ptr ncolors+    (#poke SDL_Palette, colors) 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, Typeable)++instance Storable PixelFormat where+  sizeOf _ = (#size SDL_PixelFormat)+  alignment = sizeOf+  peek ptr = do+    format <- (#peek SDL_PixelFormat, format) ptr+    palette <- (#peek SDL_PixelFormat, palette) ptr+    bits_per_pixel <- (#peek SDL_PixelFormat, BitsPerPixel) ptr+    bytes_per_pixel <- (#peek SDL_PixelFormat, BytesPerPixel) ptr+    rmask <- (#peek SDL_PixelFormat, Rmask) ptr+    gmask <- (#peek SDL_PixelFormat, Gmask) ptr+    bmask <- (#peek SDL_PixelFormat, Bmask) ptr+    amask <- (#peek SDL_PixelFormat, Amask) 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+    (#poke SDL_PixelFormat, format) ptr format+    (#poke SDL_PixelFormat, palette) ptr palette+    (#poke SDL_PixelFormat, BitsPerPixel) ptr bits_per_pixel+    (#poke SDL_PixelFormat, BytesPerPixel) ptr bytes_per_pixel+    (#poke SDL_PixelFormat, Rmask) ptr rmask+    (#poke SDL_PixelFormat, Gmask) ptr gmask+    (#poke SDL_PixelFormat, Bmask) ptr bmask+    (#poke SDL_PixelFormat, Amask) ptr amask++data Point = Point+  { pointX :: !CInt+  , pointY :: !CInt+  } deriving (Eq, Show, Typeable)++instance Storable Point where+  sizeOf _ = (#size SDL_Point)+  alignment = sizeOf+  peek ptr = do+    x <- (#peek SDL_Point, x) ptr+    y <- (#peek SDL_Point, y) ptr+    return $! Point x y+  poke ptr (Point x y) = do+    (#poke SDL_Point, x) ptr x+    (#poke SDL_Point, y) ptr y++data Rect = Rect+  { rectX :: !CInt+  , rectY :: !CInt+  , rectW :: !CInt+  , rectH :: !CInt+  } deriving (Eq, Show, Typeable)++instance Storable Rect where+  sizeOf _ = (#size SDL_Rect)+  alignment = sizeOf+  peek ptr = do+    x <- (#peek SDL_Rect, x) ptr+    y <- (#peek SDL_Rect, y) ptr+    w <- (#peek SDL_Rect, w) ptr+    h <- (#peek SDL_Rect, h) ptr+    return $! Rect x y w h+  poke ptr (Rect x y w h) = do+    (#poke SDL_Rect, x) ptr x+    (#poke SDL_Rect, y) ptr y+    (#poke SDL_Rect, w) ptr w+    (#poke SDL_Rect, h) ptr h++data RendererInfo = RendererInfo+  { rendererInfoName :: !CString+  , rendererInfoFlags :: !Word32+  , rendererInfoNumTextureFormats :: !Word32+  , rendererInfoTextureFormats :: ![Word32]+  , rendererInfoMaxTextureWidth :: !CInt+  , rendererInfoMaxTextureHeight :: !CInt+  } deriving (Eq, Show, Typeable)++instance Storable RendererInfo where+  sizeOf _ = (#size SDL_RendererInfo)+  alignment = sizeOf+  peek ptr = do+    name <- (#peek SDL_RendererInfo, name) ptr+    flags <- (#peek SDL_RendererInfo, flags) ptr+    num_texture_formats <- (#peek SDL_RendererInfo, num_texture_formats) ptr+    texture_formats <- peekArray 16 $ (#ptr SDL_RendererInfo, texture_formats) ptr+    max_texture_width <- (#peek SDL_RendererInfo, max_texture_width) ptr+    max_texture_height <- (#peek SDL_RendererInfo, max_texture_height) 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+    (#poke SDL_RendererInfo, name) ptr name+    (#poke SDL_RendererInfo, flags) ptr flags+    (#poke SDL_RendererInfo, num_texture_formats) ptr num_texture_formats+    pokeArray ((#ptr SDL_RendererInfo, texture_formats) ptr) texture_formats+    (#poke SDL_RendererInfo, max_texture_width) ptr max_texture_width+    (#poke SDL_RendererInfo, max_texture_height) 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, Typeable)++instance Storable RWops where+  sizeOf _ = (#size SDL_RWops)+  alignment = sizeOf+  peek ptr = do+    size <- (#peek SDL_RWops, size) ptr+    seek <- (#peek SDL_RWops, seek) ptr+    read' <- (#peek SDL_RWops, read) ptr+    write <- (#peek SDL_RWops, write) ptr+    close <- (#peek SDL_RWops, close) ptr+    typ <- (#peek SDL_RWops, type) ptr+    return $! RWops size seek read' write close typ+  poke ptr (RWops size seek read' write close typ) = do+    (#poke SDL_RWops, size) ptr size+    (#poke SDL_RWops, seek) ptr seek+    (#poke SDL_RWops, read) ptr read'+    (#poke SDL_RWops, write) ptr write+    (#poke SDL_RWops, close) ptr close+    (#poke SDL_RWops, type) ptr typ++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 _ = (#size SDL_Surface)+  alignment = sizeOf+  peek ptr = do+    format <- (#peek SDL_Surface, format) ptr+    w <- (#peek SDL_Surface, w) ptr+    h <- (#peek SDL_Surface, h) ptr+    pixels <- (#peek SDL_Surface, pixels) ptr+    userdata <- (#peek SDL_Surface, userdata) ptr+    cliprect <- (#peek SDL_Surface, clip_rect) ptr+    refcount <- (#peek SDL_Surface, refcount) ptr+    return $! Surface format w h pixels userdata cliprect refcount+  poke ptr (Surface format w h pixels userdata cliprect refcount) = do+    (#poke SDL_Surface, format) ptr format+    (#poke SDL_Surface, w) ptr w+    (#poke SDL_Surface, h) ptr h+    (#poke SDL_Surface, pixels) ptr pixels+    (#poke SDL_Surface, userdata) ptr userdata+    (#poke SDL_Surface, clip_rect) ptr cliprect+    (#poke SDL_Surface, refcount) ptr refcount++data Version = Version+  { versionMajor :: !Word8+  , versionMinor :: !Word8+  , versionPatch :: !Word8+  } deriving (Eq, Show, Typeable)++instance Storable Version where+  sizeOf _ = (#size SDL_version)+  alignment = sizeOf+  peek ptr = do+    major <- (#peek SDL_version, major) ptr+    minor <- (#peek SDL_version, minor) ptr+    patch <- (#peek SDL_version, patch) ptr+    return $! Version major minor patch+  poke ptr (Version major minor patch) = do+    (#poke SDL_version, major) ptr major+    (#poke SDL_version, minor) ptr minor+    (#poke SDL_version, patch) ptr patch
src/SDL/Raw/Video.hs view
@@ -1,1131 +1,1131 @@-module SDL.Raw.Video (
-  -- * Display and Window Management
-  createWindow,
-  createWindowAndRenderer,
-  createWindowFrom,
-  destroyWindow,
-  disableScreenSaver,
-  enableScreenSaver,
-  glBindTexture,
-  glCreateContext,
-  glDeleteContext,
-  glExtensionSupported,
-  glGetAttribute,
-  glGetCurrentContext,
-  glGetCurrentWindow,
-  glGetDrawableSize,
-  glGetProcAddress,
-  glGetSwapInterval,
-  glLoadLibrary,
-  glMakeCurrent,
-  glResetAttributes,
-  glSetAttribute,
-  glSetSwapInterval,
-  glSwapWindow,
-  glUnbindTexture,
-  glUnloadLibrary,
-  getClosestDisplayMode,
-  getCurrentDisplayMode,
-  getCurrentVideoDriver,
-  getDesktopDisplayMode,
-  getDisplayBounds,
-  getDisplayDPI,
-  getDisplayMode,
-  getDisplayName,
-  getGrabbedWindow,
-  getNumDisplayModes,
-  getNumVideoDisplays,
-  getNumVideoDrivers,
-  getVideoDriver,
-  getWindowBrightness,
-  getWindowData,
-  getWindowDisplayIndex,
-  getWindowDisplayMode,
-  getWindowFlags,
-  getWindowFromID,
-  getWindowGammaRamp,
-  getWindowGrab,
-  getWindowID,
-  getWindowMaximumSize,
-  getWindowMinimumSize,
-  getWindowPixelFormat,
-  getWindowPosition,
-  getWindowSize,
-  getWindowSurface,
-  getWindowTitle,
-  hideWindow,
-  isScreenSaverEnabled,
-  maximizeWindow,
-  minimizeWindow,
-  raiseWindow,
-  restoreWindow,
-  setWindowBordered,
-  setWindowBrightness,
-  setWindowData,
-  setWindowDisplayMode,
-  setWindowFullscreen,
-  setWindowGammaRamp,
-  setWindowGrab,
-  setWindowIcon,
-  setWindowMaximumSize,
-  setWindowMinimumSize,
-  setWindowPosition,
-  setWindowSize,
-  setWindowTitle,
-  showMessageBox,
-  showSimpleMessageBox,
-  showWindow,
-  updateWindowSurface,
-  updateWindowSurfaceRects,
-  videoInit,
-  videoQuit,
-
-  -- * 2D Accelerated Rendering
-  createRenderer,
-  createSoftwareRenderer,
-  createTexture,
-  createTextureFromSurface,
-  destroyRenderer,
-  destroyTexture,
-  getNumRenderDrivers,
-  getRenderDrawBlendMode,
-  getRenderDrawColor,
-  getRenderDriverInfo,
-  getRenderTarget,
-  getRenderer,
-  getRendererInfo,
-  getRendererOutputSize,
-  getTextureAlphaMod,
-  getTextureBlendMode,
-  getTextureColorMod,
-  lockTexture,
-  queryTexture,
-  renderClear,
-  renderCopy,
-  renderCopyEx,
-  renderDrawLine,
-  renderDrawLines,
-  renderDrawPoint,
-  renderDrawPoints,
-  renderDrawRect,
-  renderDrawRects,
-  renderFillRect,
-  renderFillRects,
-  renderGetClipRect,
-  renderGetLogicalSize,
-  renderGetScale,
-  renderGetViewport,
-  renderIsClipEnabled,
-  renderPresent,
-  renderReadPixels,
-  renderSetClipRect,
-  renderSetLogicalSize,
-  renderSetScale,
-  renderSetViewport,
-  renderTargetSupported,
-  setRenderDrawBlendMode,
-  setRenderDrawColor,
-  setRenderTarget,
-  setTextureAlphaMod,
-  setTextureBlendMode,
-  setTextureColorMod,
-  unlockTexture,
-  updateTexture,
-  updateYUVTexture,
-
-  -- * Pixel Formats and Conversion Routines
-  allocFormat,
-  allocPalette,
-  calculateGammaRamp,
-  freeFormat,
-  freePalette,
-  getPixelFormatName,
-  getRGB,
-  getRGBA,
-  mapRGB,
-  mapRGBA,
-  masksToPixelFormatEnum,
-  pixelFormatEnumToMasks,
-  setPaletteColors,
-  setPixelFormatPalette,
-
-  -- * Rectangle Functions
-  enclosePoints,
-  hasIntersection,
-  intersectRect,
-  intersectRectAndLine,
-  unionRect,
-
-  -- * Surface Creation and Simple Drawing
-  blitScaled,
-  blitSurface,
-  convertPixels,
-  convertSurface,
-  convertSurfaceFormat,
-  createRGBSurface,
-  createRGBSurfaceFrom,
-  fillRect,
-  fillRects,
-  freeSurface,
-  getClipRect,
-  getColorKey,
-  getSurfaceAlphaMod,
-  getSurfaceBlendMode,
-  getSurfaceColorMod,
-  loadBMP,
-  loadBMP_RW,
-  lockSurface,
-  lowerBlit,
-  lowerBlitScaled,
-  saveBMP,
-  saveBMP_RW,
-  setClipRect,
-  setColorKey,
-  setSurfaceAlphaMod,
-  setSurfaceBlendMode,
-  setSurfaceColorMod,
-  setSurfacePalette,
-  setSurfaceRLE,
-  unlockSurface,
-
-  -- * Platform-specific Window Management
-  getWindowWMInfo,
-
-  -- * Clipboard Handling
-  getClipboardText,
-  hasClipboardText,
-  setClipboardText
-) where
-
-import Control.Monad.IO.Class
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.Ptr
-import SDL.Raw.Enum
-import SDL.Raw.Filesystem
-import SDL.Raw.Types
-
-foreign import ccall "SDL.h SDL_CreateWindow" createWindowFFI :: CString -> CInt -> CInt -> CInt -> CInt -> Word32 -> IO Window
-foreign import ccall "SDL.h SDL_CreateWindowAndRenderer" createWindowAndRendererFFI :: CInt -> CInt -> Word32 -> Ptr Window -> Ptr Renderer -> IO CInt
-foreign import ccall "SDL.h SDL_CreateWindowFrom" createWindowFromFFI :: Ptr () -> IO Window
-foreign import ccall "SDL.h SDL_DestroyWindow" destroyWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_DisableScreenSaver" disableScreenSaverFFI :: IO ()
-foreign import ccall "SDL.h SDL_EnableScreenSaver" enableScreenSaverFFI :: IO ()
-foreign import ccall "SDL.h SDL_GL_BindTexture" glBindTextureFFI :: Texture -> Ptr CFloat -> Ptr CFloat -> IO CInt
-foreign import ccall "SDL.h SDL_GL_CreateContext" glCreateContextFFI :: Window -> IO GLContext
-foreign import ccall "SDL.h SDL_GL_DeleteContext" glDeleteContextFFI :: GLContext -> IO ()
-foreign import ccall "SDL.h SDL_GL_ExtensionSupported" glExtensionSupportedFFI :: CString -> IO Bool
-foreign import ccall "SDL.h SDL_GL_GetAttribute" glGetAttributeFFI :: GLattr -> Ptr CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GL_GetCurrentContext" glGetCurrentContextFFI :: IO GLContext
-foreign import ccall "SDL.h SDL_GL_GetCurrentWindow" glGetCurrentWindowFFI :: IO Window
-foreign import ccall "SDL.h SDL_GL_GetDrawableSize" glGetDrawableSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()
-foreign import ccall "SDL.h SDL_GL_GetProcAddress" glGetProcAddressFFI :: CString -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_GL_GetSwapInterval" glGetSwapIntervalFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GL_LoadLibrary" glLoadLibraryFFI :: CString -> IO CInt
-foreign import ccall "SDL.h SDL_GL_MakeCurrent" glMakeCurrentFFI :: Window -> GLContext -> IO CInt
-foreign import ccall "SDL.h SDL_GL_ResetAttributes" glResetAttributesFFI :: IO ()
-foreign import ccall "SDL.h SDL_GL_SetAttribute" glSetAttributeFFI :: GLattr -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GL_SetSwapInterval" glSetSwapIntervalFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GL_SwapWindow" glSwapWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_GL_UnbindTexture" glUnbindTextureFFI :: Texture -> IO CInt
-foreign import ccall "SDL.h SDL_GL_UnloadLibrary" glUnloadLibraryFFI :: IO ()
-foreign import ccall "SDL.h SDL_GetClosestDisplayMode" getClosestDisplayModeFFI :: CInt -> Ptr DisplayMode -> Ptr DisplayMode -> IO (Ptr DisplayMode)
-foreign import ccall "SDL.h SDL_GetCurrentDisplayMode" getCurrentDisplayModeFFI :: CInt -> Ptr DisplayMode -> IO CInt
-foreign import ccall "SDL.h SDL_GetCurrentVideoDriver" getCurrentVideoDriverFFI :: IO CString
-foreign import ccall "SDL.h SDL_GetDesktopDisplayMode" getDesktopDisplayModeFFI :: CInt -> Ptr DisplayMode -> IO CInt
-foreign import ccall "SDL.h SDL_GetDisplayBounds" getDisplayBoundsFFI :: CInt -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_GetDisplayDPI" getDisplayDPIFFI :: CInt -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> IO CInt
-foreign import ccall "SDL.h SDL_GetDisplayMode" getDisplayModeFFI :: CInt -> CInt -> Ptr DisplayMode -> IO CInt
-foreign import ccall "SDL.h SDL_GetDisplayName" getDisplayNameFFI :: CInt -> IO CString
-foreign import ccall "SDL.h SDL_GetGrabbedWindow" getGrabbedWindowFFI :: IO Window
-foreign import ccall "SDL.h SDL_GetNumDisplayModes" getNumDisplayModesFFI :: CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GetNumVideoDisplays" getNumVideoDisplaysFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GetNumVideoDrivers" getNumVideoDriversFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GetVideoDriver" getVideoDriverFFI :: CInt -> IO CString
-foreign import ccall "SDL.h SDL_GetWindowBrightness" getWindowBrightnessFFI :: Window -> IO CFloat
-foreign import ccall "SDL.h SDL_GetWindowData" getWindowDataFFI :: Window -> CString -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_GetWindowDisplayIndex" getWindowDisplayIndexFFI :: Window -> IO CInt
-foreign import ccall "SDL.h SDL_GetWindowDisplayMode" getWindowDisplayModeFFI :: Window -> Ptr DisplayMode -> IO CInt
-foreign import ccall "SDL.h SDL_GetWindowFlags" getWindowFlagsFFI :: Window -> IO Word32
-foreign import ccall "SDL.h SDL_GetWindowFromID" getWindowFromIDFFI :: Word32 -> IO Window
-foreign import ccall "SDL.h SDL_GetWindowGammaRamp" getWindowGammaRampFFI :: Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> IO CInt
-foreign import ccall "SDL.h SDL_GetWindowGrab" getWindowGrabFFI :: Window -> IO Bool
-foreign import ccall "SDL.h SDL_GetWindowID" getWindowIDFFI :: Window -> IO Word32
-foreign import ccall "SDL.h SDL_GetWindowMaximumSize" getWindowMaximumSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()
-foreign import ccall "SDL.h SDL_GetWindowMinimumSize" getWindowMinimumSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()
-foreign import ccall "SDL.h SDL_GetWindowPixelFormat" getWindowPixelFormatFFI :: Window -> IO Word32
-foreign import ccall "SDL.h SDL_GetWindowPosition" getWindowPositionFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()
-foreign import ccall "SDL.h SDL_GetWindowSize" getWindowSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()
-foreign import ccall "SDL.h SDL_GetWindowSurface" getWindowSurfaceFFI :: Window -> IO (Ptr Surface)
-foreign import ccall "SDL.h SDL_GetWindowTitle" getWindowTitleFFI :: Window -> IO CString
-foreign import ccall "SDL.h SDL_HideWindow" hideWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_IsScreenSaverEnabled" isScreenSaverEnabledFFI :: IO Bool
-foreign import ccall "SDL.h SDL_MaximizeWindow" maximizeWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_MinimizeWindow" minimizeWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_RaiseWindow" raiseWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_RestoreWindow" restoreWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowBordered" setWindowBorderedFFI :: Window -> Bool -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowBrightness" setWindowBrightnessFFI :: Window -> CFloat -> IO CInt
-foreign import ccall "SDL.h SDL_SetWindowData" setWindowDataFFI :: Window -> CString -> Ptr () -> IO (Ptr ())
-foreign import ccall "SDL.h SDL_SetWindowDisplayMode" setWindowDisplayModeFFI :: Window -> Ptr DisplayMode -> IO CInt
-foreign import ccall "SDL.h SDL_SetWindowFullscreen" setWindowFullscreenFFI :: Window -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_SetWindowGammaRamp" setWindowGammaRampFFI :: Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> IO CInt
-foreign import ccall "SDL.h SDL_SetWindowGrab" setWindowGrabFFI :: Window -> Bool -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowIcon" setWindowIconFFI :: Window -> Ptr Surface -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowMaximumSize" setWindowMaximumSizeFFI :: Window -> CInt -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowMinimumSize" setWindowMinimumSizeFFI :: Window -> CInt -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowPosition" setWindowPositionFFI :: Window -> CInt -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowSize" setWindowSizeFFI :: Window -> CInt -> CInt -> IO ()
-foreign import ccall "SDL.h SDL_SetWindowTitle" setWindowTitleFFI :: Window -> CString -> IO ()
-foreign import ccall "SDL.h SDL_ShowMessageBox" showMessageBoxFFI :: Ptr MessageBoxData -> Ptr CInt -> IO CInt
-foreign import ccall "SDL.h SDL_ShowSimpleMessageBox" showSimpleMessageBoxFFI :: Word32 -> CString -> CString -> Window -> IO CInt
-foreign import ccall "SDL.h SDL_ShowWindow" showWindowFFI :: Window -> IO ()
-foreign import ccall "SDL.h SDL_UpdateWindowSurface" updateWindowSurfaceFFI :: Window -> IO CInt
-foreign import ccall "SDL.h SDL_UpdateWindowSurfaceRects" updateWindowSurfaceRectsFFI :: Window -> Ptr Rect -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_VideoInit" videoInitFFI :: CString -> IO CInt
-foreign import ccall "SDL.h SDL_VideoQuit" videoQuitFFI :: IO ()
-
-foreign import ccall "SDL.h SDL_CreateRenderer" createRendererFFI :: Window -> CInt -> Word32 -> IO Renderer
-foreign import ccall "SDL.h SDL_CreateSoftwareRenderer" createSoftwareRendererFFI :: Ptr Surface -> IO Renderer
-foreign import ccall "SDL.h SDL_CreateTexture" createTextureFFI :: Renderer -> Word32 -> CInt -> CInt -> CInt -> IO Texture
-foreign import ccall "SDL.h SDL_CreateTextureFromSurface" createTextureFromSurfaceFFI :: Renderer -> Ptr Surface -> IO Texture
-foreign import ccall "SDL.h SDL_DestroyRenderer" destroyRendererFFI :: Renderer -> IO ()
-foreign import ccall "SDL.h SDL_DestroyTexture" destroyTextureFFI :: Texture -> IO ()
-foreign import ccall "SDL.h SDL_GetNumRenderDrivers" getNumRenderDriversFFI :: IO CInt
-foreign import ccall "SDL.h SDL_GetRenderDrawBlendMode" getRenderDrawBlendModeFFI :: Renderer -> Ptr BlendMode -> IO Int
-foreign import ccall "SDL.h SDL_GetRenderDrawColor" getRenderDrawColorFFI :: Renderer -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_GetRenderDriverInfo" getRenderDriverInfoFFI :: CInt -> Ptr RendererInfo -> IO CInt
-foreign import ccall "SDL.h SDL_GetRenderTarget" getRenderTargetFFI :: Renderer -> IO Texture
-foreign import ccall "SDL.h SDL_GetRenderer" getRendererFFI :: Window -> IO Renderer
-foreign import ccall "SDL.h SDL_GetRendererInfo" getRendererInfoFFI :: Renderer -> Ptr RendererInfo -> IO CInt
-foreign import ccall "SDL.h SDL_GetRendererOutputSize" getRendererOutputSizeFFI :: Renderer -> Ptr CInt -> Ptr CInt -> IO CInt
-foreign import ccall "SDL.h SDL_GetTextureAlphaMod" getTextureAlphaModFFI :: Texture -> Ptr Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_GetTextureBlendMode" getTextureBlendModeFFI :: Texture -> Ptr BlendMode -> IO CInt
-foreign import ccall "SDL.h SDL_GetTextureColorMod" getTextureColorModFFI :: Texture -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_LockTexture" lockTextureFFI :: Texture -> Ptr Rect -> Ptr (Ptr ()) -> Ptr CInt -> IO CInt
-foreign import ccall "SDL.h SDL_QueryTexture" queryTextureFFI :: Texture -> Ptr Word32 -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderClear" renderClearFFI :: Renderer -> IO CInt
-foreign import ccall "SDL.h SDL_RenderCopy" renderCopyFFI :: Renderer -> Texture -> Ptr Rect -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_RenderCopyEx" renderCopyExFFI :: Renderer -> Texture -> Ptr Rect -> Ptr Rect -> CDouble -> Ptr Point -> RendererFlip -> IO CInt
-foreign import ccall "SDL.h SDL_RenderDrawLine" renderDrawLineFFI :: Renderer -> CInt -> CInt -> CInt -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderDrawLines" renderDrawLinesFFI :: Renderer -> Ptr Point -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderDrawPoint" renderDrawPointFFI :: Renderer -> CInt -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderDrawPoints" renderDrawPointsFFI :: Renderer -> Ptr Point -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderDrawRect" renderDrawRectFFI :: Renderer -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_RenderDrawRects" renderDrawRectsFFI :: Renderer -> Ptr Rect -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderFillRect" renderFillRectFFI :: Renderer -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_RenderFillRects" renderFillRectsFFI :: Renderer -> Ptr Rect -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderGetClipRect" renderGetClipRectFFI :: Renderer -> Ptr Rect -> IO ()
-foreign import ccall "SDL.h SDL_RenderGetLogicalSize" renderGetLogicalSizeFFI :: Renderer -> Ptr CInt -> Ptr CInt -> IO ()
-foreign import ccall "SDL.h SDL_RenderGetScale" renderGetScaleFFI :: Renderer -> Ptr CFloat -> Ptr CFloat -> IO ()
-foreign import ccall "SDL.h SDL_RenderGetViewport" renderGetViewportFFI :: Renderer -> Ptr Rect -> IO ()
-foreign import ccall "SDL.h SDL_RenderIsClipEnabled" renderIsClipEnabledFFI :: Renderer -> IO Bool
-foreign import ccall "SDL.h SDL_RenderPresent" renderPresentFFI :: Renderer -> IO ()
-foreign import ccall "SDL.h SDL_RenderReadPixels" renderReadPixelsFFI :: Renderer -> Ptr Rect -> Word32 -> Ptr () -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderSetClipRect" renderSetClipRectFFI :: Renderer -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_RenderSetLogicalSize" renderSetLogicalSizeFFI :: Renderer -> CInt -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_RenderSetScale" renderSetScaleFFI :: Renderer -> CFloat -> CFloat -> IO CInt
-foreign import ccall "SDL.h SDL_RenderSetViewport" renderSetViewportFFI :: Renderer -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_RenderTargetSupported" renderTargetSupportedFFI :: Renderer -> IO Bool
-foreign import ccall "SDL.h SDL_SetRenderDrawBlendMode" setRenderDrawBlendModeFFI :: Renderer -> BlendMode -> IO CInt
-foreign import ccall "SDL.h SDL_SetRenderDrawColor" setRenderDrawColorFFI :: Renderer -> Word8 -> Word8 -> Word8 -> Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_SetRenderTarget" setRenderTargetFFI :: Renderer -> Texture -> IO CInt
-foreign import ccall "SDL.h SDL_SetTextureAlphaMod" setTextureAlphaModFFI :: Texture -> Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_SetTextureBlendMode" setTextureBlendModeFFI :: Texture -> BlendMode -> IO CInt
-foreign import ccall "SDL.h SDL_SetTextureColorMod" setTextureColorModFFI :: Texture -> Word8 -> Word8 -> Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_UnlockTexture" unlockTextureFFI :: Texture -> IO ()
-foreign import ccall "SDL.h SDL_UpdateTexture" updateTextureFFI :: Texture -> Ptr Rect -> Ptr () -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_UpdateYUVTexture" updateYUVTextureFFI :: Texture -> Ptr Rect -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> IO CInt
-
-foreign import ccall "SDL.h SDL_AllocFormat" allocFormatFFI :: Word32 -> IO (Ptr PixelFormat)
-foreign import ccall "SDL.h SDL_AllocPalette" allocPaletteFFI :: CInt -> IO (Ptr Palette)
-foreign import ccall "SDL.h SDL_CalculateGammaRamp" calculateGammaRampFFI :: CFloat -> Ptr Word16 -> IO ()
-foreign import ccall "SDL.h SDL_FreeFormat" freeFormatFFI :: Ptr PixelFormat -> IO ()
-foreign import ccall "SDL.h SDL_FreePalette" freePaletteFFI :: Ptr Palette -> IO ()
-foreign import ccall "SDL.h SDL_GetPixelFormatName" getPixelFormatNameFFI :: Word32 -> IO CString
-foreign import ccall "SDL.h SDL_GetRGB" getRGBFFI :: Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO ()
-foreign import ccall "SDL.h SDL_GetRGBA" getRGBAFFI :: Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO ()
-foreign import ccall "SDL.h SDL_MapRGB" mapRGBFFI :: Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> IO Word32
-foreign import ccall "SDL.h SDL_MapRGBA" mapRGBAFFI :: Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> Word8 -> IO Word32
-foreign import ccall "SDL.h SDL_MasksToPixelFormatEnum" masksToPixelFormatEnumFFI :: CInt -> Word32 -> Word32 -> Word32 -> Word32 -> IO Word32
-foreign import ccall "SDL.h SDL_PixelFormatEnumToMasks" pixelFormatEnumToMasksFFI :: Word32 -> Ptr CInt -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> IO Bool
-foreign import ccall "SDL.h SDL_SetPaletteColors" setPaletteColorsFFI :: Ptr Palette -> Ptr Color -> CInt -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_SetPixelFormatPalette" setPixelFormatPaletteFFI :: Ptr PixelFormat -> Ptr Palette -> IO CInt
-
-foreign import ccall "SDL.h SDL_EnclosePoints" enclosePointsFFI :: Ptr Point -> CInt -> Ptr Rect -> Ptr Rect -> IO Bool
-foreign import ccall "SDL.h SDL_HasIntersection" hasIntersectionFFI :: Ptr Rect -> Ptr Rect -> IO Bool
-foreign import ccall "SDL.h SDL_IntersectRect" intersectRectFFI :: Ptr Rect -> Ptr Rect -> Ptr Rect -> IO Bool
-foreign import ccall "SDL.h SDL_IntersectRectAndLine" intersectRectAndLineFFI :: Ptr Rect -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO Bool
-foreign import ccall "SDL.h SDL_UnionRect" unionRectFFI :: Ptr Rect -> Ptr Rect -> Ptr Rect -> IO ()
-
-foreign import ccall "SDL.h SDL_UpperBlitScaled" blitScaledFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_UpperBlit" blitSurfaceFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_ConvertPixels" convertPixelsFFI :: CInt -> CInt -> Word32 -> Ptr () -> CInt -> Word32 -> Ptr () -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_ConvertSurface" convertSurfaceFFI :: Ptr Surface -> Ptr PixelFormat -> Word32 -> IO (Ptr Surface)
-foreign import ccall "SDL.h SDL_ConvertSurfaceFormat" convertSurfaceFormatFFI :: Ptr Surface -> Word32 -> Word32 -> IO (Ptr Surface)
-foreign import ccall "SDL.h SDL_CreateRGBSurface" createRGBSurfaceFFI :: Word32 -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> IO (Ptr Surface)
-foreign import ccall "SDL.h SDL_CreateRGBSurfaceFrom" createRGBSurfaceFromFFI :: Ptr () -> CInt -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> IO (Ptr Surface)
-foreign import ccall "SDL.h SDL_FillRect" fillRectFFI :: Ptr Surface -> Ptr Rect -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_FillRects" fillRectsFFI :: Ptr Surface -> Ptr Rect -> CInt -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_FreeSurface" freeSurfaceFFI :: Ptr Surface -> IO ()
-foreign import ccall "SDL.h SDL_GetClipRect" getClipRectFFI :: Ptr Surface -> Ptr Rect -> IO ()
-foreign import ccall "SDL.h SDL_GetColorKey" getColorKeyFFI :: Ptr Surface -> Ptr Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_GetSurfaceAlphaMod" getSurfaceAlphaModFFI :: Ptr Surface -> Ptr Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_GetSurfaceBlendMode" getSurfaceBlendModeFFI :: Ptr Surface -> Ptr BlendMode -> IO CInt
-foreign import ccall "SDL.h SDL_GetSurfaceColorMod" getSurfaceColorModFFI :: Ptr Surface -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_LoadBMP_RW" loadBMP_RWFFI :: Ptr RWops -> CInt -> IO (Ptr Surface)
-foreign import ccall "SDL.h SDL_LockSurface" lockSurfaceFFI :: Ptr Surface -> IO CInt
-foreign import ccall "SDL.h SDL_LowerBlit" lowerBlitFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_LowerBlitScaled" lowerBlitScaledFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt
-foreign import ccall "SDL.h SDL_SaveBMP_RW" saveBMP_RWFFI :: Ptr Surface -> Ptr RWops -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_SetClipRect" setClipRectFFI :: Ptr Surface -> Ptr Rect -> IO Bool
-foreign import ccall "SDL.h SDL_SetColorKey" setColorKeyFFI :: Ptr Surface -> CInt -> Word32 -> IO CInt
-foreign import ccall "SDL.h SDL_SetSurfaceAlphaMod" setSurfaceAlphaModFFI :: Ptr Surface -> Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_SetSurfaceBlendMode" setSurfaceBlendModeFFI :: Ptr Surface -> BlendMode -> IO CInt
-foreign import ccall "SDL.h SDL_SetSurfaceColorMod" setSurfaceColorModFFI :: Ptr Surface -> Word8 -> Word8 -> Word8 -> IO CInt
-foreign import ccall "SDL.h SDL_SetSurfacePalette" setSurfacePaletteFFI :: Ptr Surface -> Ptr Palette -> IO CInt
-foreign import ccall "SDL.h SDL_SetSurfaceRLE" setSurfaceRLEFFI :: Ptr Surface -> CInt -> IO CInt
-foreign import ccall "SDL.h SDL_UnlockSurface" unlockSurfaceFFI :: Ptr Surface -> IO ()
-
-foreign import ccall "SDL.h SDL_GetWindowWMInfo" getWindowWMInfoFFI :: Window -> SysWMinfo -> IO Bool
-
-foreign import ccall "SDL.h SDL_GetClipboardText" getClipboardTextFFI :: IO CString
-foreign import ccall "SDL.h SDL_HasClipboardText" hasClipboardTextFFI :: IO Bool
-foreign import ccall "SDL.h SDL_SetClipboardText" setClipboardTextFFI :: CString -> IO CInt
-
-createWindow :: MonadIO m => CString -> CInt -> CInt -> CInt -> CInt -> Word32 -> m Window
-createWindow v1 v2 v3 v4 v5 v6 = liftIO $ createWindowFFI v1 v2 v3 v4 v5 v6
-{-# INLINE createWindow #-}
-
-createWindowAndRenderer :: MonadIO m => CInt -> CInt -> Word32 -> Ptr Window -> Ptr Renderer -> m CInt
-createWindowAndRenderer v1 v2 v3 v4 v5 = liftIO $ createWindowAndRendererFFI v1 v2 v3 v4 v5
-{-# INLINE createWindowAndRenderer #-}
-
-createWindowFrom :: MonadIO m => Ptr () -> m Window
-createWindowFrom v1 = liftIO $ createWindowFromFFI v1
-{-# INLINE createWindowFrom #-}
-
-destroyWindow :: MonadIO m => Window -> m ()
-destroyWindow v1 = liftIO $ destroyWindowFFI v1
-{-# INLINE destroyWindow #-}
-
-disableScreenSaver :: MonadIO m => m ()
-disableScreenSaver = liftIO disableScreenSaverFFI
-{-# INLINE disableScreenSaver #-}
-
-enableScreenSaver :: MonadIO m => m ()
-enableScreenSaver = liftIO enableScreenSaverFFI
-{-# INLINE enableScreenSaver #-}
-
-glBindTexture :: MonadIO m => Texture -> Ptr CFloat -> Ptr CFloat -> m CInt
-glBindTexture v1 v2 v3 = liftIO $ glBindTextureFFI v1 v2 v3
-{-# INLINE glBindTexture #-}
-
-glCreateContext :: MonadIO m => Window -> m GLContext
-glCreateContext v1 = liftIO $ glCreateContextFFI v1
-{-# INLINE glCreateContext #-}
-
-glDeleteContext :: MonadIO m => GLContext -> m ()
-glDeleteContext v1 = liftIO $ glDeleteContextFFI v1
-{-# INLINE glDeleteContext #-}
-
-glExtensionSupported :: MonadIO m => CString -> m Bool
-glExtensionSupported v1 = liftIO $ glExtensionSupportedFFI v1
-{-# INLINE glExtensionSupported #-}
-
-glGetAttribute :: MonadIO m => GLattr -> Ptr CInt -> m CInt
-glGetAttribute v1 v2 = liftIO $ glGetAttributeFFI v1 v2
-{-# INLINE glGetAttribute #-}
-
-glGetCurrentContext :: MonadIO m => m GLContext
-glGetCurrentContext = liftIO glGetCurrentContextFFI
-{-# INLINE glGetCurrentContext #-}
-
-glGetCurrentWindow :: MonadIO m => m Window
-glGetCurrentWindow = liftIO glGetCurrentWindowFFI
-{-# INLINE glGetCurrentWindow #-}
-
-glGetDrawableSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()
-glGetDrawableSize v1 v2 v3 = liftIO $ glGetDrawableSizeFFI v1 v2 v3
-{-# INLINE glGetDrawableSize #-}
-
-glGetProcAddress :: MonadIO m => CString -> m (Ptr ())
-glGetProcAddress v1 = liftIO $ glGetProcAddressFFI v1
-{-# INLINE glGetProcAddress #-}
-
-glGetSwapInterval :: MonadIO m => m CInt
-glGetSwapInterval = liftIO glGetSwapIntervalFFI
-{-# INLINE glGetSwapInterval #-}
-
-glLoadLibrary :: MonadIO m => CString -> m CInt
-glLoadLibrary v1 = liftIO $ glLoadLibraryFFI v1
-{-# INLINE glLoadLibrary #-}
-
-glMakeCurrent :: MonadIO m => Window -> GLContext -> m CInt
-glMakeCurrent v1 v2 = liftIO $ glMakeCurrentFFI v1 v2
-{-# INLINE glMakeCurrent #-}
-
-glResetAttributes :: MonadIO m => m ()
-glResetAttributes = liftIO glResetAttributesFFI
-{-# INLINE glResetAttributes #-}
-
-glSetAttribute :: MonadIO m => GLattr -> CInt -> m CInt
-glSetAttribute v1 v2 = liftIO $ glSetAttributeFFI v1 v2
-{-# INLINE glSetAttribute #-}
-
-glSetSwapInterval :: MonadIO m => CInt -> m CInt
-glSetSwapInterval v1 = liftIO $ glSetSwapIntervalFFI v1
-{-# INLINE glSetSwapInterval #-}
-
-glSwapWindow :: MonadIO m => Window -> m ()
-glSwapWindow v1 = liftIO $ glSwapWindowFFI v1
-{-# INLINE glSwapWindow #-}
-
-glUnbindTexture :: MonadIO m => Texture -> m CInt
-glUnbindTexture v1 = liftIO $ glUnbindTextureFFI v1
-{-# INLINE glUnbindTexture #-}
-
-glUnloadLibrary :: MonadIO m => m ()
-glUnloadLibrary = liftIO glUnloadLibraryFFI
-{-# INLINE glUnloadLibrary #-}
-
-getClosestDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> Ptr DisplayMode -> m (Ptr DisplayMode)
-getClosestDisplayMode v1 v2 v3 = liftIO $ getClosestDisplayModeFFI v1 v2 v3
-{-# INLINE getClosestDisplayMode #-}
-
-getCurrentDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> m CInt
-getCurrentDisplayMode v1 v2 = liftIO $ getCurrentDisplayModeFFI v1 v2
-{-# INLINE getCurrentDisplayMode #-}
-
-getCurrentVideoDriver :: MonadIO m => m CString
-getCurrentVideoDriver = liftIO getCurrentVideoDriverFFI
-{-# INLINE getCurrentVideoDriver #-}
-
-getDesktopDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> m CInt
-getDesktopDisplayMode v1 v2 = liftIO $ getDesktopDisplayModeFFI v1 v2
-{-# INLINE getDesktopDisplayMode #-}
-
-getDisplayBounds :: MonadIO m => CInt -> Ptr Rect -> m CInt
-getDisplayBounds v1 v2 = liftIO $ getDisplayBoundsFFI v1 v2
-{-# INLINE getDisplayBounds #-}
-
-getDisplayDPI :: MonadIO m => CInt -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> m CInt
-getDisplayDPI v1 v2 v3 v4 = liftIO $ getDisplayDPIFFI v1 v2 v3 v4
-{-# INLINE getDisplayDPI #-}
-
-getDisplayMode :: MonadIO m => CInt -> CInt -> Ptr DisplayMode -> m CInt
-getDisplayMode v1 v2 v3 = liftIO $ getDisplayModeFFI v1 v2 v3
-{-# INLINE getDisplayMode #-}
-
-getDisplayName :: MonadIO m => CInt -> m CString
-getDisplayName v1 = liftIO $ getDisplayNameFFI v1
-{-# INLINE getDisplayName #-}
-
-getGrabbedWindow :: MonadIO m => m Window
-getGrabbedWindow = liftIO getGrabbedWindowFFI
-{-# INLINE getGrabbedWindow #-}
-
-getNumDisplayModes :: MonadIO m => CInt -> m CInt
-getNumDisplayModes v1 = liftIO $ getNumDisplayModesFFI v1
-{-# INLINE getNumDisplayModes #-}
-
-getNumVideoDisplays :: MonadIO m => m CInt
-getNumVideoDisplays = liftIO getNumVideoDisplaysFFI
-{-# INLINE getNumVideoDisplays #-}
-
-getNumVideoDrivers :: MonadIO m => m CInt
-getNumVideoDrivers = liftIO getNumVideoDriversFFI
-{-# INLINE getNumVideoDrivers #-}
-
-getVideoDriver :: MonadIO m => CInt -> m CString
-getVideoDriver v1 = liftIO $ getVideoDriverFFI v1
-{-# INLINE getVideoDriver #-}
-
-getWindowBrightness :: MonadIO m => Window -> m CFloat
-getWindowBrightness v1 = liftIO $ getWindowBrightnessFFI v1
-{-# INLINE getWindowBrightness #-}
-
-getWindowData :: MonadIO m => Window -> CString -> m (Ptr ())
-getWindowData v1 v2 = liftIO $ getWindowDataFFI v1 v2
-{-# INLINE getWindowData #-}
-
-getWindowDisplayIndex :: MonadIO m => Window -> m CInt
-getWindowDisplayIndex v1 = liftIO $ getWindowDisplayIndexFFI v1
-{-# INLINE getWindowDisplayIndex #-}
-
-getWindowDisplayMode :: MonadIO m => Window -> Ptr DisplayMode -> m CInt
-getWindowDisplayMode v1 v2 = liftIO $ getWindowDisplayModeFFI v1 v2
-{-# INLINE getWindowDisplayMode #-}
-
-getWindowFlags :: MonadIO m => Window -> m Word32
-getWindowFlags v1 = liftIO $ getWindowFlagsFFI v1
-{-# INLINE getWindowFlags #-}
-
-getWindowFromID :: MonadIO m => Word32 -> m Window
-getWindowFromID v1 = liftIO $ getWindowFromIDFFI v1
-{-# INLINE getWindowFromID #-}
-
-getWindowGammaRamp :: MonadIO m => Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> m CInt
-getWindowGammaRamp v1 v2 v3 v4 = liftIO $ getWindowGammaRampFFI v1 v2 v3 v4
-{-# INLINE getWindowGammaRamp #-}
-
-getWindowGrab :: MonadIO m => Window -> m Bool
-getWindowGrab v1 = liftIO $ getWindowGrabFFI v1
-{-# INLINE getWindowGrab #-}
-
-getWindowID :: MonadIO m => Window -> m Word32
-getWindowID v1 = liftIO $ getWindowIDFFI v1
-{-# INLINE getWindowID #-}
-
-getWindowMaximumSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()
-getWindowMaximumSize v1 v2 v3 = liftIO $ getWindowMaximumSizeFFI v1 v2 v3
-{-# INLINE getWindowMaximumSize #-}
-
-getWindowMinimumSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()
-getWindowMinimumSize v1 v2 v3 = liftIO $ getWindowMinimumSizeFFI v1 v2 v3
-{-# INLINE getWindowMinimumSize #-}
-
-getWindowPixelFormat :: MonadIO m => Window -> m Word32
-getWindowPixelFormat v1 = liftIO $ getWindowPixelFormatFFI v1
-{-# INLINE getWindowPixelFormat #-}
-
-getWindowPosition :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()
-getWindowPosition v1 v2 v3 = liftIO $ getWindowPositionFFI v1 v2 v3
-{-# INLINE getWindowPosition #-}
-
-getWindowSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()
-getWindowSize v1 v2 v3 = liftIO $ getWindowSizeFFI v1 v2 v3
-{-# INLINE getWindowSize #-}
-
-getWindowSurface :: MonadIO m => Window -> m (Ptr Surface)
-getWindowSurface v1 = liftIO $ getWindowSurfaceFFI v1
-{-# INLINE getWindowSurface #-}
-
-getWindowTitle :: MonadIO m => Window -> m CString
-getWindowTitle v1 = liftIO $ getWindowTitleFFI v1
-{-# INLINE getWindowTitle #-}
-
-hideWindow :: MonadIO m => Window -> m ()
-hideWindow v1 = liftIO $ hideWindowFFI v1
-{-# INLINE hideWindow #-}
-
-isScreenSaverEnabled :: MonadIO m => m Bool
-isScreenSaverEnabled = liftIO isScreenSaverEnabledFFI
-{-# INLINE isScreenSaverEnabled #-}
-
-maximizeWindow :: MonadIO m => Window -> m ()
-maximizeWindow v1 = liftIO $ maximizeWindowFFI v1
-{-# INLINE maximizeWindow #-}
-
-minimizeWindow :: MonadIO m => Window -> m ()
-minimizeWindow v1 = liftIO $ minimizeWindowFFI v1
-{-# INLINE minimizeWindow #-}
-
-raiseWindow :: MonadIO m => Window -> m ()
-raiseWindow v1 = liftIO $ raiseWindowFFI v1
-{-# INLINE raiseWindow #-}
-
-restoreWindow :: MonadIO m => Window -> m ()
-restoreWindow v1 = liftIO $ restoreWindowFFI v1
-{-# INLINE restoreWindow #-}
-
-setWindowBordered :: MonadIO m => Window -> Bool -> m ()
-setWindowBordered v1 v2 = liftIO $ setWindowBorderedFFI v1 v2
-{-# INLINE setWindowBordered #-}
-
-setWindowBrightness :: MonadIO m => Window -> CFloat -> m CInt
-setWindowBrightness v1 v2 = liftIO $ setWindowBrightnessFFI v1 v2
-{-# INLINE setWindowBrightness #-}
-
-setWindowData :: MonadIO m => Window -> CString -> Ptr () -> m (Ptr ())
-setWindowData v1 v2 v3 = liftIO $ setWindowDataFFI v1 v2 v3
-{-# INLINE setWindowData #-}
-
-setWindowDisplayMode :: MonadIO m => Window -> Ptr DisplayMode -> m CInt
-setWindowDisplayMode v1 v2 = liftIO $ setWindowDisplayModeFFI v1 v2
-{-# INLINE setWindowDisplayMode #-}
-
-setWindowFullscreen :: MonadIO m => Window -> Word32 -> m CInt
-setWindowFullscreen v1 v2 = liftIO $ setWindowFullscreenFFI v1 v2
-{-# INLINE setWindowFullscreen #-}
-
-setWindowGammaRamp :: MonadIO m => Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> m CInt
-setWindowGammaRamp v1 v2 v3 v4 = liftIO $ setWindowGammaRampFFI v1 v2 v3 v4
-{-# INLINE setWindowGammaRamp #-}
-
-setWindowGrab :: MonadIO m => Window -> Bool -> m ()
-setWindowGrab v1 v2 = liftIO $ setWindowGrabFFI v1 v2
-{-# INLINE setWindowGrab #-}
-
-setWindowIcon :: MonadIO m => Window -> Ptr Surface -> m ()
-setWindowIcon v1 v2 = liftIO $ setWindowIconFFI v1 v2
-{-# INLINE setWindowIcon #-}
-
-setWindowMaximumSize :: MonadIO m => Window -> CInt -> CInt -> m ()
-setWindowMaximumSize v1 v2 v3 = liftIO $ setWindowMaximumSizeFFI v1 v2 v3
-{-# INLINE setWindowMaximumSize #-}
-
-setWindowMinimumSize :: MonadIO m => Window -> CInt -> CInt -> m ()
-setWindowMinimumSize v1 v2 v3 = liftIO $ setWindowMinimumSizeFFI v1 v2 v3
-{-# INLINE setWindowMinimumSize #-}
-
-setWindowPosition :: MonadIO m => Window -> CInt -> CInt -> m ()
-setWindowPosition v1 v2 v3 = liftIO $ setWindowPositionFFI v1 v2 v3
-{-# INLINE setWindowPosition #-}
-
-setWindowSize :: MonadIO m => Window -> CInt -> CInt -> m ()
-setWindowSize v1 v2 v3 = liftIO $ setWindowSizeFFI v1 v2 v3
-{-# INLINE setWindowSize #-}
-
-setWindowTitle :: MonadIO m => Window -> CString -> m ()
-setWindowTitle v1 v2 = liftIO $ setWindowTitleFFI v1 v2
-{-# INLINE setWindowTitle #-}
-
-showMessageBox :: MonadIO m => Ptr MessageBoxData -> Ptr CInt -> m CInt
-showMessageBox v1 v2 = liftIO $ showMessageBoxFFI v1 v2
-{-# INLINE showMessageBox #-}
-
-showSimpleMessageBox :: MonadIO m => Word32 -> CString -> CString -> Window -> m CInt
-showSimpleMessageBox v1 v2 v3 v4 = liftIO $ showSimpleMessageBoxFFI v1 v2 v3 v4
-{-# INLINE showSimpleMessageBox #-}
-
-showWindow :: MonadIO m => Window -> m ()
-showWindow v1 = liftIO $ showWindowFFI v1
-{-# INLINE showWindow #-}
-
-updateWindowSurface :: MonadIO m => Window -> m CInt
-updateWindowSurface v1 = liftIO $ updateWindowSurfaceFFI v1
-{-# INLINE updateWindowSurface #-}
-
-updateWindowSurfaceRects :: MonadIO m => Window -> Ptr Rect -> CInt -> m CInt
-updateWindowSurfaceRects v1 v2 v3 = liftIO $ updateWindowSurfaceRectsFFI v1 v2 v3
-{-# INLINE updateWindowSurfaceRects #-}
-
-videoInit :: MonadIO m => CString -> m CInt
-videoInit v1 = liftIO $ videoInitFFI v1
-{-# INLINE videoInit #-}
-
-videoQuit :: MonadIO m => m ()
-videoQuit = liftIO videoQuitFFI
-{-# INLINE videoQuit #-}
-
-createRenderer :: MonadIO m => Window -> CInt -> Word32 -> m Renderer
-createRenderer v1 v2 v3 = liftIO $ createRendererFFI v1 v2 v3
-{-# INLINE createRenderer #-}
-
-createSoftwareRenderer :: MonadIO m => Ptr Surface -> m Renderer
-createSoftwareRenderer v1 = liftIO $ createSoftwareRendererFFI v1
-{-# INLINE createSoftwareRenderer #-}
-
-createTexture :: MonadIO m => Renderer -> Word32 -> CInt -> CInt -> CInt -> m Texture
-createTexture v1 v2 v3 v4 v5 = liftIO $ createTextureFFI v1 v2 v3 v4 v5
-{-# INLINE createTexture #-}
-
-createTextureFromSurface :: MonadIO m => Renderer -> Ptr Surface -> m Texture
-createTextureFromSurface v1 v2 = liftIO $ createTextureFromSurfaceFFI v1 v2
-{-# INLINE createTextureFromSurface #-}
-
-destroyRenderer :: MonadIO m => Renderer -> m ()
-destroyRenderer v1 = liftIO $ destroyRendererFFI v1
-{-# INLINE destroyRenderer #-}
-
-destroyTexture :: MonadIO m => Texture -> m ()
-destroyTexture v1 = liftIO $ destroyTextureFFI v1
-{-# INLINE destroyTexture #-}
-
-getNumRenderDrivers :: MonadIO m => m CInt
-getNumRenderDrivers = liftIO getNumRenderDriversFFI
-{-# INLINE getNumRenderDrivers #-}
-
-getRenderDrawBlendMode :: MonadIO m => Renderer -> Ptr BlendMode -> m Int
-getRenderDrawBlendMode v1 v2 = liftIO $ getRenderDrawBlendModeFFI v1 v2
-{-# INLINE getRenderDrawBlendMode #-}
-
-getRenderDrawColor :: MonadIO m => Renderer -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m CInt
-getRenderDrawColor v1 v2 v3 v4 v5 = liftIO $ getRenderDrawColorFFI v1 v2 v3 v4 v5
-{-# INLINE getRenderDrawColor #-}
-
-getRenderDriverInfo :: MonadIO m => CInt -> Ptr RendererInfo -> m CInt
-getRenderDriverInfo v1 v2 = liftIO $ getRenderDriverInfoFFI v1 v2
-{-# INLINE getRenderDriverInfo #-}
-
-getRenderTarget :: MonadIO m => Renderer -> m Texture
-getRenderTarget v1 = liftIO $ getRenderTargetFFI v1
-{-# INLINE getRenderTarget #-}
-
-getRenderer :: MonadIO m => Window -> m Renderer
-getRenderer v1 = liftIO $ getRendererFFI v1
-{-# INLINE getRenderer #-}
-
-getRendererInfo :: MonadIO m => Renderer -> Ptr RendererInfo -> m CInt
-getRendererInfo v1 v2 = liftIO $ getRendererInfoFFI v1 v2
-{-# INLINE getRendererInfo #-}
-
-getRendererOutputSize :: MonadIO m => Renderer -> Ptr CInt -> Ptr CInt -> m CInt
-getRendererOutputSize v1 v2 v3 = liftIO $ getRendererOutputSizeFFI v1 v2 v3
-{-# INLINE getRendererOutputSize #-}
-
-getTextureAlphaMod :: MonadIO m => Texture -> Ptr Word8 -> m CInt
-getTextureAlphaMod v1 v2 = liftIO $ getTextureAlphaModFFI v1 v2
-{-# INLINE getTextureAlphaMod #-}
-
-getTextureBlendMode :: MonadIO m => Texture -> Ptr BlendMode -> m CInt
-getTextureBlendMode v1 v2 = liftIO $ getTextureBlendModeFFI v1 v2
-{-# INLINE getTextureBlendMode #-}
-
-getTextureColorMod :: MonadIO m => Texture -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m CInt
-getTextureColorMod v1 v2 v3 v4 = liftIO $ getTextureColorModFFI v1 v2 v3 v4
-{-# INLINE getTextureColorMod #-}
-
-lockTexture :: MonadIO m => Texture -> Ptr Rect -> Ptr (Ptr ()) -> Ptr CInt -> m CInt
-lockTexture v1 v2 v3 v4 = liftIO $ lockTextureFFI v1 v2 v3 v4
-{-# INLINE lockTexture #-}
-
-queryTexture :: MonadIO m => Texture -> Ptr Word32 -> Ptr CInt -> Ptr CInt -> Ptr CInt -> m CInt
-queryTexture v1 v2 v3 v4 v5 = liftIO $ queryTextureFFI v1 v2 v3 v4 v5
-{-# INLINE queryTexture #-}
-
-renderClear :: MonadIO m => Renderer -> m CInt
-renderClear v1 = liftIO $ renderClearFFI v1
-{-# INLINE renderClear #-}
-
-renderCopy :: MonadIO m => Renderer -> Texture -> Ptr Rect -> Ptr Rect -> m CInt
-renderCopy v1 v2 v3 v4 = liftIO $ renderCopyFFI v1 v2 v3 v4
-{-# INLINE renderCopy #-}
-
-renderCopyEx :: MonadIO m => Renderer -> Texture -> Ptr Rect -> Ptr Rect -> CDouble -> Ptr Point -> RendererFlip -> m CInt
-renderCopyEx v1 v2 v3 v4 v5 v6 v7 = liftIO $ renderCopyExFFI v1 v2 v3 v4 v5 v6 v7
-{-# INLINE renderCopyEx #-}
-
-renderDrawLine :: MonadIO m => Renderer -> CInt -> CInt -> CInt -> CInt -> m CInt
-renderDrawLine v1 v2 v3 v4 v5 = liftIO $ renderDrawLineFFI v1 v2 v3 v4 v5
-{-# INLINE renderDrawLine #-}
-
-renderDrawLines :: MonadIO m => Renderer -> Ptr Point -> CInt -> m CInt
-renderDrawLines v1 v2 v3 = liftIO $ renderDrawLinesFFI v1 v2 v3
-{-# INLINE renderDrawLines #-}
-
-renderDrawPoint :: MonadIO m => Renderer -> CInt -> CInt -> m CInt
-renderDrawPoint v1 v2 v3 = liftIO $ renderDrawPointFFI v1 v2 v3
-{-# INLINE renderDrawPoint #-}
-
-renderDrawPoints :: MonadIO m => Renderer -> Ptr Point -> CInt -> m CInt
-renderDrawPoints v1 v2 v3 = liftIO $ renderDrawPointsFFI v1 v2 v3
-{-# INLINE renderDrawPoints #-}
-
-renderDrawRect :: MonadIO m => Renderer -> Ptr Rect -> m CInt
-renderDrawRect v1 v2 = liftIO $ renderDrawRectFFI v1 v2
-{-# INLINE renderDrawRect #-}
-
-renderDrawRects :: MonadIO m => Renderer -> Ptr Rect -> CInt -> m CInt
-renderDrawRects v1 v2 v3 = liftIO $ renderDrawRectsFFI v1 v2 v3
-{-# INLINE renderDrawRects #-}
-
-renderFillRect :: MonadIO m => Renderer -> Ptr Rect -> m CInt
-renderFillRect v1 v2 = liftIO $ renderFillRectFFI v1 v2
-{-# INLINE renderFillRect #-}
-
-renderFillRects :: MonadIO m => Renderer -> Ptr Rect -> CInt -> m CInt
-renderFillRects v1 v2 v3 = liftIO $ renderFillRectsFFI v1 v2 v3
-{-# INLINE renderFillRects #-}
-
-renderGetClipRect :: MonadIO m => Renderer -> Ptr Rect -> m ()
-renderGetClipRect v1 v2 = liftIO $ renderGetClipRectFFI v1 v2
-{-# INLINE renderGetClipRect #-}
-
-renderGetLogicalSize :: MonadIO m => Renderer -> Ptr CInt -> Ptr CInt -> m ()
-renderGetLogicalSize v1 v2 v3 = liftIO $ renderGetLogicalSizeFFI v1 v2 v3
-{-# INLINE renderGetLogicalSize #-}
-
-renderGetScale :: MonadIO m => Renderer -> Ptr CFloat -> Ptr CFloat -> m ()
-renderGetScale v1 v2 v3 = liftIO $ renderGetScaleFFI v1 v2 v3
-{-# INLINE renderGetScale #-}
-
-renderGetViewport :: MonadIO m => Renderer -> Ptr Rect -> m ()
-renderGetViewport v1 v2 = liftIO $ renderGetViewportFFI v1 v2
-{-# INLINE renderGetViewport #-}
-
-renderIsClipEnabled :: MonadIO m => Renderer -> m Bool
-renderIsClipEnabled v1 = liftIO $ renderIsClipEnabledFFI v1
-{-# INLINE renderIsClipEnabled #-}
-
-renderPresent :: MonadIO m => Renderer -> m ()
-renderPresent v1 = liftIO $ renderPresentFFI v1
-{-# INLINE renderPresent #-}
-
-renderReadPixels :: MonadIO m => Renderer -> Ptr Rect -> Word32 -> Ptr () -> CInt -> m CInt
-renderReadPixels v1 v2 v3 v4 v5 = liftIO $ renderReadPixelsFFI v1 v2 v3 v4 v5
-{-# INLINE renderReadPixels #-}
-
-renderSetClipRect :: MonadIO m => Renderer -> Ptr Rect -> m CInt
-renderSetClipRect v1 v2 = liftIO $ renderSetClipRectFFI v1 v2
-{-# INLINE renderSetClipRect #-}
-
-renderSetLogicalSize :: MonadIO m => Renderer -> CInt -> CInt -> m CInt
-renderSetLogicalSize v1 v2 v3 = liftIO $ renderSetLogicalSizeFFI v1 v2 v3
-{-# INLINE renderSetLogicalSize #-}
-
-renderSetScale :: MonadIO m => Renderer -> CFloat -> CFloat -> m CInt
-renderSetScale v1 v2 v3 = liftIO $ renderSetScaleFFI v1 v2 v3
-{-# INLINE renderSetScale #-}
-
-renderSetViewport :: MonadIO m => Renderer -> Ptr Rect -> m CInt
-renderSetViewport v1 v2 = liftIO $ renderSetViewportFFI v1 v2
-{-# INLINE renderSetViewport #-}
-
-renderTargetSupported :: MonadIO m => Renderer -> m Bool
-renderTargetSupported v1 = liftIO $ renderTargetSupportedFFI v1
-{-# INLINE renderTargetSupported #-}
-
-setRenderDrawBlendMode :: MonadIO m => Renderer -> BlendMode -> m CInt
-setRenderDrawBlendMode v1 v2 = liftIO $ setRenderDrawBlendModeFFI v1 v2
-{-# INLINE setRenderDrawBlendMode #-}
-
-setRenderDrawColor :: MonadIO m => Renderer -> Word8 -> Word8 -> Word8 -> Word8 -> m CInt
-setRenderDrawColor v1 v2 v3 v4 v5 = liftIO $ setRenderDrawColorFFI v1 v2 v3 v4 v5
-{-# INLINE setRenderDrawColor #-}
-
-setRenderTarget :: MonadIO m => Renderer -> Texture -> m CInt
-setRenderTarget v1 v2 = liftIO $ setRenderTargetFFI v1 v2
-{-# INLINE setRenderTarget #-}
-
-setTextureAlphaMod :: MonadIO m => Texture -> Word8 -> m CInt
-setTextureAlphaMod v1 v2 = liftIO $ setTextureAlphaModFFI v1 v2
-{-# INLINE setTextureAlphaMod #-}
-
-setTextureBlendMode :: MonadIO m => Texture -> BlendMode -> m CInt
-setTextureBlendMode v1 v2 = liftIO $ setTextureBlendModeFFI v1 v2
-{-# INLINE setTextureBlendMode #-}
-
-setTextureColorMod :: MonadIO m => Texture -> Word8 -> Word8 -> Word8 -> m CInt
-setTextureColorMod v1 v2 v3 v4 = liftIO $ setTextureColorModFFI v1 v2 v3 v4
-{-# INLINE setTextureColorMod #-}
-
-unlockTexture :: MonadIO m => Texture -> m ()
-unlockTexture v1 = liftIO $ unlockTextureFFI v1
-{-# INLINE unlockTexture #-}
-
-updateTexture :: MonadIO m => Texture -> Ptr Rect -> Ptr () -> CInt -> m CInt
-updateTexture v1 v2 v3 v4 = liftIO $ updateTextureFFI v1 v2 v3 v4
-{-# INLINE updateTexture #-}
-
-updateYUVTexture :: MonadIO m => Texture -> Ptr Rect -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> m CInt
-updateYUVTexture v1 v2 v3 v4 v5 v6 v7 v8 = liftIO $ updateYUVTextureFFI v1 v2 v3 v4 v5 v6 v7 v8
-{-# INLINE updateYUVTexture #-}
-
-allocFormat :: MonadIO m => Word32 -> m (Ptr PixelFormat)
-allocFormat v1 = liftIO $ allocFormatFFI v1
-{-# INLINE allocFormat #-}
-
-allocPalette :: MonadIO m => CInt -> m (Ptr Palette)
-allocPalette v1 = liftIO $ allocPaletteFFI v1
-{-# INLINE allocPalette #-}
-
-calculateGammaRamp :: MonadIO m => CFloat -> Ptr Word16 -> m ()
-calculateGammaRamp v1 v2 = liftIO $ calculateGammaRampFFI v1 v2
-{-# INLINE calculateGammaRamp #-}
-
-freeFormat :: MonadIO m => Ptr PixelFormat -> m ()
-freeFormat v1 = liftIO $ freeFormatFFI v1
-{-# INLINE freeFormat #-}
-
-freePalette :: MonadIO m => Ptr Palette -> m ()
-freePalette v1 = liftIO $ freePaletteFFI v1
-{-# INLINE freePalette #-}
-
-getPixelFormatName :: MonadIO m => Word32 -> m CString
-getPixelFormatName v1 = liftIO $ getPixelFormatNameFFI v1
-{-# INLINE getPixelFormatName #-}
-
-getRGB :: MonadIO m => Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m ()
-getRGB v1 v2 v3 v4 v5 = liftIO $ getRGBFFI v1 v2 v3 v4 v5
-{-# INLINE getRGB #-}
-
-getRGBA :: MonadIO m => Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m ()
-getRGBA v1 v2 v3 v4 v5 v6 = liftIO $ getRGBAFFI v1 v2 v3 v4 v5 v6
-{-# INLINE getRGBA #-}
-
-mapRGB :: MonadIO m => Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> m Word32
-mapRGB v1 v2 v3 v4 = liftIO $ mapRGBFFI v1 v2 v3 v4
-{-# INLINE mapRGB #-}
-
-mapRGBA :: MonadIO m => Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> Word8 -> m Word32
-mapRGBA v1 v2 v3 v4 v5 = liftIO $ mapRGBAFFI v1 v2 v3 v4 v5
-{-# INLINE mapRGBA #-}
-
-masksToPixelFormatEnum :: MonadIO m => CInt -> Word32 -> Word32 -> Word32 -> Word32 -> m Word32
-masksToPixelFormatEnum v1 v2 v3 v4 v5 = liftIO $ masksToPixelFormatEnumFFI v1 v2 v3 v4 v5
-{-# INLINE masksToPixelFormatEnum #-}
-
-pixelFormatEnumToMasks :: MonadIO m => Word32 -> Ptr CInt -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> m Bool
-pixelFormatEnumToMasks v1 v2 v3 v4 v5 v6 = liftIO $ pixelFormatEnumToMasksFFI v1 v2 v3 v4 v5 v6
-{-# INLINE pixelFormatEnumToMasks #-}
-
-setPaletteColors :: MonadIO m => Ptr Palette -> Ptr Color -> CInt -> CInt -> m CInt
-setPaletteColors v1 v2 v3 v4 = liftIO $ setPaletteColorsFFI v1 v2 v3 v4
-{-# INLINE setPaletteColors #-}
-
-setPixelFormatPalette :: MonadIO m => Ptr PixelFormat -> Ptr Palette -> m CInt
-setPixelFormatPalette v1 v2 = liftIO $ setPixelFormatPaletteFFI v1 v2
-{-# INLINE setPixelFormatPalette #-}
-
-enclosePoints :: MonadIO m => Ptr Point -> CInt -> Ptr Rect -> Ptr Rect -> m Bool
-enclosePoints v1 v2 v3 v4 = liftIO $ enclosePointsFFI v1 v2 v3 v4
-{-# INLINE enclosePoints #-}
-
-hasIntersection :: MonadIO m => Ptr Rect -> Ptr Rect -> m Bool
-hasIntersection v1 v2 = liftIO $ hasIntersectionFFI v1 v2
-{-# INLINE hasIntersection #-}
-
-intersectRect :: MonadIO m => Ptr Rect -> Ptr Rect -> Ptr Rect -> m Bool
-intersectRect v1 v2 v3 = liftIO $ intersectRectFFI v1 v2 v3
-{-# INLINE intersectRect #-}
-
-intersectRectAndLine :: MonadIO m => Ptr Rect -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> m Bool
-intersectRectAndLine v1 v2 v3 v4 v5 = liftIO $ intersectRectAndLineFFI v1 v2 v3 v4 v5
-{-# INLINE intersectRectAndLine #-}
-
-unionRect :: MonadIO m => Ptr Rect -> Ptr Rect -> Ptr Rect -> m ()
-unionRect v1 v2 v3 = liftIO $ unionRectFFI v1 v2 v3
-{-# INLINE unionRect #-}
-
-blitScaled :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt
-blitScaled v1 v2 v3 v4 = liftIO $ blitScaledFFI v1 v2 v3 v4
-{-# INLINE blitScaled #-}
-
-blitSurface :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt
-blitSurface v1 v2 v3 v4 = liftIO $ blitSurfaceFFI v1 v2 v3 v4
-{-# INLINE blitSurface #-}
-
-convertPixels :: MonadIO m => CInt -> CInt -> Word32 -> Ptr () -> CInt -> Word32 -> Ptr () -> CInt -> m CInt
-convertPixels v1 v2 v3 v4 v5 v6 v7 v8 = liftIO $ convertPixelsFFI v1 v2 v3 v4 v5 v6 v7 v8
-{-# INLINE convertPixels #-}
-
-convertSurface :: MonadIO m => Ptr Surface -> Ptr PixelFormat -> Word32 -> m (Ptr Surface)
-convertSurface v1 v2 v3 = liftIO $ convertSurfaceFFI v1 v2 v3
-{-# INLINE convertSurface #-}
-
-convertSurfaceFormat :: MonadIO m => Ptr Surface -> Word32 -> Word32 -> m (Ptr Surface)
-convertSurfaceFormat v1 v2 v3 = liftIO $ convertSurfaceFormatFFI v1 v2 v3
-{-# INLINE convertSurfaceFormat #-}
-
-createRGBSurface :: MonadIO m => Word32 -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> m (Ptr Surface)
-createRGBSurface v1 v2 v3 v4 v5 v6 v7 v8 = liftIO $ createRGBSurfaceFFI v1 v2 v3 v4 v5 v6 v7 v8
-{-# INLINE createRGBSurface #-}
-
-createRGBSurfaceFrom :: MonadIO m => Ptr () -> CInt -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> m (Ptr Surface)
-createRGBSurfaceFrom v1 v2 v3 v4 v5 v6 v7 v8 v9 = liftIO $ createRGBSurfaceFromFFI v1 v2 v3 v4 v5 v6 v7 v8 v9
-{-# INLINE createRGBSurfaceFrom #-}
-
-fillRect :: MonadIO m => Ptr Surface -> Ptr Rect -> Word32 -> m CInt
-fillRect v1 v2 v3 = liftIO $ fillRectFFI v1 v2 v3
-{-# INLINE fillRect #-}
-
-fillRects :: MonadIO m => Ptr Surface -> Ptr Rect -> CInt -> Word32 -> m CInt
-fillRects v1 v2 v3 v4 = liftIO $ fillRectsFFI v1 v2 v3 v4
-{-# INLINE fillRects #-}
-
-freeSurface :: MonadIO m => Ptr Surface -> m ()
-freeSurface v1 = liftIO $ freeSurfaceFFI v1
-{-# INLINE freeSurface #-}
-
-getClipRect :: MonadIO m => Ptr Surface -> Ptr Rect -> m ()
-getClipRect v1 v2 = liftIO $ getClipRectFFI v1 v2
-{-# INLINE getClipRect #-}
-
-getColorKey :: MonadIO m => Ptr Surface -> Ptr Word32 -> m CInt
-getColorKey v1 v2 = liftIO $ getColorKeyFFI v1 v2
-{-# INLINE getColorKey #-}
-
-getSurfaceAlphaMod :: MonadIO m => Ptr Surface -> Ptr Word8 -> m CInt
-getSurfaceAlphaMod v1 v2 = liftIO $ getSurfaceAlphaModFFI v1 v2
-{-# INLINE getSurfaceAlphaMod #-}
-
-getSurfaceBlendMode :: MonadIO m => Ptr Surface -> Ptr BlendMode -> m CInt
-getSurfaceBlendMode v1 v2 = liftIO $ getSurfaceBlendModeFFI v1 v2
-{-# INLINE getSurfaceBlendMode #-}
-
-getSurfaceColorMod :: MonadIO m => Ptr Surface -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m CInt
-getSurfaceColorMod v1 v2 v3 v4 = liftIO $ getSurfaceColorModFFI v1 v2 v3 v4
-{-# INLINE getSurfaceColorMod #-}
-
-loadBMP :: MonadIO m => CString -> m (Ptr Surface)
-loadBMP file = liftIO $ do
-  rw <- withCString "rb" $ rwFromFile file
-  loadBMP_RW rw 1
-{-# INLINE loadBMP #-}
-
-loadBMP_RW :: MonadIO m => Ptr RWops -> CInt -> m (Ptr Surface)
-loadBMP_RW v1 v2 = liftIO $ loadBMP_RWFFI v1 v2
-{-# INLINE loadBMP_RW #-}
-
-lockSurface :: MonadIO m => Ptr Surface -> m CInt
-lockSurface v1 = liftIO $ lockSurfaceFFI v1
-{-# INLINE lockSurface #-}
-
-lowerBlit :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt
-lowerBlit v1 v2 v3 v4 = liftIO $ lowerBlitFFI v1 v2 v3 v4
-{-# INLINE lowerBlit #-}
-
-lowerBlitScaled :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt
-lowerBlitScaled v1 v2 v3 v4 = liftIO $ lowerBlitScaledFFI v1 v2 v3 v4
-{-# INLINE lowerBlitScaled #-}
-
-saveBMP :: MonadIO m => Ptr Surface -> CString -> m CInt
-saveBMP surface file = liftIO $ do
-  rw <- withCString "wb" $ rwFromFile file
-  saveBMP_RW surface rw 1
-{-# INLINE saveBMP #-}
-
-saveBMP_RW :: MonadIO m => Ptr Surface -> Ptr RWops -> CInt -> m CInt
-saveBMP_RW v1 v2 v3 = liftIO $ saveBMP_RWFFI v1 v2 v3
-{-# INLINE saveBMP_RW #-}
-
-setClipRect :: MonadIO m => Ptr Surface -> Ptr Rect -> m Bool
-setClipRect v1 v2 = liftIO $ setClipRectFFI v1 v2
-{-# INLINE setClipRect #-}
-
-setColorKey :: MonadIO m => Ptr Surface -> CInt -> Word32 -> m CInt
-setColorKey v1 v2 v3 = liftIO $ setColorKeyFFI v1 v2 v3
-{-# INLINE setColorKey #-}
-
-setSurfaceAlphaMod :: MonadIO m => Ptr Surface -> Word8 -> m CInt
-setSurfaceAlphaMod v1 v2 = liftIO $ setSurfaceAlphaModFFI v1 v2
-{-# INLINE setSurfaceAlphaMod #-}
-
-setSurfaceBlendMode :: MonadIO m => Ptr Surface -> BlendMode -> m CInt
-setSurfaceBlendMode v1 v2 = liftIO $ setSurfaceBlendModeFFI v1 v2
-{-# INLINE setSurfaceBlendMode #-}
-
-setSurfaceColorMod :: MonadIO m => Ptr Surface -> Word8 -> Word8 -> Word8 -> m CInt
-setSurfaceColorMod v1 v2 v3 v4 = liftIO $ setSurfaceColorModFFI v1 v2 v3 v4
-{-# INLINE setSurfaceColorMod #-}
-
-setSurfacePalette :: MonadIO m => Ptr Surface -> Ptr Palette -> m CInt
-setSurfacePalette v1 v2 = liftIO $ setSurfacePaletteFFI v1 v2
-{-# INLINE setSurfacePalette #-}
-
-setSurfaceRLE :: MonadIO m => Ptr Surface -> CInt -> m CInt
-setSurfaceRLE v1 v2 = liftIO $ setSurfaceRLEFFI v1 v2
-{-# INLINE setSurfaceRLE #-}
-
-unlockSurface :: MonadIO m => Ptr Surface -> m ()
-unlockSurface v1 = liftIO $ unlockSurfaceFFI v1
-{-# INLINE unlockSurface #-}
-
-getWindowWMInfo :: MonadIO m => Window -> SysWMinfo -> m Bool
-getWindowWMInfo v1 v2 = liftIO $ getWindowWMInfoFFI v1 v2
-{-# INLINE getWindowWMInfo #-}
-
-getClipboardText :: MonadIO m => m CString
-getClipboardText = liftIO getClipboardTextFFI
-{-# INLINE getClipboardText #-}
-
-hasClipboardText :: MonadIO m => m Bool
-hasClipboardText = liftIO hasClipboardTextFFI
-{-# INLINE hasClipboardText #-}
-
-setClipboardText :: MonadIO m => CString -> m CInt
-setClipboardText v1 = liftIO $ setClipboardTextFFI v1
-{-# INLINE setClipboardText #-}
+module SDL.Raw.Video (+  -- * Display and Window Management+  createWindow,+  createWindowAndRenderer,+  createWindowFrom,+  destroyWindow,+  disableScreenSaver,+  enableScreenSaver,+  glBindTexture,+  glCreateContext,+  glDeleteContext,+  glExtensionSupported,+  glGetAttribute,+  glGetCurrentContext,+  glGetCurrentWindow,+  glGetDrawableSize,+  glGetProcAddress,+  glGetSwapInterval,+  glLoadLibrary,+  glMakeCurrent,+  glResetAttributes,+  glSetAttribute,+  glSetSwapInterval,+  glSwapWindow,+  glUnbindTexture,+  glUnloadLibrary,+  getClosestDisplayMode,+  getCurrentDisplayMode,+  getCurrentVideoDriver,+  getDesktopDisplayMode,+  getDisplayBounds,+  getDisplayDPI,+  getDisplayMode,+  getDisplayName,+  getGrabbedWindow,+  getNumDisplayModes,+  getNumVideoDisplays,+  getNumVideoDrivers,+  getVideoDriver,+  getWindowBrightness,+  getWindowData,+  getWindowDisplayIndex,+  getWindowDisplayMode,+  getWindowFlags,+  getWindowFromID,+  getWindowGammaRamp,+  getWindowGrab,+  getWindowID,+  getWindowMaximumSize,+  getWindowMinimumSize,+  getWindowPixelFormat,+  getWindowPosition,+  getWindowSize,+  getWindowSurface,+  getWindowTitle,+  hideWindow,+  isScreenSaverEnabled,+  maximizeWindow,+  minimizeWindow,+  raiseWindow,+  restoreWindow,+  setWindowBordered,+  setWindowBrightness,+  setWindowData,+  setWindowDisplayMode,+  setWindowFullscreen,+  setWindowGammaRamp,+  setWindowGrab,+  setWindowIcon,+  setWindowMaximumSize,+  setWindowMinimumSize,+  setWindowPosition,+  setWindowSize,+  setWindowTitle,+  showMessageBox,+  showSimpleMessageBox,+  showWindow,+  updateWindowSurface,+  updateWindowSurfaceRects,+  videoInit,+  videoQuit,++  -- * 2D Accelerated Rendering+  createRenderer,+  createSoftwareRenderer,+  createTexture,+  createTextureFromSurface,+  destroyRenderer,+  destroyTexture,+  getNumRenderDrivers,+  getRenderDrawBlendMode,+  getRenderDrawColor,+  getRenderDriverInfo,+  getRenderTarget,+  getRenderer,+  getRendererInfo,+  getRendererOutputSize,+  getTextureAlphaMod,+  getTextureBlendMode,+  getTextureColorMod,+  lockTexture,+  queryTexture,+  renderClear,+  renderCopy,+  renderCopyEx,+  renderDrawLine,+  renderDrawLines,+  renderDrawPoint,+  renderDrawPoints,+  renderDrawRect,+  renderDrawRects,+  renderFillRect,+  renderFillRects,+  renderGetClipRect,+  renderGetLogicalSize,+  renderGetScale,+  renderGetViewport,+  renderIsClipEnabled,+  renderPresent,+  renderReadPixels,+  renderSetClipRect,+  renderSetLogicalSize,+  renderSetScale,+  renderSetViewport,+  renderTargetSupported,+  setRenderDrawBlendMode,+  setRenderDrawColor,+  setRenderTarget,+  setTextureAlphaMod,+  setTextureBlendMode,+  setTextureColorMod,+  unlockTexture,+  updateTexture,+  updateYUVTexture,++  -- * Pixel Formats and Conversion Routines+  allocFormat,+  allocPalette,+  calculateGammaRamp,+  freeFormat,+  freePalette,+  getPixelFormatName,+  getRGB,+  getRGBA,+  mapRGB,+  mapRGBA,+  masksToPixelFormatEnum,+  pixelFormatEnumToMasks,+  setPaletteColors,+  setPixelFormatPalette,++  -- * Rectangle Functions+  enclosePoints,+  hasIntersection,+  intersectRect,+  intersectRectAndLine,+  unionRect,++  -- * Surface Creation and Simple Drawing+  blitScaled,+  blitSurface,+  convertPixels,+  convertSurface,+  convertSurfaceFormat,+  createRGBSurface,+  createRGBSurfaceFrom,+  fillRect,+  fillRects,+  freeSurface,+  getClipRect,+  getColorKey,+  getSurfaceAlphaMod,+  getSurfaceBlendMode,+  getSurfaceColorMod,+  loadBMP,+  loadBMP_RW,+  lockSurface,+  lowerBlit,+  lowerBlitScaled,+  saveBMP,+  saveBMP_RW,+  setClipRect,+  setColorKey,+  setSurfaceAlphaMod,+  setSurfaceBlendMode,+  setSurfaceColorMod,+  setSurfacePalette,+  setSurfaceRLE,+  unlockSurface,++  -- * Platform-specific Window Management+  getWindowWMInfo,++  -- * Clipboard Handling+  getClipboardText,+  hasClipboardText,+  setClipboardText+) where++import Control.Monad.IO.Class+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.Ptr+import SDL.Raw.Enum+import SDL.Raw.Filesystem+import SDL.Raw.Types++foreign import ccall "SDL.h SDL_CreateWindow" createWindowFFI :: CString -> CInt -> CInt -> CInt -> CInt -> Word32 -> IO Window+foreign import ccall "SDL.h SDL_CreateWindowAndRenderer" createWindowAndRendererFFI :: CInt -> CInt -> Word32 -> Ptr Window -> Ptr Renderer -> IO CInt+foreign import ccall "SDL.h SDL_CreateWindowFrom" createWindowFromFFI :: Ptr () -> IO Window+foreign import ccall "SDL.h SDL_DestroyWindow" destroyWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_DisableScreenSaver" disableScreenSaverFFI :: IO ()+foreign import ccall "SDL.h SDL_EnableScreenSaver" enableScreenSaverFFI :: IO ()+foreign import ccall "SDL.h SDL_GL_BindTexture" glBindTextureFFI :: Texture -> Ptr CFloat -> Ptr CFloat -> IO CInt+foreign import ccall "SDL.h SDL_GL_CreateContext" glCreateContextFFI :: Window -> IO GLContext+foreign import ccall "SDL.h SDL_GL_DeleteContext" glDeleteContextFFI :: GLContext -> IO ()+foreign import ccall "SDL.h SDL_GL_ExtensionSupported" glExtensionSupportedFFI :: CString -> IO Bool+foreign import ccall "SDL.h SDL_GL_GetAttribute" glGetAttributeFFI :: GLattr -> Ptr CInt -> IO CInt+foreign import ccall "SDL.h SDL_GL_GetCurrentContext" glGetCurrentContextFFI :: IO GLContext+foreign import ccall "SDL.h SDL_GL_GetCurrentWindow" glGetCurrentWindowFFI :: IO Window+foreign import ccall "SDL.h SDL_GL_GetDrawableSize" glGetDrawableSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()+foreign import ccall "SDL.h SDL_GL_GetProcAddress" glGetProcAddressFFI :: CString -> IO (Ptr ())+foreign import ccall "SDL.h SDL_GL_GetSwapInterval" glGetSwapIntervalFFI :: IO CInt+foreign import ccall "SDL.h SDL_GL_LoadLibrary" glLoadLibraryFFI :: CString -> IO CInt+foreign import ccall "SDL.h SDL_GL_MakeCurrent" glMakeCurrentFFI :: Window -> GLContext -> IO CInt+foreign import ccall "SDL.h SDL_GL_ResetAttributes" glResetAttributesFFI :: IO ()+foreign import ccall "SDL.h SDL_GL_SetAttribute" glSetAttributeFFI :: GLattr -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_GL_SetSwapInterval" glSetSwapIntervalFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_GL_SwapWindow" glSwapWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_GL_UnbindTexture" glUnbindTextureFFI :: Texture -> IO CInt+foreign import ccall "SDL.h SDL_GL_UnloadLibrary" glUnloadLibraryFFI :: IO ()+foreign import ccall "SDL.h SDL_GetClosestDisplayMode" getClosestDisplayModeFFI :: CInt -> Ptr DisplayMode -> Ptr DisplayMode -> IO (Ptr DisplayMode)+foreign import ccall "SDL.h SDL_GetCurrentDisplayMode" getCurrentDisplayModeFFI :: CInt -> Ptr DisplayMode -> IO CInt+foreign import ccall "SDL.h SDL_GetCurrentVideoDriver" getCurrentVideoDriverFFI :: IO CString+foreign import ccall "SDL.h SDL_GetDesktopDisplayMode" getDesktopDisplayModeFFI :: CInt -> Ptr DisplayMode -> IO CInt+foreign import ccall "SDL.h SDL_GetDisplayBounds" getDisplayBoundsFFI :: CInt -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_GetDisplayDPI" getDisplayDPIFFI :: CInt -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> IO CInt+foreign import ccall "SDL.h SDL_GetDisplayMode" getDisplayModeFFI :: CInt -> CInt -> Ptr DisplayMode -> IO CInt+foreign import ccall "SDL.h SDL_GetDisplayName" getDisplayNameFFI :: CInt -> IO CString+foreign import ccall "SDL.h SDL_GetGrabbedWindow" getGrabbedWindowFFI :: IO Window+foreign import ccall "SDL.h SDL_GetNumDisplayModes" getNumDisplayModesFFI :: CInt -> IO CInt+foreign import ccall "SDL.h SDL_GetNumVideoDisplays" getNumVideoDisplaysFFI :: IO CInt+foreign import ccall "SDL.h SDL_GetNumVideoDrivers" getNumVideoDriversFFI :: IO CInt+foreign import ccall "SDL.h SDL_GetVideoDriver" getVideoDriverFFI :: CInt -> IO CString+foreign import ccall "SDL.h SDL_GetWindowBrightness" getWindowBrightnessFFI :: Window -> IO CFloat+foreign import ccall "SDL.h SDL_GetWindowData" getWindowDataFFI :: Window -> CString -> IO (Ptr ())+foreign import ccall "SDL.h SDL_GetWindowDisplayIndex" getWindowDisplayIndexFFI :: Window -> IO CInt+foreign import ccall "SDL.h SDL_GetWindowDisplayMode" getWindowDisplayModeFFI :: Window -> Ptr DisplayMode -> IO CInt+foreign import ccall "SDL.h SDL_GetWindowFlags" getWindowFlagsFFI :: Window -> IO Word32+foreign import ccall "SDL.h SDL_GetWindowFromID" getWindowFromIDFFI :: Word32 -> IO Window+foreign import ccall "SDL.h SDL_GetWindowGammaRamp" getWindowGammaRampFFI :: Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> IO CInt+foreign import ccall "SDL.h SDL_GetWindowGrab" getWindowGrabFFI :: Window -> IO Bool+foreign import ccall "SDL.h SDL_GetWindowID" getWindowIDFFI :: Window -> IO Word32+foreign import ccall "SDL.h SDL_GetWindowMaximumSize" getWindowMaximumSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()+foreign import ccall "SDL.h SDL_GetWindowMinimumSize" getWindowMinimumSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()+foreign import ccall "SDL.h SDL_GetWindowPixelFormat" getWindowPixelFormatFFI :: Window -> IO Word32+foreign import ccall "SDL.h SDL_GetWindowPosition" getWindowPositionFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()+foreign import ccall "SDL.h SDL_GetWindowSize" getWindowSizeFFI :: Window -> Ptr CInt -> Ptr CInt -> IO ()+foreign import ccall "SDL.h SDL_GetWindowSurface" getWindowSurfaceFFI :: Window -> IO (Ptr Surface)+foreign import ccall "SDL.h SDL_GetWindowTitle" getWindowTitleFFI :: Window -> IO CString+foreign import ccall "SDL.h SDL_HideWindow" hideWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_IsScreenSaverEnabled" isScreenSaverEnabledFFI :: IO Bool+foreign import ccall "SDL.h SDL_MaximizeWindow" maximizeWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_MinimizeWindow" minimizeWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_RaiseWindow" raiseWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_RestoreWindow" restoreWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_SetWindowBordered" setWindowBorderedFFI :: Window -> Bool -> IO ()+foreign import ccall "SDL.h SDL_SetWindowBrightness" setWindowBrightnessFFI :: Window -> CFloat -> IO CInt+foreign import ccall "SDL.h SDL_SetWindowData" setWindowDataFFI :: Window -> CString -> Ptr () -> IO (Ptr ())+foreign import ccall "SDL.h SDL_SetWindowDisplayMode" setWindowDisplayModeFFI :: Window -> Ptr DisplayMode -> IO CInt+foreign import ccall "SDL.h SDL_SetWindowFullscreen" setWindowFullscreenFFI :: Window -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_SetWindowGammaRamp" setWindowGammaRampFFI :: Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> IO CInt+foreign import ccall "SDL.h SDL_SetWindowGrab" setWindowGrabFFI :: Window -> Bool -> IO ()+foreign import ccall "SDL.h SDL_SetWindowIcon" setWindowIconFFI :: Window -> Ptr Surface -> IO ()+foreign import ccall "SDL.h SDL_SetWindowMaximumSize" setWindowMaximumSizeFFI :: Window -> CInt -> CInt -> IO ()+foreign import ccall "SDL.h SDL_SetWindowMinimumSize" setWindowMinimumSizeFFI :: Window -> CInt -> CInt -> IO ()+foreign import ccall "SDL.h SDL_SetWindowPosition" setWindowPositionFFI :: Window -> CInt -> CInt -> IO ()+foreign import ccall "SDL.h SDL_SetWindowSize" setWindowSizeFFI :: Window -> CInt -> CInt -> IO ()+foreign import ccall "SDL.h SDL_SetWindowTitle" setWindowTitleFFI :: Window -> CString -> IO ()+foreign import ccall "SDL.h SDL_ShowMessageBox" showMessageBoxFFI :: Ptr MessageBoxData -> Ptr CInt -> IO CInt+foreign import ccall "SDL.h SDL_ShowSimpleMessageBox" showSimpleMessageBoxFFI :: Word32 -> CString -> CString -> Window -> IO CInt+foreign import ccall "SDL.h SDL_ShowWindow" showWindowFFI :: Window -> IO ()+foreign import ccall "SDL.h SDL_UpdateWindowSurface" updateWindowSurfaceFFI :: Window -> IO CInt+foreign import ccall "SDL.h SDL_UpdateWindowSurfaceRects" updateWindowSurfaceRectsFFI :: Window -> Ptr Rect -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_VideoInit" videoInitFFI :: CString -> IO CInt+foreign import ccall "SDL.h SDL_VideoQuit" videoQuitFFI :: IO ()++foreign import ccall "SDL.h SDL_CreateRenderer" createRendererFFI :: Window -> CInt -> Word32 -> IO Renderer+foreign import ccall "SDL.h SDL_CreateSoftwareRenderer" createSoftwareRendererFFI :: Ptr Surface -> IO Renderer+foreign import ccall "SDL.h SDL_CreateTexture" createTextureFFI :: Renderer -> Word32 -> CInt -> CInt -> CInt -> IO Texture+foreign import ccall "SDL.h SDL_CreateTextureFromSurface" createTextureFromSurfaceFFI :: Renderer -> Ptr Surface -> IO Texture+foreign import ccall "SDL.h SDL_DestroyRenderer" destroyRendererFFI :: Renderer -> IO ()+foreign import ccall "SDL.h SDL_DestroyTexture" destroyTextureFFI :: Texture -> IO ()+foreign import ccall "SDL.h SDL_GetNumRenderDrivers" getNumRenderDriversFFI :: IO CInt+foreign import ccall "SDL.h SDL_GetRenderDrawBlendMode" getRenderDrawBlendModeFFI :: Renderer -> Ptr BlendMode -> IO Int+foreign import ccall "SDL.h SDL_GetRenderDrawColor" getRenderDrawColorFFI :: Renderer -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt+foreign import ccall "SDL.h SDL_GetRenderDriverInfo" getRenderDriverInfoFFI :: CInt -> Ptr RendererInfo -> IO CInt+foreign import ccall "SDL.h SDL_GetRenderTarget" getRenderTargetFFI :: Renderer -> IO Texture+foreign import ccall "SDL.h SDL_GetRenderer" getRendererFFI :: Window -> IO Renderer+foreign import ccall "SDL.h SDL_GetRendererInfo" getRendererInfoFFI :: Renderer -> Ptr RendererInfo -> IO CInt+foreign import ccall "SDL.h SDL_GetRendererOutputSize" getRendererOutputSizeFFI :: Renderer -> Ptr CInt -> Ptr CInt -> IO CInt+foreign import ccall "SDL.h SDL_GetTextureAlphaMod" getTextureAlphaModFFI :: Texture -> Ptr Word8 -> IO CInt+foreign import ccall "SDL.h SDL_GetTextureBlendMode" getTextureBlendModeFFI :: Texture -> Ptr BlendMode -> IO CInt+foreign import ccall "SDL.h SDL_GetTextureColorMod" getTextureColorModFFI :: Texture -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt+foreign import ccall "SDL.h SDL_LockTexture" lockTextureFFI :: Texture -> Ptr Rect -> Ptr (Ptr ()) -> Ptr CInt -> IO CInt+foreign import ccall "SDL.h SDL_QueryTexture" queryTextureFFI :: Texture -> Ptr Word32 -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderClear" renderClearFFI :: Renderer -> IO CInt+foreign import ccall "SDL.h SDL_RenderCopy" renderCopyFFI :: Renderer -> Texture -> Ptr Rect -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_RenderCopyEx" renderCopyExFFI :: Renderer -> Texture -> Ptr Rect -> Ptr Rect -> CDouble -> Ptr Point -> RendererFlip -> IO CInt+foreign import ccall "SDL.h SDL_RenderDrawLine" renderDrawLineFFI :: Renderer -> CInt -> CInt -> CInt -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderDrawLines" renderDrawLinesFFI :: Renderer -> Ptr Point -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderDrawPoint" renderDrawPointFFI :: Renderer -> CInt -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderDrawPoints" renderDrawPointsFFI :: Renderer -> Ptr Point -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderDrawRect" renderDrawRectFFI :: Renderer -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_RenderDrawRects" renderDrawRectsFFI :: Renderer -> Ptr Rect -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderFillRect" renderFillRectFFI :: Renderer -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_RenderFillRects" renderFillRectsFFI :: Renderer -> Ptr Rect -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderGetClipRect" renderGetClipRectFFI :: Renderer -> Ptr Rect -> IO ()+foreign import ccall "SDL.h SDL_RenderGetLogicalSize" renderGetLogicalSizeFFI :: Renderer -> Ptr CInt -> Ptr CInt -> IO ()+foreign import ccall "SDL.h SDL_RenderGetScale" renderGetScaleFFI :: Renderer -> Ptr CFloat -> Ptr CFloat -> IO ()+foreign import ccall "SDL.h SDL_RenderGetViewport" renderGetViewportFFI :: Renderer -> Ptr Rect -> IO ()+foreign import ccall "SDL.h SDL_RenderIsClipEnabled" renderIsClipEnabledFFI :: Renderer -> IO Bool+foreign import ccall "SDL.h SDL_RenderPresent" renderPresentFFI :: Renderer -> IO ()+foreign import ccall "SDL.h SDL_RenderReadPixels" renderReadPixelsFFI :: Renderer -> Ptr Rect -> Word32 -> Ptr () -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderSetClipRect" renderSetClipRectFFI :: Renderer -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_RenderSetLogicalSize" renderSetLogicalSizeFFI :: Renderer -> CInt -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_RenderSetScale" renderSetScaleFFI :: Renderer -> CFloat -> CFloat -> IO CInt+foreign import ccall "SDL.h SDL_RenderSetViewport" renderSetViewportFFI :: Renderer -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_RenderTargetSupported" renderTargetSupportedFFI :: Renderer -> IO Bool+foreign import ccall "SDL.h SDL_SetRenderDrawBlendMode" setRenderDrawBlendModeFFI :: Renderer -> BlendMode -> IO CInt+foreign import ccall "SDL.h SDL_SetRenderDrawColor" setRenderDrawColorFFI :: Renderer -> Word8 -> Word8 -> Word8 -> Word8 -> IO CInt+foreign import ccall "SDL.h SDL_SetRenderTarget" setRenderTargetFFI :: Renderer -> Texture -> IO CInt+foreign import ccall "SDL.h SDL_SetTextureAlphaMod" setTextureAlphaModFFI :: Texture -> Word8 -> IO CInt+foreign import ccall "SDL.h SDL_SetTextureBlendMode" setTextureBlendModeFFI :: Texture -> BlendMode -> IO CInt+foreign import ccall "SDL.h SDL_SetTextureColorMod" setTextureColorModFFI :: Texture -> Word8 -> Word8 -> Word8 -> IO CInt+foreign import ccall "SDL.h SDL_UnlockTexture" unlockTextureFFI :: Texture -> IO ()+foreign import ccall "SDL.h SDL_UpdateTexture" updateTextureFFI :: Texture -> Ptr Rect -> Ptr () -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_UpdateYUVTexture" updateYUVTextureFFI :: Texture -> Ptr Rect -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> IO CInt++foreign import ccall "SDL.h SDL_AllocFormat" allocFormatFFI :: Word32 -> IO (Ptr PixelFormat)+foreign import ccall "SDL.h SDL_AllocPalette" allocPaletteFFI :: CInt -> IO (Ptr Palette)+foreign import ccall "SDL.h SDL_CalculateGammaRamp" calculateGammaRampFFI :: CFloat -> Ptr Word16 -> IO ()+foreign import ccall "SDL.h SDL_FreeFormat" freeFormatFFI :: Ptr PixelFormat -> IO ()+foreign import ccall "SDL.h SDL_FreePalette" freePaletteFFI :: Ptr Palette -> IO ()+foreign import ccall "SDL.h SDL_GetPixelFormatName" getPixelFormatNameFFI :: Word32 -> IO CString+foreign import ccall "SDL.h SDL_GetRGB" getRGBFFI :: Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO ()+foreign import ccall "SDL.h SDL_GetRGBA" getRGBAFFI :: Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO ()+foreign import ccall "SDL.h SDL_MapRGB" mapRGBFFI :: Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> IO Word32+foreign import ccall "SDL.h SDL_MapRGBA" mapRGBAFFI :: Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> Word8 -> IO Word32+foreign import ccall "SDL.h SDL_MasksToPixelFormatEnum" masksToPixelFormatEnumFFI :: CInt -> Word32 -> Word32 -> Word32 -> Word32 -> IO Word32+foreign import ccall "SDL.h SDL_PixelFormatEnumToMasks" pixelFormatEnumToMasksFFI :: Word32 -> Ptr CInt -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> IO Bool+foreign import ccall "SDL.h SDL_SetPaletteColors" setPaletteColorsFFI :: Ptr Palette -> Ptr Color -> CInt -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_SetPixelFormatPalette" setPixelFormatPaletteFFI :: Ptr PixelFormat -> Ptr Palette -> IO CInt++foreign import ccall "SDL.h SDL_EnclosePoints" enclosePointsFFI :: Ptr Point -> CInt -> Ptr Rect -> Ptr Rect -> IO Bool+foreign import ccall "SDL.h SDL_HasIntersection" hasIntersectionFFI :: Ptr Rect -> Ptr Rect -> IO Bool+foreign import ccall "SDL.h SDL_IntersectRect" intersectRectFFI :: Ptr Rect -> Ptr Rect -> Ptr Rect -> IO Bool+foreign import ccall "SDL.h SDL_IntersectRectAndLine" intersectRectAndLineFFI :: Ptr Rect -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO Bool+foreign import ccall "SDL.h SDL_UnionRect" unionRectFFI :: Ptr Rect -> Ptr Rect -> Ptr Rect -> IO ()++foreign import ccall "SDL.h SDL_UpperBlitScaled" blitScaledFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_UpperBlit" blitSurfaceFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_ConvertPixels" convertPixelsFFI :: CInt -> CInt -> Word32 -> Ptr () -> CInt -> Word32 -> Ptr () -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_ConvertSurface" convertSurfaceFFI :: Ptr Surface -> Ptr PixelFormat -> Word32 -> IO (Ptr Surface)+foreign import ccall "SDL.h SDL_ConvertSurfaceFormat" convertSurfaceFormatFFI :: Ptr Surface -> Word32 -> Word32 -> IO (Ptr Surface)+foreign import ccall "SDL.h SDL_CreateRGBSurface" createRGBSurfaceFFI :: Word32 -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> IO (Ptr Surface)+foreign import ccall "SDL.h SDL_CreateRGBSurfaceFrom" createRGBSurfaceFromFFI :: Ptr () -> CInt -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> IO (Ptr Surface)+foreign import ccall "SDL.h SDL_FillRect" fillRectFFI :: Ptr Surface -> Ptr Rect -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_FillRects" fillRectsFFI :: Ptr Surface -> Ptr Rect -> CInt -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_FreeSurface" freeSurfaceFFI :: Ptr Surface -> IO ()+foreign import ccall "SDL.h SDL_GetClipRect" getClipRectFFI :: Ptr Surface -> Ptr Rect -> IO ()+foreign import ccall "SDL.h SDL_GetColorKey" getColorKeyFFI :: Ptr Surface -> Ptr Word32 -> IO CInt+foreign import ccall "SDL.h SDL_GetSurfaceAlphaMod" getSurfaceAlphaModFFI :: Ptr Surface -> Ptr Word8 -> IO CInt+foreign import ccall "SDL.h SDL_GetSurfaceBlendMode" getSurfaceBlendModeFFI :: Ptr Surface -> Ptr BlendMode -> IO CInt+foreign import ccall "SDL.h SDL_GetSurfaceColorMod" getSurfaceColorModFFI :: Ptr Surface -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt+foreign import ccall "SDL.h SDL_LoadBMP_RW" loadBMP_RWFFI :: Ptr RWops -> CInt -> IO (Ptr Surface)+foreign import ccall "SDL.h SDL_LockSurface" lockSurfaceFFI :: Ptr Surface -> IO CInt+foreign import ccall "SDL.h SDL_LowerBlit" lowerBlitFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_LowerBlitScaled" lowerBlitScaledFFI :: Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> IO CInt+foreign import ccall "SDL.h SDL_SaveBMP_RW" saveBMP_RWFFI :: Ptr Surface -> Ptr RWops -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_SetClipRect" setClipRectFFI :: Ptr Surface -> Ptr Rect -> IO Bool+foreign import ccall "SDL.h SDL_SetColorKey" setColorKeyFFI :: Ptr Surface -> CInt -> Word32 -> IO CInt+foreign import ccall "SDL.h SDL_SetSurfaceAlphaMod" setSurfaceAlphaModFFI :: Ptr Surface -> Word8 -> IO CInt+foreign import ccall "SDL.h SDL_SetSurfaceBlendMode" setSurfaceBlendModeFFI :: Ptr Surface -> BlendMode -> IO CInt+foreign import ccall "SDL.h SDL_SetSurfaceColorMod" setSurfaceColorModFFI :: Ptr Surface -> Word8 -> Word8 -> Word8 -> IO CInt+foreign import ccall "SDL.h SDL_SetSurfacePalette" setSurfacePaletteFFI :: Ptr Surface -> Ptr Palette -> IO CInt+foreign import ccall "SDL.h SDL_SetSurfaceRLE" setSurfaceRLEFFI :: Ptr Surface -> CInt -> IO CInt+foreign import ccall "SDL.h SDL_UnlockSurface" unlockSurfaceFFI :: Ptr Surface -> IO ()++foreign import ccall "SDL.h SDL_GetWindowWMInfo" getWindowWMInfoFFI :: Window -> SysWMinfo -> IO Bool++foreign import ccall "SDL.h SDL_GetClipboardText" getClipboardTextFFI :: IO CString+foreign import ccall "SDL.h SDL_HasClipboardText" hasClipboardTextFFI :: IO Bool+foreign import ccall "SDL.h SDL_SetClipboardText" setClipboardTextFFI :: CString -> IO CInt++createWindow :: MonadIO m => CString -> CInt -> CInt -> CInt -> CInt -> Word32 -> m Window+createWindow v1 v2 v3 v4 v5 v6 = liftIO $ createWindowFFI v1 v2 v3 v4 v5 v6+{-# INLINE createWindow #-}++createWindowAndRenderer :: MonadIO m => CInt -> CInt -> Word32 -> Ptr Window -> Ptr Renderer -> m CInt+createWindowAndRenderer v1 v2 v3 v4 v5 = liftIO $ createWindowAndRendererFFI v1 v2 v3 v4 v5+{-# INLINE createWindowAndRenderer #-}++createWindowFrom :: MonadIO m => Ptr () -> m Window+createWindowFrom v1 = liftIO $ createWindowFromFFI v1+{-# INLINE createWindowFrom #-}++destroyWindow :: MonadIO m => Window -> m ()+destroyWindow v1 = liftIO $ destroyWindowFFI v1+{-# INLINE destroyWindow #-}++disableScreenSaver :: MonadIO m => m ()+disableScreenSaver = liftIO disableScreenSaverFFI+{-# INLINE disableScreenSaver #-}++enableScreenSaver :: MonadIO m => m ()+enableScreenSaver = liftIO enableScreenSaverFFI+{-# INLINE enableScreenSaver #-}++glBindTexture :: MonadIO m => Texture -> Ptr CFloat -> Ptr CFloat -> m CInt+glBindTexture v1 v2 v3 = liftIO $ glBindTextureFFI v1 v2 v3+{-# INLINE glBindTexture #-}++glCreateContext :: MonadIO m => Window -> m GLContext+glCreateContext v1 = liftIO $ glCreateContextFFI v1+{-# INLINE glCreateContext #-}++glDeleteContext :: MonadIO m => GLContext -> m ()+glDeleteContext v1 = liftIO $ glDeleteContextFFI v1+{-# INLINE glDeleteContext #-}++glExtensionSupported :: MonadIO m => CString -> m Bool+glExtensionSupported v1 = liftIO $ glExtensionSupportedFFI v1+{-# INLINE glExtensionSupported #-}++glGetAttribute :: MonadIO m => GLattr -> Ptr CInt -> m CInt+glGetAttribute v1 v2 = liftIO $ glGetAttributeFFI v1 v2+{-# INLINE glGetAttribute #-}++glGetCurrentContext :: MonadIO m => m GLContext+glGetCurrentContext = liftIO glGetCurrentContextFFI+{-# INLINE glGetCurrentContext #-}++glGetCurrentWindow :: MonadIO m => m Window+glGetCurrentWindow = liftIO glGetCurrentWindowFFI+{-# INLINE glGetCurrentWindow #-}++glGetDrawableSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()+glGetDrawableSize v1 v2 v3 = liftIO $ glGetDrawableSizeFFI v1 v2 v3+{-# INLINE glGetDrawableSize #-}++glGetProcAddress :: MonadIO m => CString -> m (Ptr ())+glGetProcAddress v1 = liftIO $ glGetProcAddressFFI v1+{-# INLINE glGetProcAddress #-}++glGetSwapInterval :: MonadIO m => m CInt+glGetSwapInterval = liftIO glGetSwapIntervalFFI+{-# INLINE glGetSwapInterval #-}++glLoadLibrary :: MonadIO m => CString -> m CInt+glLoadLibrary v1 = liftIO $ glLoadLibraryFFI v1+{-# INLINE glLoadLibrary #-}++glMakeCurrent :: MonadIO m => Window -> GLContext -> m CInt+glMakeCurrent v1 v2 = liftIO $ glMakeCurrentFFI v1 v2+{-# INLINE glMakeCurrent #-}++glResetAttributes :: MonadIO m => m ()+glResetAttributes = liftIO glResetAttributesFFI+{-# INLINE glResetAttributes #-}++glSetAttribute :: MonadIO m => GLattr -> CInt -> m CInt+glSetAttribute v1 v2 = liftIO $ glSetAttributeFFI v1 v2+{-# INLINE glSetAttribute #-}++glSetSwapInterval :: MonadIO m => CInt -> m CInt+glSetSwapInterval v1 = liftIO $ glSetSwapIntervalFFI v1+{-# INLINE glSetSwapInterval #-}++glSwapWindow :: MonadIO m => Window -> m ()+glSwapWindow v1 = liftIO $ glSwapWindowFFI v1+{-# INLINE glSwapWindow #-}++glUnbindTexture :: MonadIO m => Texture -> m CInt+glUnbindTexture v1 = liftIO $ glUnbindTextureFFI v1+{-# INLINE glUnbindTexture #-}++glUnloadLibrary :: MonadIO m => m ()+glUnloadLibrary = liftIO glUnloadLibraryFFI+{-# INLINE glUnloadLibrary #-}++getClosestDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> Ptr DisplayMode -> m (Ptr DisplayMode)+getClosestDisplayMode v1 v2 v3 = liftIO $ getClosestDisplayModeFFI v1 v2 v3+{-# INLINE getClosestDisplayMode #-}++getCurrentDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> m CInt+getCurrentDisplayMode v1 v2 = liftIO $ getCurrentDisplayModeFFI v1 v2+{-# INLINE getCurrentDisplayMode #-}++getCurrentVideoDriver :: MonadIO m => m CString+getCurrentVideoDriver = liftIO getCurrentVideoDriverFFI+{-# INLINE getCurrentVideoDriver #-}++getDesktopDisplayMode :: MonadIO m => CInt -> Ptr DisplayMode -> m CInt+getDesktopDisplayMode v1 v2 = liftIO $ getDesktopDisplayModeFFI v1 v2+{-# INLINE getDesktopDisplayMode #-}++getDisplayBounds :: MonadIO m => CInt -> Ptr Rect -> m CInt+getDisplayBounds v1 v2 = liftIO $ getDisplayBoundsFFI v1 v2+{-# INLINE getDisplayBounds #-}++getDisplayDPI :: MonadIO m => CInt -> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> m CInt+getDisplayDPI v1 v2 v3 v4 = liftIO $ getDisplayDPIFFI v1 v2 v3 v4+{-# INLINE getDisplayDPI #-}++getDisplayMode :: MonadIO m => CInt -> CInt -> Ptr DisplayMode -> m CInt+getDisplayMode v1 v2 v3 = liftIO $ getDisplayModeFFI v1 v2 v3+{-# INLINE getDisplayMode #-}++getDisplayName :: MonadIO m => CInt -> m CString+getDisplayName v1 = liftIO $ getDisplayNameFFI v1+{-# INLINE getDisplayName #-}++getGrabbedWindow :: MonadIO m => m Window+getGrabbedWindow = liftIO getGrabbedWindowFFI+{-# INLINE getGrabbedWindow #-}++getNumDisplayModes :: MonadIO m => CInt -> m CInt+getNumDisplayModes v1 = liftIO $ getNumDisplayModesFFI v1+{-# INLINE getNumDisplayModes #-}++getNumVideoDisplays :: MonadIO m => m CInt+getNumVideoDisplays = liftIO getNumVideoDisplaysFFI+{-# INLINE getNumVideoDisplays #-}++getNumVideoDrivers :: MonadIO m => m CInt+getNumVideoDrivers = liftIO getNumVideoDriversFFI+{-# INLINE getNumVideoDrivers #-}++getVideoDriver :: MonadIO m => CInt -> m CString+getVideoDriver v1 = liftIO $ getVideoDriverFFI v1+{-# INLINE getVideoDriver #-}++getWindowBrightness :: MonadIO m => Window -> m CFloat+getWindowBrightness v1 = liftIO $ getWindowBrightnessFFI v1+{-# INLINE getWindowBrightness #-}++getWindowData :: MonadIO m => Window -> CString -> m (Ptr ())+getWindowData v1 v2 = liftIO $ getWindowDataFFI v1 v2+{-# INLINE getWindowData #-}++getWindowDisplayIndex :: MonadIO m => Window -> m CInt+getWindowDisplayIndex v1 = liftIO $ getWindowDisplayIndexFFI v1+{-# INLINE getWindowDisplayIndex #-}++getWindowDisplayMode :: MonadIO m => Window -> Ptr DisplayMode -> m CInt+getWindowDisplayMode v1 v2 = liftIO $ getWindowDisplayModeFFI v1 v2+{-# INLINE getWindowDisplayMode #-}++getWindowFlags :: MonadIO m => Window -> m Word32+getWindowFlags v1 = liftIO $ getWindowFlagsFFI v1+{-# INLINE getWindowFlags #-}++getWindowFromID :: MonadIO m => Word32 -> m Window+getWindowFromID v1 = liftIO $ getWindowFromIDFFI v1+{-# INLINE getWindowFromID #-}++getWindowGammaRamp :: MonadIO m => Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> m CInt+getWindowGammaRamp v1 v2 v3 v4 = liftIO $ getWindowGammaRampFFI v1 v2 v3 v4+{-# INLINE getWindowGammaRamp #-}++getWindowGrab :: MonadIO m => Window -> m Bool+getWindowGrab v1 = liftIO $ getWindowGrabFFI v1+{-# INLINE getWindowGrab #-}++getWindowID :: MonadIO m => Window -> m Word32+getWindowID v1 = liftIO $ getWindowIDFFI v1+{-# INLINE getWindowID #-}++getWindowMaximumSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()+getWindowMaximumSize v1 v2 v3 = liftIO $ getWindowMaximumSizeFFI v1 v2 v3+{-# INLINE getWindowMaximumSize #-}++getWindowMinimumSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()+getWindowMinimumSize v1 v2 v3 = liftIO $ getWindowMinimumSizeFFI v1 v2 v3+{-# INLINE getWindowMinimumSize #-}++getWindowPixelFormat :: MonadIO m => Window -> m Word32+getWindowPixelFormat v1 = liftIO $ getWindowPixelFormatFFI v1+{-# INLINE getWindowPixelFormat #-}++getWindowPosition :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()+getWindowPosition v1 v2 v3 = liftIO $ getWindowPositionFFI v1 v2 v3+{-# INLINE getWindowPosition #-}++getWindowSize :: MonadIO m => Window -> Ptr CInt -> Ptr CInt -> m ()+getWindowSize v1 v2 v3 = liftIO $ getWindowSizeFFI v1 v2 v3+{-# INLINE getWindowSize #-}++getWindowSurface :: MonadIO m => Window -> m (Ptr Surface)+getWindowSurface v1 = liftIO $ getWindowSurfaceFFI v1+{-# INLINE getWindowSurface #-}++getWindowTitle :: MonadIO m => Window -> m CString+getWindowTitle v1 = liftIO $ getWindowTitleFFI v1+{-# INLINE getWindowTitle #-}++hideWindow :: MonadIO m => Window -> m ()+hideWindow v1 = liftIO $ hideWindowFFI v1+{-# INLINE hideWindow #-}++isScreenSaverEnabled :: MonadIO m => m Bool+isScreenSaverEnabled = liftIO isScreenSaverEnabledFFI+{-# INLINE isScreenSaverEnabled #-}++maximizeWindow :: MonadIO m => Window -> m ()+maximizeWindow v1 = liftIO $ maximizeWindowFFI v1+{-# INLINE maximizeWindow #-}++minimizeWindow :: MonadIO m => Window -> m ()+minimizeWindow v1 = liftIO $ minimizeWindowFFI v1+{-# INLINE minimizeWindow #-}++raiseWindow :: MonadIO m => Window -> m ()+raiseWindow v1 = liftIO $ raiseWindowFFI v1+{-# INLINE raiseWindow #-}++restoreWindow :: MonadIO m => Window -> m ()+restoreWindow v1 = liftIO $ restoreWindowFFI v1+{-# INLINE restoreWindow #-}++setWindowBordered :: MonadIO m => Window -> Bool -> m ()+setWindowBordered v1 v2 = liftIO $ setWindowBorderedFFI v1 v2+{-# INLINE setWindowBordered #-}++setWindowBrightness :: MonadIO m => Window -> CFloat -> m CInt+setWindowBrightness v1 v2 = liftIO $ setWindowBrightnessFFI v1 v2+{-# INLINE setWindowBrightness #-}++setWindowData :: MonadIO m => Window -> CString -> Ptr () -> m (Ptr ())+setWindowData v1 v2 v3 = liftIO $ setWindowDataFFI v1 v2 v3+{-# INLINE setWindowData #-}++setWindowDisplayMode :: MonadIO m => Window -> Ptr DisplayMode -> m CInt+setWindowDisplayMode v1 v2 = liftIO $ setWindowDisplayModeFFI v1 v2+{-# INLINE setWindowDisplayMode #-}++setWindowFullscreen :: MonadIO m => Window -> Word32 -> m CInt+setWindowFullscreen v1 v2 = liftIO $ setWindowFullscreenFFI v1 v2+{-# INLINE setWindowFullscreen #-}++setWindowGammaRamp :: MonadIO m => Window -> Ptr Word16 -> Ptr Word16 -> Ptr Word16 -> m CInt+setWindowGammaRamp v1 v2 v3 v4 = liftIO $ setWindowGammaRampFFI v1 v2 v3 v4+{-# INLINE setWindowGammaRamp #-}++setWindowGrab :: MonadIO m => Window -> Bool -> m ()+setWindowGrab v1 v2 = liftIO $ setWindowGrabFFI v1 v2+{-# INLINE setWindowGrab #-}++setWindowIcon :: MonadIO m => Window -> Ptr Surface -> m ()+setWindowIcon v1 v2 = liftIO $ setWindowIconFFI v1 v2+{-# INLINE setWindowIcon #-}++setWindowMaximumSize :: MonadIO m => Window -> CInt -> CInt -> m ()+setWindowMaximumSize v1 v2 v3 = liftIO $ setWindowMaximumSizeFFI v1 v2 v3+{-# INLINE setWindowMaximumSize #-}++setWindowMinimumSize :: MonadIO m => Window -> CInt -> CInt -> m ()+setWindowMinimumSize v1 v2 v3 = liftIO $ setWindowMinimumSizeFFI v1 v2 v3+{-# INLINE setWindowMinimumSize #-}++setWindowPosition :: MonadIO m => Window -> CInt -> CInt -> m ()+setWindowPosition v1 v2 v3 = liftIO $ setWindowPositionFFI v1 v2 v3+{-# INLINE setWindowPosition #-}++setWindowSize :: MonadIO m => Window -> CInt -> CInt -> m ()+setWindowSize v1 v2 v3 = liftIO $ setWindowSizeFFI v1 v2 v3+{-# INLINE setWindowSize #-}++setWindowTitle :: MonadIO m => Window -> CString -> m ()+setWindowTitle v1 v2 = liftIO $ setWindowTitleFFI v1 v2+{-# INLINE setWindowTitle #-}++showMessageBox :: MonadIO m => Ptr MessageBoxData -> Ptr CInt -> m CInt+showMessageBox v1 v2 = liftIO $ showMessageBoxFFI v1 v2+{-# INLINE showMessageBox #-}++showSimpleMessageBox :: MonadIO m => Word32 -> CString -> CString -> Window -> m CInt+showSimpleMessageBox v1 v2 v3 v4 = liftIO $ showSimpleMessageBoxFFI v1 v2 v3 v4+{-# INLINE showSimpleMessageBox #-}++showWindow :: MonadIO m => Window -> m ()+showWindow v1 = liftIO $ showWindowFFI v1+{-# INLINE showWindow #-}++updateWindowSurface :: MonadIO m => Window -> m CInt+updateWindowSurface v1 = liftIO $ updateWindowSurfaceFFI v1+{-# INLINE updateWindowSurface #-}++updateWindowSurfaceRects :: MonadIO m => Window -> Ptr Rect -> CInt -> m CInt+updateWindowSurfaceRects v1 v2 v3 = liftIO $ updateWindowSurfaceRectsFFI v1 v2 v3+{-# INLINE updateWindowSurfaceRects #-}++videoInit :: MonadIO m => CString -> m CInt+videoInit v1 = liftIO $ videoInitFFI v1+{-# INLINE videoInit #-}++videoQuit :: MonadIO m => m ()+videoQuit = liftIO videoQuitFFI+{-# INLINE videoQuit #-}++createRenderer :: MonadIO m => Window -> CInt -> Word32 -> m Renderer+createRenderer v1 v2 v3 = liftIO $ createRendererFFI v1 v2 v3+{-# INLINE createRenderer #-}++createSoftwareRenderer :: MonadIO m => Ptr Surface -> m Renderer+createSoftwareRenderer v1 = liftIO $ createSoftwareRendererFFI v1+{-# INLINE createSoftwareRenderer #-}++createTexture :: MonadIO m => Renderer -> Word32 -> CInt -> CInt -> CInt -> m Texture+createTexture v1 v2 v3 v4 v5 = liftIO $ createTextureFFI v1 v2 v3 v4 v5+{-# INLINE createTexture #-}++createTextureFromSurface :: MonadIO m => Renderer -> Ptr Surface -> m Texture+createTextureFromSurface v1 v2 = liftIO $ createTextureFromSurfaceFFI v1 v2+{-# INLINE createTextureFromSurface #-}++destroyRenderer :: MonadIO m => Renderer -> m ()+destroyRenderer v1 = liftIO $ destroyRendererFFI v1+{-# INLINE destroyRenderer #-}++destroyTexture :: MonadIO m => Texture -> m ()+destroyTexture v1 = liftIO $ destroyTextureFFI v1+{-# INLINE destroyTexture #-}++getNumRenderDrivers :: MonadIO m => m CInt+getNumRenderDrivers = liftIO getNumRenderDriversFFI+{-# INLINE getNumRenderDrivers #-}++getRenderDrawBlendMode :: MonadIO m => Renderer -> Ptr BlendMode -> m Int+getRenderDrawBlendMode v1 v2 = liftIO $ getRenderDrawBlendModeFFI v1 v2+{-# INLINE getRenderDrawBlendMode #-}++getRenderDrawColor :: MonadIO m => Renderer -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m CInt+getRenderDrawColor v1 v2 v3 v4 v5 = liftIO $ getRenderDrawColorFFI v1 v2 v3 v4 v5+{-# INLINE getRenderDrawColor #-}++getRenderDriverInfo :: MonadIO m => CInt -> Ptr RendererInfo -> m CInt+getRenderDriverInfo v1 v2 = liftIO $ getRenderDriverInfoFFI v1 v2+{-# INLINE getRenderDriverInfo #-}++getRenderTarget :: MonadIO m => Renderer -> m Texture+getRenderTarget v1 = liftIO $ getRenderTargetFFI v1+{-# INLINE getRenderTarget #-}++getRenderer :: MonadIO m => Window -> m Renderer+getRenderer v1 = liftIO $ getRendererFFI v1+{-# INLINE getRenderer #-}++getRendererInfo :: MonadIO m => Renderer -> Ptr RendererInfo -> m CInt+getRendererInfo v1 v2 = liftIO $ getRendererInfoFFI v1 v2+{-# INLINE getRendererInfo #-}++getRendererOutputSize :: MonadIO m => Renderer -> Ptr CInt -> Ptr CInt -> m CInt+getRendererOutputSize v1 v2 v3 = liftIO $ getRendererOutputSizeFFI v1 v2 v3+{-# INLINE getRendererOutputSize #-}++getTextureAlphaMod :: MonadIO m => Texture -> Ptr Word8 -> m CInt+getTextureAlphaMod v1 v2 = liftIO $ getTextureAlphaModFFI v1 v2+{-# INLINE getTextureAlphaMod #-}++getTextureBlendMode :: MonadIO m => Texture -> Ptr BlendMode -> m CInt+getTextureBlendMode v1 v2 = liftIO $ getTextureBlendModeFFI v1 v2+{-# INLINE getTextureBlendMode #-}++getTextureColorMod :: MonadIO m => Texture -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m CInt+getTextureColorMod v1 v2 v3 v4 = liftIO $ getTextureColorModFFI v1 v2 v3 v4+{-# INLINE getTextureColorMod #-}++lockTexture :: MonadIO m => Texture -> Ptr Rect -> Ptr (Ptr ()) -> Ptr CInt -> m CInt+lockTexture v1 v2 v3 v4 = liftIO $ lockTextureFFI v1 v2 v3 v4+{-# INLINE lockTexture #-}++queryTexture :: MonadIO m => Texture -> Ptr Word32 -> Ptr CInt -> Ptr CInt -> Ptr CInt -> m CInt+queryTexture v1 v2 v3 v4 v5 = liftIO $ queryTextureFFI v1 v2 v3 v4 v5+{-# INLINE queryTexture #-}++renderClear :: MonadIO m => Renderer -> m CInt+renderClear v1 = liftIO $ renderClearFFI v1+{-# INLINE renderClear #-}++renderCopy :: MonadIO m => Renderer -> Texture -> Ptr Rect -> Ptr Rect -> m CInt+renderCopy v1 v2 v3 v4 = liftIO $ renderCopyFFI v1 v2 v3 v4+{-# INLINE renderCopy #-}++renderCopyEx :: MonadIO m => Renderer -> Texture -> Ptr Rect -> Ptr Rect -> CDouble -> Ptr Point -> RendererFlip -> m CInt+renderCopyEx v1 v2 v3 v4 v5 v6 v7 = liftIO $ renderCopyExFFI v1 v2 v3 v4 v5 v6 v7+{-# INLINE renderCopyEx #-}++renderDrawLine :: MonadIO m => Renderer -> CInt -> CInt -> CInt -> CInt -> m CInt+renderDrawLine v1 v2 v3 v4 v5 = liftIO $ renderDrawLineFFI v1 v2 v3 v4 v5+{-# INLINE renderDrawLine #-}++renderDrawLines :: MonadIO m => Renderer -> Ptr Point -> CInt -> m CInt+renderDrawLines v1 v2 v3 = liftIO $ renderDrawLinesFFI v1 v2 v3+{-# INLINE renderDrawLines #-}++renderDrawPoint :: MonadIO m => Renderer -> CInt -> CInt -> m CInt+renderDrawPoint v1 v2 v3 = liftIO $ renderDrawPointFFI v1 v2 v3+{-# INLINE renderDrawPoint #-}++renderDrawPoints :: MonadIO m => Renderer -> Ptr Point -> CInt -> m CInt+renderDrawPoints v1 v2 v3 = liftIO $ renderDrawPointsFFI v1 v2 v3+{-# INLINE renderDrawPoints #-}++renderDrawRect :: MonadIO m => Renderer -> Ptr Rect -> m CInt+renderDrawRect v1 v2 = liftIO $ renderDrawRectFFI v1 v2+{-# INLINE renderDrawRect #-}++renderDrawRects :: MonadIO m => Renderer -> Ptr Rect -> CInt -> m CInt+renderDrawRects v1 v2 v3 = liftIO $ renderDrawRectsFFI v1 v2 v3+{-# INLINE renderDrawRects #-}++renderFillRect :: MonadIO m => Renderer -> Ptr Rect -> m CInt+renderFillRect v1 v2 = liftIO $ renderFillRectFFI v1 v2+{-# INLINE renderFillRect #-}++renderFillRects :: MonadIO m => Renderer -> Ptr Rect -> CInt -> m CInt+renderFillRects v1 v2 v3 = liftIO $ renderFillRectsFFI v1 v2 v3+{-# INLINE renderFillRects #-}++renderGetClipRect :: MonadIO m => Renderer -> Ptr Rect -> m ()+renderGetClipRect v1 v2 = liftIO $ renderGetClipRectFFI v1 v2+{-# INLINE renderGetClipRect #-}++renderGetLogicalSize :: MonadIO m => Renderer -> Ptr CInt -> Ptr CInt -> m ()+renderGetLogicalSize v1 v2 v3 = liftIO $ renderGetLogicalSizeFFI v1 v2 v3+{-# INLINE renderGetLogicalSize #-}++renderGetScale :: MonadIO m => Renderer -> Ptr CFloat -> Ptr CFloat -> m ()+renderGetScale v1 v2 v3 = liftIO $ renderGetScaleFFI v1 v2 v3+{-# INLINE renderGetScale #-}++renderGetViewport :: MonadIO m => Renderer -> Ptr Rect -> m ()+renderGetViewport v1 v2 = liftIO $ renderGetViewportFFI v1 v2+{-# INLINE renderGetViewport #-}++renderIsClipEnabled :: MonadIO m => Renderer -> m Bool+renderIsClipEnabled v1 = liftIO $ renderIsClipEnabledFFI v1+{-# INLINE renderIsClipEnabled #-}++renderPresent :: MonadIO m => Renderer -> m ()+renderPresent v1 = liftIO $ renderPresentFFI v1+{-# INLINE renderPresent #-}++renderReadPixels :: MonadIO m => Renderer -> Ptr Rect -> Word32 -> Ptr () -> CInt -> m CInt+renderReadPixels v1 v2 v3 v4 v5 = liftIO $ renderReadPixelsFFI v1 v2 v3 v4 v5+{-# INLINE renderReadPixels #-}++renderSetClipRect :: MonadIO m => Renderer -> Ptr Rect -> m CInt+renderSetClipRect v1 v2 = liftIO $ renderSetClipRectFFI v1 v2+{-# INLINE renderSetClipRect #-}++renderSetLogicalSize :: MonadIO m => Renderer -> CInt -> CInt -> m CInt+renderSetLogicalSize v1 v2 v3 = liftIO $ renderSetLogicalSizeFFI v1 v2 v3+{-# INLINE renderSetLogicalSize #-}++renderSetScale :: MonadIO m => Renderer -> CFloat -> CFloat -> m CInt+renderSetScale v1 v2 v3 = liftIO $ renderSetScaleFFI v1 v2 v3+{-# INLINE renderSetScale #-}++renderSetViewport :: MonadIO m => Renderer -> Ptr Rect -> m CInt+renderSetViewport v1 v2 = liftIO $ renderSetViewportFFI v1 v2+{-# INLINE renderSetViewport #-}++renderTargetSupported :: MonadIO m => Renderer -> m Bool+renderTargetSupported v1 = liftIO $ renderTargetSupportedFFI v1+{-# INLINE renderTargetSupported #-}++setRenderDrawBlendMode :: MonadIO m => Renderer -> BlendMode -> m CInt+setRenderDrawBlendMode v1 v2 = liftIO $ setRenderDrawBlendModeFFI v1 v2+{-# INLINE setRenderDrawBlendMode #-}++setRenderDrawColor :: MonadIO m => Renderer -> Word8 -> Word8 -> Word8 -> Word8 -> m CInt+setRenderDrawColor v1 v2 v3 v4 v5 = liftIO $ setRenderDrawColorFFI v1 v2 v3 v4 v5+{-# INLINE setRenderDrawColor #-}++setRenderTarget :: MonadIO m => Renderer -> Texture -> m CInt+setRenderTarget v1 v2 = liftIO $ setRenderTargetFFI v1 v2+{-# INLINE setRenderTarget #-}++setTextureAlphaMod :: MonadIO m => Texture -> Word8 -> m CInt+setTextureAlphaMod v1 v2 = liftIO $ setTextureAlphaModFFI v1 v2+{-# INLINE setTextureAlphaMod #-}++setTextureBlendMode :: MonadIO m => Texture -> BlendMode -> m CInt+setTextureBlendMode v1 v2 = liftIO $ setTextureBlendModeFFI v1 v2+{-# INLINE setTextureBlendMode #-}++setTextureColorMod :: MonadIO m => Texture -> Word8 -> Word8 -> Word8 -> m CInt+setTextureColorMod v1 v2 v3 v4 = liftIO $ setTextureColorModFFI v1 v2 v3 v4+{-# INLINE setTextureColorMod #-}++unlockTexture :: MonadIO m => Texture -> m ()+unlockTexture v1 = liftIO $ unlockTextureFFI v1+{-# INLINE unlockTexture #-}++updateTexture :: MonadIO m => Texture -> Ptr Rect -> Ptr () -> CInt -> m CInt+updateTexture v1 v2 v3 v4 = liftIO $ updateTextureFFI v1 v2 v3 v4+{-# INLINE updateTexture #-}++updateYUVTexture :: MonadIO m => Texture -> Ptr Rect -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> Ptr Word8 -> CInt -> m CInt+updateYUVTexture v1 v2 v3 v4 v5 v6 v7 v8 = liftIO $ updateYUVTextureFFI v1 v2 v3 v4 v5 v6 v7 v8+{-# INLINE updateYUVTexture #-}++allocFormat :: MonadIO m => Word32 -> m (Ptr PixelFormat)+allocFormat v1 = liftIO $ allocFormatFFI v1+{-# INLINE allocFormat #-}++allocPalette :: MonadIO m => CInt -> m (Ptr Palette)+allocPalette v1 = liftIO $ allocPaletteFFI v1+{-# INLINE allocPalette #-}++calculateGammaRamp :: MonadIO m => CFloat -> Ptr Word16 -> m ()+calculateGammaRamp v1 v2 = liftIO $ calculateGammaRampFFI v1 v2+{-# INLINE calculateGammaRamp #-}++freeFormat :: MonadIO m => Ptr PixelFormat -> m ()+freeFormat v1 = liftIO $ freeFormatFFI v1+{-# INLINE freeFormat #-}++freePalette :: MonadIO m => Ptr Palette -> m ()+freePalette v1 = liftIO $ freePaletteFFI v1+{-# INLINE freePalette #-}++getPixelFormatName :: MonadIO m => Word32 -> m CString+getPixelFormatName v1 = liftIO $ getPixelFormatNameFFI v1+{-# INLINE getPixelFormatName #-}++getRGB :: MonadIO m => Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m ()+getRGB v1 v2 v3 v4 v5 = liftIO $ getRGBFFI v1 v2 v3 v4 v5+{-# INLINE getRGB #-}++getRGBA :: MonadIO m => Word32 -> Ptr PixelFormat -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m ()+getRGBA v1 v2 v3 v4 v5 v6 = liftIO $ getRGBAFFI v1 v2 v3 v4 v5 v6+{-# INLINE getRGBA #-}++mapRGB :: MonadIO m => Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> m Word32+mapRGB v1 v2 v3 v4 = liftIO $ mapRGBFFI v1 v2 v3 v4+{-# INLINE mapRGB #-}++mapRGBA :: MonadIO m => Ptr PixelFormat -> Word8 -> Word8 -> Word8 -> Word8 -> m Word32+mapRGBA v1 v2 v3 v4 v5 = liftIO $ mapRGBAFFI v1 v2 v3 v4 v5+{-# INLINE mapRGBA #-}++masksToPixelFormatEnum :: MonadIO m => CInt -> Word32 -> Word32 -> Word32 -> Word32 -> m Word32+masksToPixelFormatEnum v1 v2 v3 v4 v5 = liftIO $ masksToPixelFormatEnumFFI v1 v2 v3 v4 v5+{-# INLINE masksToPixelFormatEnum #-}++pixelFormatEnumToMasks :: MonadIO m => Word32 -> Ptr CInt -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> m Bool+pixelFormatEnumToMasks v1 v2 v3 v4 v5 v6 = liftIO $ pixelFormatEnumToMasksFFI v1 v2 v3 v4 v5 v6+{-# INLINE pixelFormatEnumToMasks #-}++setPaletteColors :: MonadIO m => Ptr Palette -> Ptr Color -> CInt -> CInt -> m CInt+setPaletteColors v1 v2 v3 v4 = liftIO $ setPaletteColorsFFI v1 v2 v3 v4+{-# INLINE setPaletteColors #-}++setPixelFormatPalette :: MonadIO m => Ptr PixelFormat -> Ptr Palette -> m CInt+setPixelFormatPalette v1 v2 = liftIO $ setPixelFormatPaletteFFI v1 v2+{-# INLINE setPixelFormatPalette #-}++enclosePoints :: MonadIO m => Ptr Point -> CInt -> Ptr Rect -> Ptr Rect -> m Bool+enclosePoints v1 v2 v3 v4 = liftIO $ enclosePointsFFI v1 v2 v3 v4+{-# INLINE enclosePoints #-}++hasIntersection :: MonadIO m => Ptr Rect -> Ptr Rect -> m Bool+hasIntersection v1 v2 = liftIO $ hasIntersectionFFI v1 v2+{-# INLINE hasIntersection #-}++intersectRect :: MonadIO m => Ptr Rect -> Ptr Rect -> Ptr Rect -> m Bool+intersectRect v1 v2 v3 = liftIO $ intersectRectFFI v1 v2 v3+{-# INLINE intersectRect #-}++intersectRectAndLine :: MonadIO m => Ptr Rect -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt -> m Bool+intersectRectAndLine v1 v2 v3 v4 v5 = liftIO $ intersectRectAndLineFFI v1 v2 v3 v4 v5+{-# INLINE intersectRectAndLine #-}++unionRect :: MonadIO m => Ptr Rect -> Ptr Rect -> Ptr Rect -> m ()+unionRect v1 v2 v3 = liftIO $ unionRectFFI v1 v2 v3+{-# INLINE unionRect #-}++blitScaled :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt+blitScaled v1 v2 v3 v4 = liftIO $ blitScaledFFI v1 v2 v3 v4+{-# INLINE blitScaled #-}++blitSurface :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt+blitSurface v1 v2 v3 v4 = liftIO $ blitSurfaceFFI v1 v2 v3 v4+{-# INLINE blitSurface #-}++convertPixels :: MonadIO m => CInt -> CInt -> Word32 -> Ptr () -> CInt -> Word32 -> Ptr () -> CInt -> m CInt+convertPixels v1 v2 v3 v4 v5 v6 v7 v8 = liftIO $ convertPixelsFFI v1 v2 v3 v4 v5 v6 v7 v8+{-# INLINE convertPixels #-}++convertSurface :: MonadIO m => Ptr Surface -> Ptr PixelFormat -> Word32 -> m (Ptr Surface)+convertSurface v1 v2 v3 = liftIO $ convertSurfaceFFI v1 v2 v3+{-# INLINE convertSurface #-}++convertSurfaceFormat :: MonadIO m => Ptr Surface -> Word32 -> Word32 -> m (Ptr Surface)+convertSurfaceFormat v1 v2 v3 = liftIO $ convertSurfaceFormatFFI v1 v2 v3+{-# INLINE convertSurfaceFormat #-}++createRGBSurface :: MonadIO m => Word32 -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> m (Ptr Surface)+createRGBSurface v1 v2 v3 v4 v5 v6 v7 v8 = liftIO $ createRGBSurfaceFFI v1 v2 v3 v4 v5 v6 v7 v8+{-# INLINE createRGBSurface #-}++createRGBSurfaceFrom :: MonadIO m => Ptr () -> CInt -> CInt -> CInt -> CInt -> Word32 -> Word32 -> Word32 -> Word32 -> m (Ptr Surface)+createRGBSurfaceFrom v1 v2 v3 v4 v5 v6 v7 v8 v9 = liftIO $ createRGBSurfaceFromFFI v1 v2 v3 v4 v5 v6 v7 v8 v9+{-# INLINE createRGBSurfaceFrom #-}++fillRect :: MonadIO m => Ptr Surface -> Ptr Rect -> Word32 -> m CInt+fillRect v1 v2 v3 = liftIO $ fillRectFFI v1 v2 v3+{-# INLINE fillRect #-}++fillRects :: MonadIO m => Ptr Surface -> Ptr Rect -> CInt -> Word32 -> m CInt+fillRects v1 v2 v3 v4 = liftIO $ fillRectsFFI v1 v2 v3 v4+{-# INLINE fillRects #-}++freeSurface :: MonadIO m => Ptr Surface -> m ()+freeSurface v1 = liftIO $ freeSurfaceFFI v1+{-# INLINE freeSurface #-}++getClipRect :: MonadIO m => Ptr Surface -> Ptr Rect -> m ()+getClipRect v1 v2 = liftIO $ getClipRectFFI v1 v2+{-# INLINE getClipRect #-}++getColorKey :: MonadIO m => Ptr Surface -> Ptr Word32 -> m CInt+getColorKey v1 v2 = liftIO $ getColorKeyFFI v1 v2+{-# INLINE getColorKey #-}++getSurfaceAlphaMod :: MonadIO m => Ptr Surface -> Ptr Word8 -> m CInt+getSurfaceAlphaMod v1 v2 = liftIO $ getSurfaceAlphaModFFI v1 v2+{-# INLINE getSurfaceAlphaMod #-}++getSurfaceBlendMode :: MonadIO m => Ptr Surface -> Ptr BlendMode -> m CInt+getSurfaceBlendMode v1 v2 = liftIO $ getSurfaceBlendModeFFI v1 v2+{-# INLINE getSurfaceBlendMode #-}++getSurfaceColorMod :: MonadIO m => Ptr Surface -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> m CInt+getSurfaceColorMod v1 v2 v3 v4 = liftIO $ getSurfaceColorModFFI v1 v2 v3 v4+{-# INLINE getSurfaceColorMod #-}++loadBMP :: MonadIO m => CString -> m (Ptr Surface)+loadBMP file = liftIO $ do+  rw <- withCString "rb" $ rwFromFile file+  loadBMP_RW rw 1+{-# INLINE loadBMP #-}++loadBMP_RW :: MonadIO m => Ptr RWops -> CInt -> m (Ptr Surface)+loadBMP_RW v1 v2 = liftIO $ loadBMP_RWFFI v1 v2+{-# INLINE loadBMP_RW #-}++lockSurface :: MonadIO m => Ptr Surface -> m CInt+lockSurface v1 = liftIO $ lockSurfaceFFI v1+{-# INLINE lockSurface #-}++lowerBlit :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt+lowerBlit v1 v2 v3 v4 = liftIO $ lowerBlitFFI v1 v2 v3 v4+{-# INLINE lowerBlit #-}++lowerBlitScaled :: MonadIO m => Ptr Surface -> Ptr Rect -> Ptr Surface -> Ptr Rect -> m CInt+lowerBlitScaled v1 v2 v3 v4 = liftIO $ lowerBlitScaledFFI v1 v2 v3 v4+{-# INLINE lowerBlitScaled #-}++saveBMP :: MonadIO m => Ptr Surface -> CString -> m CInt+saveBMP surface file = liftIO $ do+  rw <- withCString "wb" $ rwFromFile file+  saveBMP_RW surface rw 1+{-# INLINE saveBMP #-}++saveBMP_RW :: MonadIO m => Ptr Surface -> Ptr RWops -> CInt -> m CInt+saveBMP_RW v1 v2 v3 = liftIO $ saveBMP_RWFFI v1 v2 v3+{-# INLINE saveBMP_RW #-}++setClipRect :: MonadIO m => Ptr Surface -> Ptr Rect -> m Bool+setClipRect v1 v2 = liftIO $ setClipRectFFI v1 v2+{-# INLINE setClipRect #-}++setColorKey :: MonadIO m => Ptr Surface -> CInt -> Word32 -> m CInt+setColorKey v1 v2 v3 = liftIO $ setColorKeyFFI v1 v2 v3+{-# INLINE setColorKey #-}++setSurfaceAlphaMod :: MonadIO m => Ptr Surface -> Word8 -> m CInt+setSurfaceAlphaMod v1 v2 = liftIO $ setSurfaceAlphaModFFI v1 v2+{-# INLINE setSurfaceAlphaMod #-}++setSurfaceBlendMode :: MonadIO m => Ptr Surface -> BlendMode -> m CInt+setSurfaceBlendMode v1 v2 = liftIO $ setSurfaceBlendModeFFI v1 v2+{-# INLINE setSurfaceBlendMode #-}++setSurfaceColorMod :: MonadIO m => Ptr Surface -> Word8 -> Word8 -> Word8 -> m CInt+setSurfaceColorMod v1 v2 v3 v4 = liftIO $ setSurfaceColorModFFI v1 v2 v3 v4+{-# INLINE setSurfaceColorMod #-}++setSurfacePalette :: MonadIO m => Ptr Surface -> Ptr Palette -> m CInt+setSurfacePalette v1 v2 = liftIO $ setSurfacePaletteFFI v1 v2+{-# INLINE setSurfacePalette #-}++setSurfaceRLE :: MonadIO m => Ptr Surface -> CInt -> m CInt+setSurfaceRLE v1 v2 = liftIO $ setSurfaceRLEFFI v1 v2+{-# INLINE setSurfaceRLE #-}++unlockSurface :: MonadIO m => Ptr Surface -> m ()+unlockSurface v1 = liftIO $ unlockSurfaceFFI v1+{-# INLINE unlockSurface #-}++getWindowWMInfo :: MonadIO m => Window -> SysWMinfo -> m Bool+getWindowWMInfo v1 v2 = liftIO $ getWindowWMInfoFFI v1 v2+{-# INLINE getWindowWMInfo #-}++getClipboardText :: MonadIO m => m CString+getClipboardText = liftIO getClipboardTextFFI+{-# INLINE getClipboardText #-}++hasClipboardText :: MonadIO m => m Bool+hasClipboardText = liftIO hasClipboardTextFFI+{-# INLINE hasClipboardText #-}++setClipboardText :: MonadIO m => CString -> m CInt+setClipboardText v1 = liftIO $ setClipboardTextFFI v1+{-# INLINE setClipboardText #-}
src/SDL/Time.hs view
@@ -1,95 +1,95 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE OverloadedStrings #-}
-module SDL.Time
-  ( -- * Time Measurement
-    ticks
-  , time
-
-    -- * Timer
-  , delay
-  , TimerCallback
-  , Timer
-  , RetriggerTimer(..)
-  , addTimer
-  , removeTimer
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Data (Data)
-import Data.Typeable
-import Data.Word
-import Foreign
-import GHC.Generics (Generic)
-
-import SDL.Internal.Exception
-
-import qualified SDL.Raw.Timer as Raw
-import qualified SDL.Raw.Types as Raw
-
--- | Number of milliseconds since library initialization.
---
--- See @<https://wiki.libsdl.org/SDL_GetTicks SDL_GetTicks>@ for C documentation.
-ticks :: MonadIO m => m Word32
-ticks = Raw.getTicks
-
--- | The current time in seconds since some arbitrary starting point (consist over the life of the application).
---
--- This time is derived from the system's performance counter - see @<https://wiki.libsdl.org/SDL_GetPerformanceFrequency SDL_GetPerformanceFrequency>@ and @<https://wiki.libsdl.org/SDL_GetPerformanceCounter SDL_GetPerformanceCounter>@ for C documentation about the implementation.
-time :: (Fractional a, MonadIO m) => m a
-time = do
-  freq <- Raw.getPerformanceFrequency
-  cnt <- Raw.getPerformanceCounter
-  return $ fromIntegral cnt / fromIntegral freq
-
--- | Wait a specified number of milliseconds before returning.
---
--- Users are generally recommended to use 'threadDelay' instead, to take advantage of the abilities of the Haskell runtime.
---
--- See @<https://wiki.libsdl.org/SDL_Delay SDL_Delay>@ for C documentation.
-delay :: MonadIO m => Word32 -> m ()
-delay = Raw.delay
-
--- | 'RetriggerTimer' allows a callback to inform SDL if the timer should be retriggered or cancelled
-data RetriggerTimer
-  = Reschedule Word32
-    -- ^ Retrigger the timer again in a given number of milliseconds.
-  | Cancel
-    -- ^ Cancel future invocations of this timer.
-  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | A 'TimerCallback' is called with the interval size of the callback. It can return information as to whether or not the timer should continue to exist.
-type TimerCallback = Word32 -> IO RetriggerTimer
-
--- | A timer created by 'addTimer'. This 'Timer' can be removed with 'removeTimer'.
-newtype Timer =
-  Timer {runTimerRemoval :: IO Bool}
-
--- | Set up a callback function to be run on a separate thread after the specified number of milliseconds has elapsed.
---
--- See @<https://wiki.libsdl.org/SDL_AddTimer SDL_AddTimer>@ for C documentation.
-addTimer :: MonadIO m => Word32 -> TimerCallback -> m Timer
-addTimer timeout callback = liftIO $ do
-    cb <- Raw.mkTimerCallback wrappedCb
-    tid <- throwIf0 "addTimer" "SDL_AddTimer" $ Raw.addTimer timeout cb nullPtr
-    return (Timer $ auxRemove cb tid)
-  where
-    wrappedCb :: Word32 -> Ptr () -> IO Word32
-    wrappedCb w _ = do
-      next <- callback w
-      return $ case next of
-        Cancel       -> 0
-        Reschedule n -> n
-
-    auxRemove :: Raw.TimerCallback -> Raw.TimerID -> IO Bool
-    auxRemove cb tid = do
-      isSuccess <- Raw.removeTimer tid
-      if (isSuccess)
-        then freeHaskellFunPtr cb >> return True
-        else return False
-
--- | Remove a 'Timer'.
---
--- See @<https://wiki.libsdl.org/SDL_RemoveTimer SDL_RemoveTimer>@ for C documentation.
-removeTimer :: MonadIO m => Timer -> m Bool
-removeTimer f = liftIO $ runTimerRemoval f
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE OverloadedStrings #-}+module SDL.Time+  ( -- * Time Measurement+    ticks+  , time++    -- * Timer+  , delay+  , TimerCallback+  , Timer+  , RetriggerTimer(..)+  , addTimer+  , removeTimer+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Data (Data)+import Data.Typeable+import Data.Word+import Foreign+import GHC.Generics (Generic)++import SDL.Internal.Exception++import qualified SDL.Raw.Timer as Raw+import qualified SDL.Raw.Types as Raw++-- | Number of milliseconds since library initialization.+--+-- See @<https://wiki.libsdl.org/SDL_GetTicks SDL_GetTicks>@ for C documentation.+ticks :: MonadIO m => m Word32+ticks = Raw.getTicks++-- | The current time in seconds since some arbitrary starting point (consist over the life of the application).+--+-- This time is derived from the system's performance counter - see @<https://wiki.libsdl.org/SDL_GetPerformanceFrequency SDL_GetPerformanceFrequency>@ and @<https://wiki.libsdl.org/SDL_GetPerformanceCounter SDL_GetPerformanceCounter>@ for C documentation about the implementation.+time :: (Fractional a, MonadIO m) => m a+time = do+  freq <- Raw.getPerformanceFrequency+  cnt <- Raw.getPerformanceCounter+  return $ fromIntegral cnt / fromIntegral freq++-- | Wait a specified number of milliseconds before returning.+--+-- Users are generally recommended to use 'threadDelay' instead, to take advantage of the abilities of the Haskell runtime.+--+-- See @<https://wiki.libsdl.org/SDL_Delay SDL_Delay>@ for C documentation.+delay :: MonadIO m => Word32 -> m ()+delay = Raw.delay++-- | 'RetriggerTimer' allows a callback to inform SDL if the timer should be retriggered or cancelled+data RetriggerTimer+  = Reschedule Word32+    -- ^ Retrigger the timer again in a given number of milliseconds.+  | Cancel+    -- ^ Cancel future invocations of this timer.+  deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++-- | A 'TimerCallback' is called with the interval size of the callback. It can return information as to whether or not the timer should continue to exist.+type TimerCallback = Word32 -> IO RetriggerTimer++-- | A timer created by 'addTimer'. This 'Timer' can be removed with 'removeTimer'.+newtype Timer =+  Timer {runTimerRemoval :: IO Bool}++-- | Set up a callback function to be run on a separate thread after the specified number of milliseconds has elapsed.+--+-- See @<https://wiki.libsdl.org/SDL_AddTimer SDL_AddTimer>@ for C documentation.+addTimer :: MonadIO m => Word32 -> TimerCallback -> m Timer+addTimer timeout callback = liftIO $ do+    cb <- Raw.mkTimerCallback wrappedCb+    tid <- throwIf0 "addTimer" "SDL_AddTimer" $ Raw.addTimer timeout cb nullPtr+    return (Timer $ auxRemove cb tid)+  where+    wrappedCb :: Word32 -> Ptr () -> IO Word32+    wrappedCb w _ = do+      next <- callback w+      return $ case next of+        Cancel       -> 0+        Reschedule n -> n++    auxRemove :: Raw.TimerCallback -> Raw.TimerID -> IO Bool+    auxRemove cb tid = do+      isSuccess <- Raw.removeTimer tid+      if (isSuccess)+        then freeHaskellFunPtr cb >> return True+        else return False++-- | Remove a 'Timer'.+--+-- See @<https://wiki.libsdl.org/SDL_RemoveTimer SDL_RemoveTimer>@ for C documentation.+removeTimer :: MonadIO m => Timer -> m Bool+removeTimer f = liftIO $ runTimerRemoval f
src/SDL/Video.hs view
@@ -1,587 +1,587 @@-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-module SDL.Video
-  ( module SDL.Video.OpenGL
-  , module SDL.Video.Renderer
-
-  -- * Window Management
-  , Window
-  , createWindow
-  , defaultWindow
-  , WindowConfig(..)
-  , WindowMode(..)
-  , WindowPosition(..)
-  , destroyWindow
-
-  -- * Window Actions
-  , hideWindow
-  , raiseWindow
-  , showWindow
-
-  -- * Window Attributes
-  , windowMinimumSize
-  , windowMaximumSize
-  , windowSize
-  , windowBordered
-  , windowBrightness
-  , windowGammaRamp
-  , windowGrab
-  , setWindowMode
-  , getWindowAbsolutePosition
-  , setWindowPosition
-  , windowTitle
-  , windowData
-  , getWindowConfig
-  , getWindowPixelFormat
-  , PixelFormat(..)
-
-  -- * Renderer Management
-  , createRenderer
-  , createSoftwareRenderer
-  , destroyRenderer
-
-  -- * Clipboard Handling
-  , getClipboardText
-  , hasClipboardText
-  , setClipboardText
-
-  -- * Display
-  , getDisplays
-  , Display(..)
-  , DisplayMode(..)
-  , VideoDriver(..)
-
-  -- * Screen Savers
-  -- | Screen savers should be disabled when the sudden enablement of the
-  -- monitor's power saving features would be inconvenient for when the user
-  -- hasn't provided any input for some period of time, such as during video
-  -- playback.
-  --
-  -- Screen savers are disabled by default upon the initialization of the
-  -- video subsystem.
-  , screenSaverEnabled
-
-  -- * Message Box
-  , showSimpleMessageBox
-  , MessageKind(..)
-  ) where
-
-import Prelude hiding (all, foldl, foldr, mapM_)
-
-import Data.StateVar
-import Control.Applicative
-import Control.Exception
-import Control.Monad (forM, unless, void)
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Bits
-import Data.Data (Data)
-import Data.Foldable
-import Data.Maybe (isJust, fromMaybe)
-import Data.Monoid (First(..))
-import Data.Text (Text)
-import Data.Typeable
-import Foreign hiding (void, throwIfNull, throwIfNeg, throwIfNeg_)
-import Foreign.C
-import GHC.Generics (Generic)
-import SDL.Vect
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import SDL.Internal.Types
-import SDL.Video.OpenGL
-import SDL.Video.Renderer
-
-import qualified Data.ByteString as BS
-import qualified Data.Text.Encoding as Text
-import qualified Data.Vector.Storable as SV
-import qualified SDL.Raw as Raw
-
--- | Create a window with the given title and configuration.
---
--- Throws 'SDLException' on failure.
-createWindow :: MonadIO m => Text -> WindowConfig -> m Window
-createWindow title config = liftIO $ do
-  case windowOpenGL config of
-    Just glcfg -> setGLAttributes glcfg
-    Nothing    -> return ()
-
-  BS.useAsCString (Text.encodeUtf8 title) $ \title' -> do
-    let create = Raw.createWindow title'
-    let create' (V2 w h) = case windowPosition config of
-          Centered -> let u = Raw.SDL_WINDOWPOS_CENTERED in create u u w h
-          Wherever -> let u = Raw.SDL_WINDOWPOS_UNDEFINED in create u u w h
-          Absolute (P (V2 x y)) -> create x y w h
-    create' (windowInitialSize config) flags >>= return . Window
-  where
-    flags = foldr (.|.) 0
-      [ if windowBorder config then 0 else Raw.SDL_WINDOW_BORDERLESS
-      , if windowHighDPI config then Raw.SDL_WINDOW_ALLOW_HIGHDPI else 0
-      , if windowInputGrabbed config then Raw.SDL_WINDOW_INPUT_GRABBED else 0
-      , toNumber $ windowMode config
-      , if isJust $ windowOpenGL config then Raw.SDL_WINDOW_OPENGL else 0
-      , if windowResizable config then Raw.SDL_WINDOW_RESIZABLE else 0
-      , if windowVisible config then 0 else Raw.SDL_WINDOW_HIDDEN
-      ]
-    setGLAttributes (OpenGLConfig (V4 r g b a) d s ms p) = do
-      let (msk, v0, v1, flg) = case p of
-            Core Debug v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_CORE, v0', v1', Raw.SDL_GL_CONTEXT_DEBUG_FLAG)
-            Core Normal v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_CORE, v0', v1', 0)
-            Compatibility Debug v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY, v0', v1', Raw.SDL_GL_CONTEXT_DEBUG_FLAG)
-            Compatibility Normal v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY, v0', v1', 0)
-            ES Debug v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_ES, v0', v1', Raw.SDL_GL_CONTEXT_DEBUG_FLAG)
-            ES Normal v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_ES, v0', v1', 0)
-      mapM_ (throwIfNeg_ "SDL.Video.createWindow" "SDL_GL_SetAttribute" . uncurry Raw.glSetAttribute) $
-        [ (Raw.SDL_GL_RED_SIZE, r)
-        , (Raw.SDL_GL_GREEN_SIZE, g)
-        , (Raw.SDL_GL_BLUE_SIZE, b)
-        , (Raw.SDL_GL_ALPHA_SIZE, a)
-        , (Raw.SDL_GL_DEPTH_SIZE, d)
-        , (Raw.SDL_GL_STENCIL_SIZE, s)
-        , (Raw.SDL_GL_MULTISAMPLEBUFFERS, if ms > 1 then 1 else 0)
-        , (Raw.SDL_GL_MULTISAMPLESAMPLES, if ms > 1 then ms else 0)
-        , (Raw.SDL_GL_CONTEXT_PROFILE_MASK, msk)
-        , (Raw.SDL_GL_CONTEXT_MAJOR_VERSION, v0)
-        , (Raw.SDL_GL_CONTEXT_MINOR_VERSION, v1)
-        , (Raw.SDL_GL_CONTEXT_FLAGS, flg)
-        ]
-
--- | Default configuration for windows. Use the record update syntax to
--- override any of the defaults.
---
--- @
--- 'defaultWindow' = 'WindowConfig'
---   { 'windowBorder'       = True
---   , 'windowHighDPI'      = False
---   , 'windowInputGrabbed' = False
---   , 'windowMode'         = 'Windowed'
---   , 'windowOpenGL'       = Nothing
---   , 'windowPosition'     = 'Wherever'
---   , 'windowResizable'    = False
---   , 'windowInitialSize'  = V2 800 600
---   , 'windowVisible'      = True
---   }
--- @
-defaultWindow :: WindowConfig
-defaultWindow = WindowConfig
-  { windowBorder       = True
-  , windowHighDPI      = False
-  , windowInputGrabbed = False
-  , windowMode         = Windowed
-  , windowOpenGL       = Nothing
-  , windowPosition     = Wherever
-  , windowResizable    = False
-  , windowInitialSize  = V2 800 600
-  , windowVisible      = True
-  }
-
-data WindowConfig = WindowConfig
-  { windowBorder       :: Bool               -- ^ Defaults to 'True'.
-  , windowHighDPI      :: Bool               -- ^ Defaults to 'False'. Can not be changed after window creation.
-  , windowInputGrabbed :: Bool               -- ^ Defaults to 'False'. Whether the mouse shall be confined to the window.
-  , windowMode         :: WindowMode         -- ^ Defaults to 'Windowed'.
-  , windowOpenGL       :: Maybe OpenGLConfig -- ^ Defaults to 'Nothing'. Can not be changed after window creation.
-  , windowPosition     :: WindowPosition     -- ^ Defaults to 'Wherever'.
-  , windowResizable    :: Bool               -- ^ Defaults to 'False'. Whether the window can be resized by the user. It is still possible to programatically change the size by changing 'windowSize'.
-  , windowInitialSize  :: V2 CInt            -- ^ Defaults to @(800, 600)@. If you set 'windowHighDPI' flag, window size in screen coordinates may differ from the size in pixels. Use 'glGetDrawableSize' to get size in pixels.
-  , windowVisible      :: Bool               -- ^ Defaults to 'True'.
-  } deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
-data WindowMode
-  = Fullscreen        -- ^ Real fullscreen with a video mode change
-  | FullscreenDesktop -- ^ Fake fullscreen that takes the size of the desktop
-  | Maximized
-  | Minimized
-  | Windowed
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance ToNumber WindowMode Word32 where
-  toNumber Fullscreen = Raw.SDL_WINDOW_FULLSCREEN
-  toNumber FullscreenDesktop = Raw.SDL_WINDOW_FULLSCREEN_DESKTOP
-  toNumber Maximized = Raw.SDL_WINDOW_MAXIMIZED
-  toNumber Minimized = Raw.SDL_WINDOW_MINIMIZED
-  toNumber Windowed = 0
-
-instance FromNumber WindowMode Word32 where
-  fromNumber n = fromMaybe Windowed . getFirst $
-    foldMap First [
-        sdlWindowFullscreen
-      , sdlWindowFullscreenDesktop
-      , sdlWindowMaximized
-      , sdlWindowMinimized
-      ]
-    where
-      maybeBit val msk = if n .&. msk > 0 then Just val else Nothing
-      sdlWindowFullscreen        = maybeBit Fullscreen Raw.SDL_WINDOW_FULLSCREEN
-      sdlWindowFullscreenDesktop = maybeBit FullscreenDesktop Raw.SDL_WINDOW_FULLSCREEN_DESKTOP
-      sdlWindowMaximized         = maybeBit Maximized Raw.SDL_WINDOW_MAXIMIZED
-      sdlWindowMinimized         = maybeBit Minimized Raw.SDL_WINDOW_MINIMIZED
-
-data WindowPosition
-  = Centered
-  | Wherever -- ^ Let the window mananger decide where it's best to place the window.
-  | Absolute (Point V2 CInt)
-  deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Destroy the given window. The 'Window' handler may not be used
--- afterwards.
-destroyWindow :: MonadIO m => Window -> m ()
-destroyWindow (Window w) = Raw.destroyWindow w
-
--- | Get or set if the window should have a border.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
-windowBordered :: Window -> StateVar Bool
-windowBordered (Window w) = makeStateVar getWindowBordered setWindowBordered
-  where
-  getWindowBordered = fmap ((== 0) . (.&. Raw.SDL_WINDOW_BORDERLESS)) (Raw.getWindowFlags w)
-  setWindowBordered = Raw.setWindowBordered w
-
--- | Get or set the window's brightness, where 0.0 is completely dark and 1.0 is normal brightness.
---
--- Throws 'SDLException' if the hardware does not support gamma
--- correction, or if the system has run out of memory.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
-windowBrightness :: Window -> StateVar Float
-windowBrightness (Window w) = makeStateVar getWindowBrightness setWindowBrightness
-  where
-  setWindowBrightness brightness = do
-    throwIfNot0_ "SDL.Video.setWindowBrightness" "SDL_SetWindowBrightness" $
-      Raw.setWindowBrightness w $ realToFrac brightness
-
-  getWindowBrightness =
-      return . realToFrac =<< Raw.getWindowBrightness w
-
--- | Get or set whether the mouse shall be confined to the window.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
-windowGrab :: Window -> StateVar Bool
-windowGrab (Window w) = makeStateVar getWindowGrab setWindowGrab
-  where
-  setWindowGrab = Raw.setWindowGrab w
-  getWindowGrab = Raw.getWindowGrab w
-
--- | Change between window modes.
---
--- Throws 'SDLException' on failure.
-setWindowMode :: MonadIO m => Window -> WindowMode -> m ()
-setWindowMode (Window w) mode =
-  liftIO . throwIfNot0_ "SDL.Video.setWindowMode" "SDL_SetWindowFullscreen" $
-    case mode of
-      Fullscreen -> Raw.setWindowFullscreen w Raw.SDL_WINDOW_FULLSCREEN <* Raw.raiseWindow w
-      FullscreenDesktop -> Raw.setWindowFullscreen w Raw.SDL_WINDOW_FULLSCREEN_DESKTOP <* Raw.raiseWindow w
-      Maximized -> Raw.setWindowFullscreen w 0 <* Raw.maximizeWindow w
-      Minimized -> Raw.minimizeWindow w >> return 0
-      Windowed -> Raw.setWindowFullscreen w 0 <* Raw.restoreWindow w
-
--- | Set the position of the window.
-setWindowPosition :: MonadIO m => Window -> WindowPosition -> m ()
-setWindowPosition (Window w) pos = case pos of
-  Centered -> let u = Raw.SDL_WINDOWPOS_CENTERED in Raw.setWindowPosition w u u
-  Wherever -> let u = Raw.SDL_WINDOWPOS_UNDEFINED in Raw.setWindowPosition w u u
-  Absolute (P (V2 x y)) -> Raw.setWindowPosition w x y
-
--- | Get the position of the window.
-getWindowAbsolutePosition :: MonadIO m => Window -> m (V2 CInt)
-getWindowAbsolutePosition (Window w) =
-    liftIO $
-    alloca $ \wPtr ->
-    alloca $ \hPtr -> do
-        Raw.getWindowPosition w wPtr hPtr
-        V2 <$> peek wPtr <*> peek hPtr
-
--- | Get or set the size of a window's client area. Values beyond the maximum supported size are clamped.
---
--- If window was created with 'windowHighDPI' flag, this size may differ from the size in pixels. Use 'glGetDrawableSize' to get size in pixels.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetWindowSize SDL_SetWindowSize>@ and @<https://wiki.libsdl.org/SDL_GetWindowSize SDL_GetWindowSize>@ for C documentation.
-windowSize :: Window -> StateVar (V2 CInt)
-windowSize (Window win) = makeStateVar getWindowSize setWindowSize
-  where
-  setWindowSize (V2 w h) = Raw.setWindowSize win w h
-
-  getWindowSize =
-    liftIO $
-    alloca $ \wptr ->
-    alloca $ \hptr -> do
-      Raw.getWindowSize win wptr hptr
-      V2 <$> peek wptr <*> peek hptr
-
--- | Get or set the title of the window. If the window has no title, then an empty string is returned.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetWindowTitle SDL_SetWindowTitle>@ and @<https://wiki.libsdl.org/SDL_GetWindowTitle SDL_GetWindowTitle>@ for C documentation.
-windowTitle :: Window -> StateVar Text
-windowTitle (Window w) = makeStateVar getWindowTitle setWindowTitle
-  where
-  setWindowTitle title =
-    liftIO . BS.useAsCString (Text.encodeUtf8 title) $
-      Raw.setWindowTitle w
-
-  getWindowTitle = liftIO $ do
-      cstr <- Raw.getWindowTitle w
-      Text.decodeUtf8 <$> BS.packCString cstr
-
--- | Get or set the pointer to arbitrary user data associated with the given
--- window and name.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
-windowData :: Window -> CString -> StateVar (Ptr ())
-windowData (Window w) key = makeStateVar getWindowData setWindowData
-  where
-  setWindowData = void . Raw.setWindowData w key
-  getWindowData = Raw.getWindowData w key
-
--- | Retrieve the configuration of the given window.
---
--- Note that 'Nothing' will be returned instead of potential OpenGL parameters
--- used during the creation of the window.
-getWindowConfig :: MonadIO m => Window -> m WindowConfig
-getWindowConfig (Window w) = do
-    wFlags <- Raw.getWindowFlags w
-
-    wSize <- get (windowSize (Window w))
-    wPos  <- getWindowAbsolutePosition (Window w)
-
-    return WindowConfig {
-        windowBorder       = wFlags .&. Raw.SDL_WINDOW_BORDERLESS == 0
-      , windowHighDPI      = wFlags .&. Raw.SDL_WINDOW_ALLOW_HIGHDPI > 0
-      , windowInputGrabbed = wFlags .&. Raw.SDL_WINDOW_INPUT_GRABBED > 0
-      , windowMode         = fromNumber wFlags
-        -- Should we store the openGL config that was used to create the window?
-      , windowOpenGL       = Nothing
-      , windowPosition     = Absolute (P wPos)
-      , windowResizable    = wFlags .&. Raw.SDL_WINDOW_RESIZABLE > 0
-      , windowInitialSize  = wSize
-      , windowVisible      = wFlags .&. Raw.SDL_WINDOW_SHOWN > 0
-    }
-
--- | Get the pixel format that is used for the given window.
-getWindowPixelFormat :: MonadIO m => Window -> m PixelFormat
-getWindowPixelFormat (Window w) = return . fromNumber =<< Raw.getWindowPixelFormat w
-
--- | Get the text from the clipboard.
---
--- Throws 'SDLException' on failure.
-getClipboardText :: MonadIO m => m Text
-getClipboardText = liftIO . mask_ $ do
-  cstr <- throwIfNull "SDL.Video.getClipboardText" "SDL_GetClipboardText"
-    Raw.getClipboardText
-  finally (Text.decodeUtf8 <$> BS.packCString cstr) (free cstr)
-
--- | Checks if the clipboard exists, and has some text in it.
-hasClipboardText :: MonadIO m => m Bool
-hasClipboardText = Raw.hasClipboardText
-
--- | Replace the contents of the clipboard with the given text.
---
--- Throws 'SDLException' on failure.
-setClipboardText :: MonadIO m => Text -> m ()
-setClipboardText str = liftIO $ do
-  throwIfNot0_ "SDL.Video.setClipboardText" "SDL_SetClipboardText" $
-    BS.useAsCString (Text.encodeUtf8 str) Raw.setClipboardText
-
--- | Hide a window.
---
--- See @<https://wiki.libsdl.org/SDL_HideWindow SDL_HideWindow>@ for C documentation.
-hideWindow :: MonadIO m => Window -> m ()
-hideWindow (Window w) = Raw.hideWindow w
-
--- | Raise the window above other windows and set the input focus.
---
--- See @<https://wiki.libsdl.org/SDL_RaiseWindow SDL_RaiseWindow>@ for C documentation.
-raiseWindow :: MonadIO m => Window -> m ()
-raiseWindow (Window w) = Raw.raiseWindow w
-
--- | Get or set whether to allow the screen to be blanked by a screen saver.
---
--- Screen savers are re-enabled, if needed, when SDL quits.
-screenSaverEnabled :: StateVar Bool
-screenSaverEnabled = makeStateVar (isScreenSaverEnabled) (setScreenSaverEnabled)
-  where
-  isScreenSaverEnabled = Raw.isScreenSaverEnabled
-
-  setScreenSaverEnabled True = Raw.enableScreenSaver
-  setScreenSaverEnabled False = Raw.disableScreenSaver
-
--- | Show a window.
---
--- See @<https://wiki.libsdl.org/SDL_ShowWindow SDL_ShowWindow>@ for C documentation.
-showWindow :: MonadIO m => Window -> m ()
-showWindow (Window w) = Raw.showWindow w
-
--- | Gets or sets the gamma ramp for the display that owns a given window.
---
--- Note that the data for the gamma ramp - the 'V3' ('SV.Vector' 'Word16') - must contain 256 element arrays. This triple is a set of translation vectors for each of the 16-bit red, green and blue channels.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- Despite the name and signature, this method retrieves the gamma ramp of the entire display, not an individual window. A window is considered to be owned by the display that contains the window's center pixel.
-windowGammaRamp :: Window -> StateVar (V3 (SV.Vector Word16))
-windowGammaRamp (Window w) = makeStateVar getWindowGammaRamp setWindowGammaRamp
-  where
-  getWindowGammaRamp =
-    allocaArray 256 $ \rPtr ->
-    allocaArray 256 $ \gPtr ->
-    allocaArray 256 $ \bPtr -> do
-      throwIfNeg_ "SDL.Video.getWindowGammaRamp" "SDL_GetWindowGammaRamp"
-        (Raw.getWindowGammaRamp w rPtr gPtr bPtr)
-      liftA3 V3 (fmap SV.fromList (peekArray 256 rPtr))
-                (fmap SV.fromList (peekArray 256 gPtr))
-                (fmap SV.fromList (peekArray 256 bPtr))
-
-
-  setWindowGammaRamp (V3 r g b) = liftIO $ do
-    unless (all ((== 256) . SV.length) [r,g,b]) $
-      error "setWindowGammaRamp requires 256 element in each colour channel"
-
-    SV.unsafeWith r $ \rPtr ->
-      SV.unsafeWith b $ \bPtr ->
-        SV.unsafeWith g $ \gPtr ->
-          throwIfNeg_ "SDL.Video.setWindowGammaRamp" "SDL_SetWindowGammaRamp" $
-            Raw.setWindowGammaRamp w rPtr gPtr bPtr
-
-data Display = Display {
-               displayName           :: String
-             , displayBoundsPosition :: Point V2 CInt
-                 -- ^ Position of the desktop area represented by the display,
-                 -- with the primary display located at @(0, 0)@.
-             , displayBoundsSize     :: V2 CInt
-                 -- ^ Size of the desktop area represented by the display.
-             , displayModes          :: [DisplayMode]
-             }
-             deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
-data DisplayMode = DisplayMode {
-                   displayModeFormat      :: PixelFormat
-                 , displayModeSize        :: V2 CInt
-                 , displayModeRefreshRate :: CInt -- ^ Display's refresh rate in hertz, or @0@ if unspecified.
-                 }
-                 deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
-data VideoDriver = VideoDriver {
-                   videoDriverName :: String
-                 }
-                 deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Throws 'SDLException' on failure.
-getDisplays :: MonadIO m => m [Display]
-getDisplays = liftIO $ do
-  numDisplays <- throwIfNeg "SDL.Video.getDisplays" "SDL_GetNumVideoDisplays"
-    Raw.getNumVideoDisplays
-
-  forM [0..numDisplays - 1] $ \displayId -> do
-    name <- throwIfNull "SDL.Video.getDisplays" "SDL_GetDisplayName" $
-        Raw.getDisplayName displayId
-
-    name' <- peekCString name
-
-    Raw.Rect x y w h <- alloca $ \rect -> do
-      throwIfNot0_ "SDL.Video.getDisplays" "SDL_GetDisplayBounds" $
-        Raw.getDisplayBounds displayId rect
-      peek rect
-
-    numModes <- throwIfNeg "SDL.Video.getDisplays" "SDL_GetNumDisplayModes" $
-      Raw.getNumDisplayModes displayId
-
-    modes <- forM [0..numModes - 1] $ \modeId -> do
-      Raw.DisplayMode format w' h' refreshRate _ <- alloca $ \mode -> do
-        throwIfNot0_ "SDL.Video.getDisplays" "SDL_GetDisplayMode" $
-          Raw.getDisplayMode displayId modeId mode
-        peek mode
-
-      return $ DisplayMode {
-          displayModeFormat = fromNumber format
-        , displayModeSize = V2 w' h'
-        , displayModeRefreshRate = refreshRate
-      }
-
-    return $ Display {
-        displayName = name'
-      , displayBoundsPosition = P (V2 x y)
-      , displayBoundsSize = V2 w h
-      , displayModes = modes
-    }
-
--- | Show a simple message box with the given title and a message. Consider
--- writing your messages to @stderr@ too.
---
--- Throws 'SDLException' if there are no available video targets.
-showSimpleMessageBox :: MonadIO m => Maybe Window -> MessageKind -> Text -> Text -> m ()
-showSimpleMessageBox window kind title message =
-  liftIO . throwIfNot0_ "SDL.Video.showSimpleMessageBox" "SDL_ShowSimpleMessageBox" $ do
-    BS.useAsCString (Text.encodeUtf8 title) $ \title' ->
-      BS.useAsCString (Text.encodeUtf8 message) $ \message' ->
-        Raw.showSimpleMessageBox (toNumber kind) title' message' $
-          windowId window
-  where
-    windowId (Just (Window w)) = w
-    windowId Nothing = nullPtr
-
-data MessageKind
-  = Error
-  | Warning
-  | Information
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance ToNumber MessageKind Word32 where
-  toNumber Error = Raw.SDL_MESSAGEBOX_ERROR
-  toNumber Warning = Raw.SDL_MESSAGEBOX_WARNING
-  toNumber Information = Raw.SDL_MESSAGEBOX_INFORMATION
-
--- | Get or set the maximum size of a window's client area.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetWindowMaximumSize SDL_SetWindowMaximumSize>@ and @<https://wiki.libsdl.org/SDL_GetWindowMaximumSize SDL_GetWindowMaximumSize>@ for C documentation.
-windowMaximumSize :: Window -> StateVar (V2 CInt)
-windowMaximumSize (Window win) = makeStateVar getWindowMaximumSize setWindowMaximumSize
-  where
-  setWindowMaximumSize (V2 w h) = Raw.setWindowMaximumSize win w h
-
-  getWindowMaximumSize =
-    liftIO $
-    alloca $ \wptr ->
-    alloca $ \hptr -> do
-      Raw.getWindowMaximumSize win wptr hptr
-      V2 <$> peek wptr <*> peek hptr
-
--- | Get or set the minimum size of a window's client area.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetWindowMinimumSize SDL_SetWindowMinimumSize>@ and @<https://wiki.libsdl.org/SDL_GetWindowMinimumSize SDL_GetWindowMinimumSize>@ for C documentation.
-windowMinimumSize :: Window -> StateVar (V2 CInt)
-windowMinimumSize (Window win) = makeStateVar getWindowMinimumSize setWindowMinimumSize
-  where
-  setWindowMinimumSize (V2 w h) = Raw.setWindowMinimumSize win w h
-
-  getWindowMinimumSize =
-    liftIO $
-    alloca $ \wptr ->
-    alloca $ \hptr -> do
-      Raw.getWindowMinimumSize win wptr hptr
-      V2 <$> peek wptr <*> peek hptr
-
-createRenderer :: MonadIO m => Window -> CInt -> RendererConfig -> m Renderer
-createRenderer (Window w) driver config =
-  liftIO . fmap Renderer $
-    throwIfNull "SDL.Video.createRenderer" "SDL_CreateRenderer" $
-    Raw.createRenderer w driver (toNumber config)
-
--- | Create a 2D software rendering context for the given surface.
---
--- See @<https://wiki.libsdl.org/SDL_CreateSoftwareRenderer>@
-createSoftwareRenderer :: MonadIO m => Surface -> m Renderer
-createSoftwareRenderer (Surface ptr _) =
-  liftIO . fmap Renderer $
-    throwIfNull "SDL.Video.createSoftwareRenderer" "SDL_CreateSoftwareRenderer" $
-    Raw.createSoftwareRenderer ptr
-
-destroyRenderer :: MonadIO m => Renderer -> m ()
-destroyRenderer (Renderer r) = Raw.destroyRenderer r
+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}+module SDL.Video+  ( module SDL.Video.OpenGL+  , module SDL.Video.Renderer++  -- * Window Management+  , Window+  , createWindow+  , defaultWindow+  , WindowConfig(..)+  , WindowMode(..)+  , WindowPosition(..)+  , destroyWindow++  -- * Window Actions+  , hideWindow+  , raiseWindow+  , showWindow++  -- * Window Attributes+  , windowMinimumSize+  , windowMaximumSize+  , windowSize+  , windowBordered+  , windowBrightness+  , windowGammaRamp+  , windowGrab+  , setWindowMode+  , getWindowAbsolutePosition+  , setWindowPosition+  , windowTitle+  , windowData+  , getWindowConfig+  , getWindowPixelFormat+  , PixelFormat(..)++  -- * Renderer Management+  , createRenderer+  , createSoftwareRenderer+  , destroyRenderer++  -- * Clipboard Handling+  , getClipboardText+  , hasClipboardText+  , setClipboardText++  -- * Display+  , getDisplays+  , Display(..)+  , DisplayMode(..)+  , VideoDriver(..)++  -- * Screen Savers+  -- | Screen savers should be disabled when the sudden enablement of the+  -- monitor's power saving features would be inconvenient for when the user+  -- hasn't provided any input for some period of time, such as during video+  -- playback.+  --+  -- Screen savers are disabled by default upon the initialization of the+  -- video subsystem.+  , screenSaverEnabled++  -- * Message Box+  , showSimpleMessageBox+  , MessageKind(..)+  ) where++import Prelude hiding (all, foldl, foldr, mapM_)++import Data.StateVar+import Control.Applicative+import Control.Exception+import Control.Monad (forM, unless, void)+import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Bits+import Data.Data (Data)+import Data.Foldable+import Data.Maybe (isJust, fromMaybe)+import Data.Monoid (First(..))+import Data.Text (Text)+import Data.Typeable+import Foreign hiding (void, throwIfNull, throwIfNeg, throwIfNeg_)+import Foreign.C+import GHC.Generics (Generic)+import SDL.Vect+import SDL.Internal.Exception+import SDL.Internal.Numbered+import SDL.Internal.Types+import SDL.Video.OpenGL+import SDL.Video.Renderer++import qualified Data.ByteString as BS+import qualified Data.Text.Encoding as Text+import qualified Data.Vector.Storable as SV+import qualified SDL.Raw as Raw++-- | Create a window with the given title and configuration.+--+-- Throws 'SDLException' on failure.+createWindow :: MonadIO m => Text -> WindowConfig -> m Window+createWindow title config = liftIO $ do+  case windowOpenGL config of+    Just glcfg -> setGLAttributes glcfg+    Nothing    -> return ()++  BS.useAsCString (Text.encodeUtf8 title) $ \title' -> do+    let create = Raw.createWindow title'+    let create' (V2 w h) = case windowPosition config of+          Centered -> let u = Raw.SDL_WINDOWPOS_CENTERED in create u u w h+          Wherever -> let u = Raw.SDL_WINDOWPOS_UNDEFINED in create u u w h+          Absolute (P (V2 x y)) -> create x y w h+    create' (windowInitialSize config) flags >>= return . Window+  where+    flags = foldr (.|.) 0+      [ if windowBorder config then 0 else Raw.SDL_WINDOW_BORDERLESS+      , if windowHighDPI config then Raw.SDL_WINDOW_ALLOW_HIGHDPI else 0+      , if windowInputGrabbed config then Raw.SDL_WINDOW_INPUT_GRABBED else 0+      , toNumber $ windowMode config+      , if isJust $ windowOpenGL config then Raw.SDL_WINDOW_OPENGL else 0+      , if windowResizable config then Raw.SDL_WINDOW_RESIZABLE else 0+      , if windowVisible config then 0 else Raw.SDL_WINDOW_HIDDEN+      ]+    setGLAttributes (OpenGLConfig (V4 r g b a) d s ms p) = do+      let (msk, v0, v1, flg) = case p of+            Core Debug v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_CORE, v0', v1', Raw.SDL_GL_CONTEXT_DEBUG_FLAG)+            Core Normal v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_CORE, v0', v1', 0)+            Compatibility Debug v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY, v0', v1', Raw.SDL_GL_CONTEXT_DEBUG_FLAG)+            Compatibility Normal v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY, v0', v1', 0)+            ES Debug v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_ES, v0', v1', Raw.SDL_GL_CONTEXT_DEBUG_FLAG)+            ES Normal v0' v1' -> (Raw.SDL_GL_CONTEXT_PROFILE_ES, v0', v1', 0)+      mapM_ (throwIfNeg_ "SDL.Video.createWindow" "SDL_GL_SetAttribute" . uncurry Raw.glSetAttribute) $+        [ (Raw.SDL_GL_RED_SIZE, r)+        , (Raw.SDL_GL_GREEN_SIZE, g)+        , (Raw.SDL_GL_BLUE_SIZE, b)+        , (Raw.SDL_GL_ALPHA_SIZE, a)+        , (Raw.SDL_GL_DEPTH_SIZE, d)+        , (Raw.SDL_GL_STENCIL_SIZE, s)+        , (Raw.SDL_GL_MULTISAMPLEBUFFERS, if ms > 1 then 1 else 0)+        , (Raw.SDL_GL_MULTISAMPLESAMPLES, if ms > 1 then ms else 0)+        , (Raw.SDL_GL_CONTEXT_PROFILE_MASK, msk)+        , (Raw.SDL_GL_CONTEXT_MAJOR_VERSION, v0)+        , (Raw.SDL_GL_CONTEXT_MINOR_VERSION, v1)+        , (Raw.SDL_GL_CONTEXT_FLAGS, flg)+        ]++-- | Default configuration for windows. Use the record update syntax to+-- override any of the defaults.+--+-- @+-- 'defaultWindow' = 'WindowConfig'+--   { 'windowBorder'       = True+--   , 'windowHighDPI'      = False+--   , 'windowInputGrabbed' = False+--   , 'windowMode'         = 'Windowed'+--   , 'windowOpenGL'       = Nothing+--   , 'windowPosition'     = 'Wherever'+--   , 'windowResizable'    = False+--   , 'windowInitialSize'  = V2 800 600+--   , 'windowVisible'      = True+--   }+-- @+defaultWindow :: WindowConfig+defaultWindow = WindowConfig+  { windowBorder       = True+  , windowHighDPI      = False+  , windowInputGrabbed = False+  , windowMode         = Windowed+  , windowOpenGL       = Nothing+  , windowPosition     = Wherever+  , windowResizable    = False+  , windowInitialSize  = V2 800 600+  , windowVisible      = True+  }++data WindowConfig = WindowConfig+  { windowBorder       :: Bool               -- ^ Defaults to 'True'.+  , windowHighDPI      :: Bool               -- ^ Defaults to 'False'. Can not be changed after window creation.+  , windowInputGrabbed :: Bool               -- ^ Defaults to 'False'. Whether the mouse shall be confined to the window.+  , windowMode         :: WindowMode         -- ^ Defaults to 'Windowed'.+  , windowOpenGL       :: Maybe OpenGLConfig -- ^ Defaults to 'Nothing'. Can not be changed after window creation.+  , windowPosition     :: WindowPosition     -- ^ Defaults to 'Wherever'.+  , windowResizable    :: Bool               -- ^ Defaults to 'False'. Whether the window can be resized by the user. It is still possible to programatically change the size by changing 'windowSize'.+  , windowInitialSize  :: V2 CInt            -- ^ Defaults to @(800, 600)@. If you set 'windowHighDPI' flag, window size in screen coordinates may differ from the size in pixels. Use 'glGetDrawableSize' to get size in pixels.+  , windowVisible      :: Bool               -- ^ Defaults to 'True'.+  } deriving (Eq, Generic, Ord, Read, Show, Typeable)++data WindowMode+  = Fullscreen        -- ^ Real fullscreen with a video mode change+  | FullscreenDesktop -- ^ Fake fullscreen that takes the size of the desktop+  | Maximized+  | Minimized+  | Windowed+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance ToNumber WindowMode Word32 where+  toNumber Fullscreen = Raw.SDL_WINDOW_FULLSCREEN+  toNumber FullscreenDesktop = Raw.SDL_WINDOW_FULLSCREEN_DESKTOP+  toNumber Maximized = Raw.SDL_WINDOW_MAXIMIZED+  toNumber Minimized = Raw.SDL_WINDOW_MINIMIZED+  toNumber Windowed = 0++instance FromNumber WindowMode Word32 where+  fromNumber n = fromMaybe Windowed . getFirst $+    foldMap First [+        sdlWindowFullscreen+      , sdlWindowFullscreenDesktop+      , sdlWindowMaximized+      , sdlWindowMinimized+      ]+    where+      maybeBit val msk = if n .&. msk > 0 then Just val else Nothing+      sdlWindowFullscreen        = maybeBit Fullscreen Raw.SDL_WINDOW_FULLSCREEN+      sdlWindowFullscreenDesktop = maybeBit FullscreenDesktop Raw.SDL_WINDOW_FULLSCREEN_DESKTOP+      sdlWindowMaximized         = maybeBit Maximized Raw.SDL_WINDOW_MAXIMIZED+      sdlWindowMinimized         = maybeBit Minimized Raw.SDL_WINDOW_MINIMIZED++data WindowPosition+  = Centered+  | Wherever -- ^ Let the window mananger decide where it's best to place the window.+  | Absolute (Point V2 CInt)+  deriving (Eq, Generic, Ord, Read, Show, Typeable)++-- | Destroy the given window. The 'Window' handler may not be used+-- afterwards.+destroyWindow :: MonadIO m => Window -> m ()+destroyWindow (Window w) = Raw.destroyWindow w++-- | Get or set if the window should have a border.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+windowBordered :: Window -> StateVar Bool+windowBordered (Window w) = makeStateVar getWindowBordered setWindowBordered+  where+  getWindowBordered = fmap ((== 0) . (.&. Raw.SDL_WINDOW_BORDERLESS)) (Raw.getWindowFlags w)+  setWindowBordered = Raw.setWindowBordered w++-- | Get or set the window's brightness, where 0.0 is completely dark and 1.0 is normal brightness.+--+-- Throws 'SDLException' if the hardware does not support gamma+-- correction, or if the system has run out of memory.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+windowBrightness :: Window -> StateVar Float+windowBrightness (Window w) = makeStateVar getWindowBrightness setWindowBrightness+  where+  setWindowBrightness brightness = do+    throwIfNot0_ "SDL.Video.setWindowBrightness" "SDL_SetWindowBrightness" $+      Raw.setWindowBrightness w $ realToFrac brightness++  getWindowBrightness =+      return . realToFrac =<< Raw.getWindowBrightness w++-- | Get or set whether the mouse shall be confined to the window.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+windowGrab :: Window -> StateVar Bool+windowGrab (Window w) = makeStateVar getWindowGrab setWindowGrab+  where+  setWindowGrab = Raw.setWindowGrab w+  getWindowGrab = Raw.getWindowGrab w++-- | Change between window modes.+--+-- Throws 'SDLException' on failure.+setWindowMode :: MonadIO m => Window -> WindowMode -> m ()+setWindowMode (Window w) mode =+  liftIO . throwIfNot0_ "SDL.Video.setWindowMode" "SDL_SetWindowFullscreen" $+    case mode of+      Fullscreen -> Raw.setWindowFullscreen w Raw.SDL_WINDOW_FULLSCREEN <* Raw.raiseWindow w+      FullscreenDesktop -> Raw.setWindowFullscreen w Raw.SDL_WINDOW_FULLSCREEN_DESKTOP <* Raw.raiseWindow w+      Maximized -> Raw.setWindowFullscreen w 0 <* Raw.maximizeWindow w+      Minimized -> Raw.minimizeWindow w >> return 0+      Windowed -> Raw.setWindowFullscreen w 0 <* Raw.restoreWindow w++-- | Set the position of the window.+setWindowPosition :: MonadIO m => Window -> WindowPosition -> m ()+setWindowPosition (Window w) pos = case pos of+  Centered -> let u = Raw.SDL_WINDOWPOS_CENTERED in Raw.setWindowPosition w u u+  Wherever -> let u = Raw.SDL_WINDOWPOS_UNDEFINED in Raw.setWindowPosition w u u+  Absolute (P (V2 x y)) -> Raw.setWindowPosition w x y++-- | Get the position of the window.+getWindowAbsolutePosition :: MonadIO m => Window -> m (V2 CInt)+getWindowAbsolutePosition (Window w) =+    liftIO $+    alloca $ \wPtr ->+    alloca $ \hPtr -> do+        Raw.getWindowPosition w wPtr hPtr+        V2 <$> peek wPtr <*> peek hPtr++-- | Get or set the size of a window's client area. Values beyond the maximum supported size are clamped.+--+-- If window was created with 'windowHighDPI' flag, this size may differ from the size in pixels. Use 'glGetDrawableSize' to get size in pixels.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetWindowSize SDL_SetWindowSize>@ and @<https://wiki.libsdl.org/SDL_GetWindowSize SDL_GetWindowSize>@ for C documentation.+windowSize :: Window -> StateVar (V2 CInt)+windowSize (Window win) = makeStateVar getWindowSize setWindowSize+  where+  setWindowSize (V2 w h) = Raw.setWindowSize win w h++  getWindowSize =+    liftIO $+    alloca $ \wptr ->+    alloca $ \hptr -> do+      Raw.getWindowSize win wptr hptr+      V2 <$> peek wptr <*> peek hptr++-- | Get or set the title of the window. If the window has no title, then an empty string is returned.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetWindowTitle SDL_SetWindowTitle>@ and @<https://wiki.libsdl.org/SDL_GetWindowTitle SDL_GetWindowTitle>@ for C documentation.+windowTitle :: Window -> StateVar Text+windowTitle (Window w) = makeStateVar getWindowTitle setWindowTitle+  where+  setWindowTitle title =+    liftIO . BS.useAsCString (Text.encodeUtf8 title) $+      Raw.setWindowTitle w++  getWindowTitle = liftIO $ do+      cstr <- Raw.getWindowTitle w+      Text.decodeUtf8 <$> BS.packCString cstr++-- | Get or set the pointer to arbitrary user data associated with the given+-- window and name.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+windowData :: Window -> CString -> StateVar (Ptr ())+windowData (Window w) key = makeStateVar getWindowData setWindowData+  where+  setWindowData = void . Raw.setWindowData w key+  getWindowData = Raw.getWindowData w key++-- | Retrieve the configuration of the given window.+--+-- Note that 'Nothing' will be returned instead of potential OpenGL parameters+-- used during the creation of the window.+getWindowConfig :: MonadIO m => Window -> m WindowConfig+getWindowConfig (Window w) = do+    wFlags <- Raw.getWindowFlags w++    wSize <- get (windowSize (Window w))+    wPos  <- getWindowAbsolutePosition (Window w)++    return WindowConfig {+        windowBorder       = wFlags .&. Raw.SDL_WINDOW_BORDERLESS == 0+      , windowHighDPI      = wFlags .&. Raw.SDL_WINDOW_ALLOW_HIGHDPI > 0+      , windowInputGrabbed = wFlags .&. Raw.SDL_WINDOW_INPUT_GRABBED > 0+      , windowMode         = fromNumber wFlags+        -- Should we store the openGL config that was used to create the window?+      , windowOpenGL       = Nothing+      , windowPosition     = Absolute (P wPos)+      , windowResizable    = wFlags .&. Raw.SDL_WINDOW_RESIZABLE > 0+      , windowInitialSize  = wSize+      , windowVisible      = wFlags .&. Raw.SDL_WINDOW_SHOWN > 0+    }++-- | Get the pixel format that is used for the given window.+getWindowPixelFormat :: MonadIO m => Window -> m PixelFormat+getWindowPixelFormat (Window w) = return . fromNumber =<< Raw.getWindowPixelFormat w++-- | Get the text from the clipboard.+--+-- Throws 'SDLException' on failure.+getClipboardText :: MonadIO m => m Text+getClipboardText = liftIO . mask_ $ do+  cstr <- throwIfNull "SDL.Video.getClipboardText" "SDL_GetClipboardText"+    Raw.getClipboardText+  finally (Text.decodeUtf8 <$> BS.packCString cstr) (free cstr)++-- | Checks if the clipboard exists, and has some text in it.+hasClipboardText :: MonadIO m => m Bool+hasClipboardText = Raw.hasClipboardText++-- | Replace the contents of the clipboard with the given text.+--+-- Throws 'SDLException' on failure.+setClipboardText :: MonadIO m => Text -> m ()+setClipboardText str = liftIO $ do+  throwIfNot0_ "SDL.Video.setClipboardText" "SDL_SetClipboardText" $+    BS.useAsCString (Text.encodeUtf8 str) Raw.setClipboardText++-- | Hide a window.+--+-- See @<https://wiki.libsdl.org/SDL_HideWindow SDL_HideWindow>@ for C documentation.+hideWindow :: MonadIO m => Window -> m ()+hideWindow (Window w) = Raw.hideWindow w++-- | Raise the window above other windows and set the input focus.+--+-- See @<https://wiki.libsdl.org/SDL_RaiseWindow SDL_RaiseWindow>@ for C documentation.+raiseWindow :: MonadIO m => Window -> m ()+raiseWindow (Window w) = Raw.raiseWindow w++-- | Get or set whether to allow the screen to be blanked by a screen saver.+--+-- Screen savers are re-enabled, if needed, when SDL quits.+screenSaverEnabled :: StateVar Bool+screenSaverEnabled = makeStateVar (isScreenSaverEnabled) (setScreenSaverEnabled)+  where+  isScreenSaverEnabled = Raw.isScreenSaverEnabled++  setScreenSaverEnabled True = Raw.enableScreenSaver+  setScreenSaverEnabled False = Raw.disableScreenSaver++-- | Show a window.+--+-- See @<https://wiki.libsdl.org/SDL_ShowWindow SDL_ShowWindow>@ for C documentation.+showWindow :: MonadIO m => Window -> m ()+showWindow (Window w) = Raw.showWindow w++-- | Gets or sets the gamma ramp for the display that owns a given window.+--+-- Note that the data for the gamma ramp - the 'V3' ('SV.Vector' 'Word16') - must contain 256 element arrays. This triple is a set of translation vectors for each of the 16-bit red, green and blue channels.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- Despite the name and signature, this method retrieves the gamma ramp of the entire display, not an individual window. A window is considered to be owned by the display that contains the window's center pixel.+windowGammaRamp :: Window -> StateVar (V3 (SV.Vector Word16))+windowGammaRamp (Window w) = makeStateVar getWindowGammaRamp setWindowGammaRamp+  where+  getWindowGammaRamp =+    allocaArray 256 $ \rPtr ->+    allocaArray 256 $ \gPtr ->+    allocaArray 256 $ \bPtr -> do+      throwIfNeg_ "SDL.Video.getWindowGammaRamp" "SDL_GetWindowGammaRamp"+        (Raw.getWindowGammaRamp w rPtr gPtr bPtr)+      liftA3 V3 (fmap SV.fromList (peekArray 256 rPtr))+                (fmap SV.fromList (peekArray 256 gPtr))+                (fmap SV.fromList (peekArray 256 bPtr))+++  setWindowGammaRamp (V3 r g b) = liftIO $ do+    unless (all ((== 256) . SV.length) [r,g,b]) $+      error "setWindowGammaRamp requires 256 element in each colour channel"++    SV.unsafeWith r $ \rPtr ->+      SV.unsafeWith b $ \bPtr ->+        SV.unsafeWith g $ \gPtr ->+          throwIfNeg_ "SDL.Video.setWindowGammaRamp" "SDL_SetWindowGammaRamp" $+            Raw.setWindowGammaRamp w rPtr gPtr bPtr++data Display = Display {+               displayName           :: String+             , displayBoundsPosition :: Point V2 CInt+                 -- ^ Position of the desktop area represented by the display,+                 -- with the primary display located at @(0, 0)@.+             , displayBoundsSize     :: V2 CInt+                 -- ^ Size of the desktop area represented by the display.+             , displayModes          :: [DisplayMode]+             }+             deriving (Eq, Generic, Ord, Read, Show, Typeable)++data DisplayMode = DisplayMode {+                   displayModeFormat      :: PixelFormat+                 , displayModeSize        :: V2 CInt+                 , displayModeRefreshRate :: CInt -- ^ Display's refresh rate in hertz, or @0@ if unspecified.+                 }+                 deriving (Eq, Generic, Ord, Read, Show, Typeable)++data VideoDriver = VideoDriver {+                   videoDriverName :: String+                 }+                 deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++-- | Throws 'SDLException' on failure.+getDisplays :: MonadIO m => m [Display]+getDisplays = liftIO $ do+  numDisplays <- throwIfNeg "SDL.Video.getDisplays" "SDL_GetNumVideoDisplays"+    Raw.getNumVideoDisplays++  forM [0..numDisplays - 1] $ \displayId -> do+    name <- throwIfNull "SDL.Video.getDisplays" "SDL_GetDisplayName" $+        Raw.getDisplayName displayId++    name' <- peekCString name++    Raw.Rect x y w h <- alloca $ \rect -> do+      throwIfNot0_ "SDL.Video.getDisplays" "SDL_GetDisplayBounds" $+        Raw.getDisplayBounds displayId rect+      peek rect++    numModes <- throwIfNeg "SDL.Video.getDisplays" "SDL_GetNumDisplayModes" $+      Raw.getNumDisplayModes displayId++    modes <- forM [0..numModes - 1] $ \modeId -> do+      Raw.DisplayMode format w' h' refreshRate _ <- alloca $ \mode -> do+        throwIfNot0_ "SDL.Video.getDisplays" "SDL_GetDisplayMode" $+          Raw.getDisplayMode displayId modeId mode+        peek mode++      return $ DisplayMode {+          displayModeFormat = fromNumber format+        , displayModeSize = V2 w' h'+        , displayModeRefreshRate = refreshRate+      }++    return $ Display {+        displayName = name'+      , displayBoundsPosition = P (V2 x y)+      , displayBoundsSize = V2 w h+      , displayModes = modes+    }++-- | Show a simple message box with the given title and a message. Consider+-- writing your messages to @stderr@ too.+--+-- Throws 'SDLException' if there are no available video targets.+showSimpleMessageBox :: MonadIO m => Maybe Window -> MessageKind -> Text -> Text -> m ()+showSimpleMessageBox window kind title message =+  liftIO . throwIfNot0_ "SDL.Video.showSimpleMessageBox" "SDL_ShowSimpleMessageBox" $ do+    BS.useAsCString (Text.encodeUtf8 title) $ \title' ->+      BS.useAsCString (Text.encodeUtf8 message) $ \message' ->+        Raw.showSimpleMessageBox (toNumber kind) title' message' $+          windowId window+  where+    windowId (Just (Window w)) = w+    windowId Nothing = nullPtr++data MessageKind+  = Error+  | Warning+  | Information+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance ToNumber MessageKind Word32 where+  toNumber Error = Raw.SDL_MESSAGEBOX_ERROR+  toNumber Warning = Raw.SDL_MESSAGEBOX_WARNING+  toNumber Information = Raw.SDL_MESSAGEBOX_INFORMATION++-- | Get or set the maximum size of a window's client area.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetWindowMaximumSize SDL_SetWindowMaximumSize>@ and @<https://wiki.libsdl.org/SDL_GetWindowMaximumSize SDL_GetWindowMaximumSize>@ for C documentation.+windowMaximumSize :: Window -> StateVar (V2 CInt)+windowMaximumSize (Window win) = makeStateVar getWindowMaximumSize setWindowMaximumSize+  where+  setWindowMaximumSize (V2 w h) = Raw.setWindowMaximumSize win w h++  getWindowMaximumSize =+    liftIO $+    alloca $ \wptr ->+    alloca $ \hptr -> do+      Raw.getWindowMaximumSize win wptr hptr+      V2 <$> peek wptr <*> peek hptr++-- | Get or set the minimum size of a window's client area.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetWindowMinimumSize SDL_SetWindowMinimumSize>@ and @<https://wiki.libsdl.org/SDL_GetWindowMinimumSize SDL_GetWindowMinimumSize>@ for C documentation.+windowMinimumSize :: Window -> StateVar (V2 CInt)+windowMinimumSize (Window win) = makeStateVar getWindowMinimumSize setWindowMinimumSize+  where+  setWindowMinimumSize (V2 w h) = Raw.setWindowMinimumSize win w h++  getWindowMinimumSize =+    liftIO $+    alloca $ \wptr ->+    alloca $ \hptr -> do+      Raw.getWindowMinimumSize win wptr hptr+      V2 <$> peek wptr <*> peek hptr++createRenderer :: MonadIO m => Window -> CInt -> RendererConfig -> m Renderer+createRenderer (Window w) driver config =+  liftIO . fmap Renderer $+    throwIfNull "SDL.Video.createRenderer" "SDL_CreateRenderer" $+    Raw.createRenderer w driver (toNumber config)++-- | Create a 2D software rendering context for the given surface.+--+-- See @<https://wiki.libsdl.org/SDL_CreateSoftwareRenderer>@+createSoftwareRenderer :: MonadIO m => Surface -> m Renderer+createSoftwareRenderer (Surface ptr _) =+  liftIO . fmap Renderer $+    throwIfNull "SDL.Video.createSoftwareRenderer" "SDL_CreateSoftwareRenderer" $+    Raw.createSoftwareRenderer ptr++destroyRenderer :: MonadIO m => Renderer -> m ()+destroyRenderer (Renderer r) = Raw.destroyRenderer r
src/SDL/Video/OpenGL.hs view
@@ -1,190 +1,190 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-
-module SDL.Video.OpenGL
-  ( -- * Creating and Configuring OpenGL Contexts
-    defaultOpenGL
-  , OpenGLConfig(..)
-  , GLContext
-  , glCreateContext
-  , Profile(..)
-  , Mode(..)
-  , glMakeCurrent
-  , glDeleteContext
-
-  -- * Querying for the drawable size without a Renderer
-  , glGetDrawableSize
-
-  -- * Swapping
-  -- | The process of \"swapping\" means to move the back-buffer into the window contents itself.
-  , glSwapWindow
-  , SwapInterval(..)
-  , swapInterval
-
-  -- * Function Loading
-  , Raw.glGetProcAddress
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Data (Data)
-import Data.StateVar
-import Data.Typeable
-import Foreign hiding (void, throwIfNull, throwIfNeg, throwIfNeg_)
-import Foreign.C.Types
-import GHC.Generics (Generic)
-import SDL.Vect
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import SDL.Internal.Types
-import qualified SDL.Raw as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-#endif
-
--- | A set of default options for 'OpenGLConfig'
---
--- @
--- 'defaultOpenGL' = 'OpenGLConfig'
---   { 'glColorPrecision' = V4 8 8 8 0
---   , 'glDepthPrecision' = 24
---   , 'glStencilPrecision' = 8
---   , 'glMultisampleSamples' = 1
---   , 'glProfile' = 'Compatibility' 'Normal' 2 1
---   }
--- @
-defaultOpenGL :: OpenGLConfig
-defaultOpenGL = OpenGLConfig
-  { glColorPrecision = V4 8 8 8 0
-  , glDepthPrecision = 24
-  , glStencilPrecision = 8
-  , glMultisampleSamples = 1
-  , glProfile = Compatibility Normal 2 1
-  }
-
--- | Configuration used when creating an OpenGL rendering context.
-data OpenGLConfig = OpenGLConfig
-  { glColorPrecision     :: V4 CInt -- ^ Defaults to 'V4' @8 8 8 0@.
-  , glDepthPrecision     :: CInt    -- ^ Defaults to @24@.
-  , glStencilPrecision   :: CInt    -- ^ Defaults to @8@.
-  , glMultisampleSamples :: CInt    -- ^ Defaults to @1@.
-  , glProfile            :: Profile -- ^ Defaults to 'Compatibility' 'Normal' @2 1@.
-  } deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
--- | The profile a driver should use when creating an OpenGL context.
-data Profile
-  = Core Mode CInt CInt
-    -- ^ Use the OpenGL core profile, with a given major and minor version
-  | Compatibility Mode CInt CInt
-    -- ^ Use the compatibilty profile with a given major and minor version. The compatibility profile allows you to use deprecated functions such as immediate mode
-  | ES Mode CInt CInt
-    -- ^ Use an OpenGL profile for embedded systems
-  deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
--- | The mode a driver should use when creating an OpenGL context.
-data Mode
-  = Normal
-    -- ^ A normal profile with no special debugging support
-  | Debug
-    -- ^ Use a debug context, allowing the usage of extensions such as @GL_ARB_debug_output@
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | A created OpenGL context.
-newtype GLContext = GLContext Raw.GLContext
-  deriving (Eq, Typeable)
-
--- | Create a new OpenGL context and makes it the current context for the
--- window.
---
--- Throws 'SDLException' if the window wasn't configured with OpenGL
--- support, or if context creation fails.
---
--- See @<https://wiki.libsdl.org/SDL_GL_CreateContext SDL_GL_CreateContext>@ for C documentation.
-glCreateContext :: (Functor m, MonadIO m) => Window -> m GLContext
-glCreateContext (Window w) =
-  GLContext <$> throwIfNull "SDL.Video.glCreateContext" "SDL_GL_CreateContext"
-    (Raw.glCreateContext w)
-
--- | Set up an OpenGL context for rendering into an OpenGL window.
---
--- Throws 'SDLException' on failure.
---
--- See @<https://wiki.libsdl.org/SDL_GL_MakeCurrent SDL_GL_MakeCurrent>@ for C documentation.
-glMakeCurrent :: (Functor m, MonadIO m) => Window -> GLContext -> m ()
-glMakeCurrent (Window w) (GLContext ctx) =
-  throwIfNeg_ "SDL.Video.OpenGL.glMakeCurrent" "SDL_GL_MakeCurrent" $
-    Raw.glMakeCurrent w ctx
-
--- | Delete the given OpenGL context.
---
--- You /must/ make sure that there are no pending commands in the OpenGL
--- command queue, the driver may still be processing commands even if you have
--- stopped issuing them!
---
--- The @glFinish@ command will block until the command queue has been fully
--- processed. You should call that function before deleting a context.
---
--- See @<https://wiki.libsdl.org/SDL_GL_DeleteContext SDL_GL_DeleteContext>@ for C documentation.
-glDeleteContext :: MonadIO m => GLContext -> m ()
-glDeleteContext (GLContext ctx) = Raw.glDeleteContext ctx
-
--- | Replace the contents of the front buffer with the back buffer's. The
--- contents of the back buffer are undefined, clear them with @glClear@ or
--- equivalent before drawing to them again.
---
--- See @<https://wiki.libsdl.org/SDL_GL_SwapWindow SDL_GL_SwapWindow>@ for C documentation.
-glSwapWindow :: MonadIO m => Window -> m ()
-glSwapWindow (Window w) = Raw.glSwapWindow w
-
--- | The swap interval for the current OpenGL context.
-data SwapInterval
-  = ImmediateUpdates
-    -- ^ No vertical retrace synchronization
-  | SynchronizedUpdates
-    -- ^ The buffer swap is synchronized with the vertical retrace
-  | LateSwapTearing
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance ToNumber SwapInterval CInt where
-  toNumber ImmediateUpdates = 0
-  toNumber SynchronizedUpdates = 1
-  toNumber LateSwapTearing = -1
-
-instance FromNumber SwapInterval CInt where
-  fromNumber n' =
-    case n' of
-      0 -> ImmediateUpdates
-      1 -> SynchronizedUpdates
-      -1 -> LateSwapTearing
-      _ ->
-        error ("Unknown SwapInterval: " ++ show n')
-
--- | Get or set the swap interval for the current OpenGL context.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_GL_SetSwapInterval SDL_GL_SetSwapInterval>@ and @<https://wiki.libsdl.org/SDL_GL_GetSwapInterval SDL_GL_GetSwapInterval>@ for C documentation.
-swapInterval :: StateVar SwapInterval
-swapInterval = makeStateVar glGetSwapInterval glSetSwapInterval
-  where
-  glGetSwapInterval = fmap fromNumber $ Raw.glGetSwapInterval
-
-  glSetSwapInterval i =
-    throwIfNeg_ "SDL.Video.glSetSwapInterval" "SDL_GL_SetSwapInterval" $
-      Raw.glSetSwapInterval (toNumber i)
-
--- | Get the size of a window's underlying drawable area in pixels (for use
--- with glViewport).
---
--- It may differ from 'SDL.Video.windowSize' if window was created with 'SDL.Video.windowHighDPI' flag.
-glGetDrawableSize :: MonadIO m => Window -> m (V2 CInt)
-glGetDrawableSize (Window w) =
-    liftIO $
-    alloca $ \wptr ->
-    alloca $ \hptr -> do
-        Raw.glGetDrawableSize w wptr hptr
-        V2 <$> peek wptr <*> peek hptr
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}++module SDL.Video.OpenGL+  ( -- * Creating and Configuring OpenGL Contexts+    defaultOpenGL+  , OpenGLConfig(..)+  , GLContext+  , glCreateContext+  , Profile(..)+  , Mode(..)+  , glMakeCurrent+  , glDeleteContext++  -- * Querying for the drawable size without a Renderer+  , glGetDrawableSize++  -- * Swapping+  -- | The process of \"swapping\" means to move the back-buffer into the window contents itself.+  , glSwapWindow+  , SwapInterval(..)+  , swapInterval++  -- * Function Loading+  , Raw.glGetProcAddress+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Data (Data)+import Data.StateVar+import Data.Typeable+import Foreign hiding (void, throwIfNull, throwIfNeg, throwIfNeg_)+import Foreign.C.Types+import GHC.Generics (Generic)+import SDL.Vect+import SDL.Internal.Exception+import SDL.Internal.Numbered+import SDL.Internal.Types+import qualified SDL.Raw as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+#endif++-- | A set of default options for 'OpenGLConfig'+--+-- @+-- 'defaultOpenGL' = 'OpenGLConfig'+--   { 'glColorPrecision' = V4 8 8 8 0+--   , 'glDepthPrecision' = 24+--   , 'glStencilPrecision' = 8+--   , 'glMultisampleSamples' = 1+--   , 'glProfile' = 'Compatibility' 'Normal' 2 1+--   }+-- @+defaultOpenGL :: OpenGLConfig+defaultOpenGL = OpenGLConfig+  { glColorPrecision = V4 8 8 8 0+  , glDepthPrecision = 24+  , glStencilPrecision = 8+  , glMultisampleSamples = 1+  , glProfile = Compatibility Normal 2 1+  }++-- | Configuration used when creating an OpenGL rendering context.+data OpenGLConfig = OpenGLConfig+  { glColorPrecision     :: V4 CInt -- ^ Defaults to 'V4' @8 8 8 0@.+  , glDepthPrecision     :: CInt    -- ^ Defaults to @24@.+  , glStencilPrecision   :: CInt    -- ^ Defaults to @8@.+  , glMultisampleSamples :: CInt    -- ^ Defaults to @1@.+  , glProfile            :: Profile -- ^ Defaults to 'Compatibility' 'Normal' @2 1@.+  } deriving (Eq, Generic, Ord, Read, Show, Typeable)++-- | The profile a driver should use when creating an OpenGL context.+data Profile+  = Core Mode CInt CInt+    -- ^ Use the OpenGL core profile, with a given major and minor version+  | Compatibility Mode CInt CInt+    -- ^ Use the compatibilty profile with a given major and minor version. The compatibility profile allows you to use deprecated functions such as immediate mode+  | ES Mode CInt CInt+    -- ^ Use an OpenGL profile for embedded systems+  deriving (Eq, Generic, Ord, Read, Show, Typeable)++-- | The mode a driver should use when creating an OpenGL context.+data Mode+  = Normal+    -- ^ A normal profile with no special debugging support+  | Debug+    -- ^ Use a debug context, allowing the usage of extensions such as @GL_ARB_debug_output@+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++-- | A created OpenGL context.+newtype GLContext = GLContext Raw.GLContext+  deriving (Eq, Typeable)++-- | Create a new OpenGL context and makes it the current context for the+-- window.+--+-- Throws 'SDLException' if the window wasn't configured with OpenGL+-- support, or if context creation fails.+--+-- See @<https://wiki.libsdl.org/SDL_GL_CreateContext SDL_GL_CreateContext>@ for C documentation.+glCreateContext :: (Functor m, MonadIO m) => Window -> m GLContext+glCreateContext (Window w) =+  GLContext <$> throwIfNull "SDL.Video.glCreateContext" "SDL_GL_CreateContext"+    (Raw.glCreateContext w)++-- | Set up an OpenGL context for rendering into an OpenGL window.+--+-- Throws 'SDLException' on failure.+--+-- See @<https://wiki.libsdl.org/SDL_GL_MakeCurrent SDL_GL_MakeCurrent>@ for C documentation.+glMakeCurrent :: (Functor m, MonadIO m) => Window -> GLContext -> m ()+glMakeCurrent (Window w) (GLContext ctx) =+  throwIfNeg_ "SDL.Video.OpenGL.glMakeCurrent" "SDL_GL_MakeCurrent" $+    Raw.glMakeCurrent w ctx++-- | Delete the given OpenGL context.+--+-- You /must/ make sure that there are no pending commands in the OpenGL+-- command queue, the driver may still be processing commands even if you have+-- stopped issuing them!+--+-- The @glFinish@ command will block until the command queue has been fully+-- processed. You should call that function before deleting a context.+--+-- See @<https://wiki.libsdl.org/SDL_GL_DeleteContext SDL_GL_DeleteContext>@ for C documentation.+glDeleteContext :: MonadIO m => GLContext -> m ()+glDeleteContext (GLContext ctx) = Raw.glDeleteContext ctx++-- | Replace the contents of the front buffer with the back buffer's. The+-- contents of the back buffer are undefined, clear them with @glClear@ or+-- equivalent before drawing to them again.+--+-- See @<https://wiki.libsdl.org/SDL_GL_SwapWindow SDL_GL_SwapWindow>@ for C documentation.+glSwapWindow :: MonadIO m => Window -> m ()+glSwapWindow (Window w) = Raw.glSwapWindow w++-- | The swap interval for the current OpenGL context.+data SwapInterval+  = ImmediateUpdates+    -- ^ No vertical retrace synchronization+  | SynchronizedUpdates+    -- ^ The buffer swap is synchronized with the vertical retrace+  | LateSwapTearing+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance ToNumber SwapInterval CInt where+  toNumber ImmediateUpdates = 0+  toNumber SynchronizedUpdates = 1+  toNumber LateSwapTearing = -1++instance FromNumber SwapInterval CInt where+  fromNumber n' =+    case n' of+      0 -> ImmediateUpdates+      1 -> SynchronizedUpdates+      -1 -> LateSwapTearing+      _ ->+        error ("Unknown SwapInterval: " ++ show n')++-- | Get or set the swap interval for the current OpenGL context.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_GL_SetSwapInterval SDL_GL_SetSwapInterval>@ and @<https://wiki.libsdl.org/SDL_GL_GetSwapInterval SDL_GL_GetSwapInterval>@ for C documentation.+swapInterval :: StateVar SwapInterval+swapInterval = makeStateVar glGetSwapInterval glSetSwapInterval+  where+  glGetSwapInterval = fmap fromNumber $ Raw.glGetSwapInterval++  glSetSwapInterval i =+    throwIfNeg_ "SDL.Video.glSetSwapInterval" "SDL_GL_SetSwapInterval" $+      Raw.glSetSwapInterval (toNumber i)++-- | Get the size of a window's underlying drawable area in pixels (for use+-- with glViewport).+--+-- It may differ from 'SDL.Video.windowSize' if window was created with 'SDL.Video.windowHighDPI' flag.+glGetDrawableSize :: MonadIO m => Window -> m (V2 CInt)+glGetDrawableSize (Window w) =+    liftIO $+    alloca $ \wptr ->+    alloca $ \hptr -> do+        Raw.glGetDrawableSize w wptr hptr+        V2 <$> peek wptr <*> peek hptr
src/SDL/Video/Renderer.hs view
@@ -1,1242 +1,1242 @@-{-# LANGUAGE CPP #-}
-{-# LANGUAGE DeriveDataTypeable #-}
-{-# LANGUAGE DeriveFunctor #-}
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternSynonyms #-}
-
--- | "SDL.Video.Renderer" provides a high-level interface to SDL's accelerated 2D rendering library.
-
-module SDL.Video.Renderer
-  ( Renderer
-
-    -- * 'Renderer' Configuration
-    -- | These configuration options can be used with 'SDL.Video.createRenderer' to create 'Renderer's.
-  , RendererConfig(..)
-  , defaultRenderer
-  , RendererType(..)
-
-  -- * Drawing Primitives
-  , clear
-  , copy
-  , copyEx
-  , drawLine
-  , drawLines
-  , drawPoint
-  , drawPoints
-  , drawRect
-  , drawRects
-  , fillRect
-  , fillRects
-  , present
-
-  -- * 'Renderer' State
-  -- | SDL exposes a stateful interface to 'Renderer's - the above primitives drawing routines will change their
-  -- output depending on the value of these state variables.
-  , rendererDrawBlendMode
-  , rendererDrawColor
-  , rendererRenderTarget
-  , rendererClipRect
-  , rendererLogicalSize
-  , rendererScale
-  , rendererViewport
-  , renderTargetSupported
-
-  -- * 'Surface's
-  , Surface(..)
-  , updateWindowSurface
-  , surfaceBlit
-  , surfaceBlitScaled
-  , surfaceFillRect
-  , surfaceFillRects
-
-  -- ** Creating and Destroying 'Surface's
-  , convertSurface
-  , createRGBSurface
-  , createRGBSurfaceFrom
-  , freeSurface
-  , getWindowSurface
-  , loadBMP
-
-  -- ** 'Surface' state
-  , surfaceColorKey
-  , surfaceBlendMode
-  , surfaceDimensions
-  , surfaceFormat
-  , surfacePixels
-
-  -- ** Accessing 'Surface' Data
-  , lockSurface
-  , unlockSurface
-
-  -- * 'Palette's and pixel formats
-  , Palette
-  , paletteNColors
-  , paletteColors
-  , paletteColor
-  , PixelFormat(..)
-  , SurfacePixelFormat
-  , formatPalette
-  , setPaletteColors
-  , pixelFormatToMasks
-  , masksToPixelFormat
-
-  -- * Textures
-  , Texture
-
-  -- ** Creating, Using and Destroying 'Texture's
-  , createTexture
-  , TextureAccess(..)
-  , createTextureFromSurface
-  , updateTexture
-  , destroyTexture
-  , glBindTexture
-  , glUnbindTexture
-
-  -- ** 'Texture' State
-  , textureAlphaMod
-  , textureBlendMode
-  , BlendMode(..)
-  , textureColorMod
-
-  -- ** Accessing 'Texture' Data
-  , lockTexture
-  , unlockTexture
-  , queryTexture
-  , TextureInfo(..)
-
-  , Rectangle(..)
-
-  -- * Available 'Renderer's
-  -- | These functions allow you to query the current system for available 'Renderer's that can be created
-  -- with 'SDL.Video.createRenderer'.
-  , getRendererInfo
-  , RendererInfo(..)
-  , getRenderDriverInfo
-  ) where
-
-import Control.Monad.IO.Class (MonadIO, liftIO)
-import Data.Bits
-import Data.Data (Data)
-import Data.Foldable
-import Data.StateVar
-import Data.Text (Text)
-import Data.Typeable
-import Data.Word
-import Foreign.C.String
-import Foreign.C.Types
-import Foreign.ForeignPtr
-import Foreign.Marshal.Alloc
-import Foreign.Marshal.Utils
-import Foreign.Ptr
-import Foreign.Storable
-import GHC.Generics (Generic)
-import Prelude hiding (foldr)
-import SDL.Vect
-import SDL.Internal.Exception
-import SDL.Internal.Numbered
-import SDL.Internal.Types
-import qualified Data.ByteString as BS
-import qualified Data.ByteString.Internal as BSI
-import qualified Data.Text.Encoding as Text
-import qualified Data.Vector.Storable as SV
-import qualified Data.Vector.Storable.Mutable as MSV
-import qualified SDL.Raw as Raw
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative
-import Data.Traversable
-#endif
-
--- | Perform a fast surface copy to a destination surface.
---
--- See @<https://wiki.libsdl.org/SDL_BlitSurface SDL_BlitSurface>@ for C documentation.
-surfaceBlit :: MonadIO m
-            => Surface -- ^ The 'Surface' to be copied from
-            -> Maybe (Rectangle CInt) -- ^ The rectangle to be copied, or 'Nothing' to copy the entire surface
-            -> Surface -- ^ The 'Surface' that is the blit target
-            -> Maybe (Point V2 CInt) -- ^ The position to blit to
-            -> m (Maybe (Rectangle CInt))
-surfaceBlit (Surface src _) srcRect (Surface dst _) dstLoc = liftIO $
-  maybeWith with srcRect $ \srcPtr ->
-  maybeWith with (fmap (flip Rectangle 0) dstLoc) $ \dstPtr -> do
-      _ <- throwIfNeg "SDL.Video.blitSurface" "SDL_BlitSurface" $
-           Raw.blitSurface src (castPtr srcPtr) dst (castPtr dstPtr)
-      maybe (pure Nothing) (\_ -> Just <$> peek dstPtr) dstLoc
-
--- | Create a texture for a rendering context.
---
--- See @<https://wiki.libsdl.org/SDL_CreateTexture SDL_CreateTexture>@ for C documentation.
-createTexture :: (Functor m,MonadIO m)
-              => Renderer -- ^ The rendering context.
-              -> PixelFormat
-              -> TextureAccess
-              -> V2 CInt -- ^ The size of the texture.
-              -> m Texture
-createTexture (Renderer r) fmt access (V2 w h) =
-  fmap Texture $
-  throwIfNull "SDL.Video.Renderer.createTexture" "SDL_CreateTexture" $
-  Raw.createTexture r (toNumber fmt) (toNumber access) w h
-
--- | Create a texture from an existing surface.
---
--- See @<https://wiki.libsdl.org/SDL_CreateTextureFromSurface SDL_CreateTextureFromSurface>@ for C documentation.
-createTextureFromSurface :: (Functor m,MonadIO m)
-                         => Renderer -- ^ The rendering context
-                         -> Surface -- ^ The surface containing pixel data used to fill the texture
-                         -> m Texture
-createTextureFromSurface (Renderer r) (Surface s _) =
-  fmap Texture $
-  throwIfNull "SDL.Video.createTextureFromSurface" "SDL_CreateTextureFromSurface" $
-  Raw.createTextureFromSurface r s
-
--- | Bind an OpenGL\/ES\/ES2 texture to the current context for use with when rendering OpenGL primitives directly.
---
--- See @<https://wiki.libsdl.org/SDL_GL_BindTexture SDL_GL_BindTexture>@ for C documentation.
-glBindTexture :: (Functor m,MonadIO m)
-              => Texture -- ^ The texture to bind to the current OpenGL\/ES\/ES2 context
-              -> m ()
-glBindTexture (Texture t) =
-  throwIfNeg_ "SDL.Video.Renderer.glBindTexture" "SDL_GL_BindTexture" $
-  Raw.glBindTexture t nullPtr nullPtr
-
--- | Unbind an OpenGL\/ES\/ES2 texture from the current context.
---
--- See @<https://wiki.libsdl.org/SDL_GL_UnbindTexture SDL_GL_UnbindTexture>@ for C documentation.
-glUnbindTexture :: (Functor m,MonadIO m)
-                => Texture -- ^ The texture to unbind from the current OpenGL\/ES\/ES2 context
-                -> m ()
-glUnbindTexture (Texture t) =
-  throwIfNeg_ "SDL.Video.Renderer.glUnindTexture" "SDL_GL_UnbindTexture" $
-  Raw.glUnbindTexture t
-
--- | Updates texture rectangle with new pixel data.
---
--- See @<https://wiki.libsdl.org/SDL_UpdateTexture SDL_UpdateTexture>@ for C documentation.
-updateTexture :: (Functor m, MonadIO m)
-              => Texture -- ^ The 'Texture' to be updated
-              -> Maybe (Rectangle CInt) -- ^ The area to update, Nothing for entire texture
-              -> BS.ByteString -- ^ The raw pixel data
-              -> CInt -- ^ The number of bytes in a row of pixel data, including padding between lines
-              -> m Texture
-updateTexture tex@(Texture t) rect pixels pitch = do
-  liftIO $ throwIfNeg_ "SDL.Video.updateTexture" "SDL_UpdateTexture" $
-    maybeWith with rect $ \rectPtr ->
-      let (pixelForeign, _, _) = BSI.toForeignPtr pixels
-      in withForeignPtr pixelForeign $ \pixelsPtr ->
-        Raw.updateTexture t (castPtr rectPtr) (castPtr pixelsPtr) pitch
-  return tex
-
--- | Destroy the specified texture.
---
--- See @<https://wiki.libsdl.org/SDL_DestroyTexture SDL_DestroyTexture>@ for the C documentation.
-destroyTexture :: MonadIO m => Texture -> m ()
-destroyTexture (Texture t) = Raw.destroyTexture t
-
--- | Lock a portion of the texture for *write-only* pixel access.
---
--- See @<https://wiki.libsdl.org/SDL_LockTexture SDL_LockTexture>@ for C documentation.
-lockTexture :: MonadIO m
-            => Texture -- ^ The 'Texture' to lock for access, which must have been created with 'TextureAccessStreaming'
-            -> Maybe (Rectangle CInt) -- ^ The area to lock for access; 'Nothing' to lock the entire texture
-            -> m (Ptr (),CInt) -- ^ A pointer to the locked pixels, appropriately offset by the locked area, and the pitch of the locked pixels (the pitch is the length of one row in bytes).
-lockTexture (Texture t) rect = liftIO $
-  alloca $ \pixelsPtr ->
-  alloca $ \pitchPtr ->
-  maybeWith with rect $ \rectPtr -> do
-    throwIfNeg_ "lockTexture" "SDL_LockTexture" $
-      Raw.lockTexture t (castPtr rectPtr) pixelsPtr pitchPtr
-    pixels <- peek pixelsPtr
-    pitch <- peek pitchPtr
-    return (pixels, pitch)
-
--- | Unlock a texture, uploading the changes to video memory, if needed.
---
--- /Warning/: See <https://bugzilla.libsdl.org/show_bug.cgi?id=1586 Bug No. 1586> before using this function!
---
--- See @<https://wiki.libsdl.org/SDL_UnlockTexture SDL_UnlockTexture>@ for C documentation.
-unlockTexture :: MonadIO m => Texture -> m ()
-unlockTexture (Texture t) = Raw.unlockTexture t
-
--- | Set up a surface for directly accessing the pixels.
---
--- See @<https://wiki.libsdl.org/SDL_LockSurface SDL_LockSurface>@ for C documentation.
-lockSurface :: MonadIO m => Surface -> m ()
-lockSurface (Surface s _) =
-  throwIfNeg_ "lockSurface" "SDL_LockSurface" $
-    Raw.lockSurface s
-
--- | Release a surface after directly accessing the pixels.
---
--- See @<https://wiki.libsdl.org/SDL_UnlockSurface SDL_UnlockSurface>@ for C documentation.
-unlockSurface :: MonadIO m => Surface -> m ()
-unlockSurface (Surface s _) = Raw.unlockSurface s
-
--- | Information to the GPU about how you will use a texture.
-data TextureAccess
-  = TextureAccessStatic
-    -- ^ Changes rarely, cannot be locked
-  | TextureAccessStreaming
-    -- ^ changes frequently, can be locked
-  | TextureAccessTarget
-    -- ^ Can be used as a render target
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber TextureAccess CInt where
-  fromNumber n' = case n' of
-    Raw.SDL_TEXTUREACCESS_STATIC -> TextureAccessStatic
-    Raw.SDL_TEXTUREACCESS_STREAMING -> TextureAccessStreaming
-    Raw.SDL_TEXTUREACCESS_TARGET -> TextureAccessTarget
-    _ -> error "Unknown value"
-
-instance ToNumber TextureAccess CInt where
-  toNumber t = case t of
-    TextureAccessStatic -> Raw.SDL_TEXTUREACCESS_STATIC
-    TextureAccessStreaming -> Raw.SDL_TEXTUREACCESS_STREAMING
-    TextureAccessTarget -> Raw.SDL_TEXTUREACCESS_TARGET
-
-data TextureInfo = TextureInfo
-  { texturePixelFormat :: PixelFormat
-    -- ^ Raw format of the texture; the actual format may differ, but pixel transfers will use this format
-  , textureAccess      :: TextureAccess
-    -- ^ The access available to the texture
-  , textureWidth       :: CInt
-    -- ^ The width of the texture
-  , textureHeight      :: CInt
-    -- ^ The height of the texture
-  } deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
--- | Query the attributes of a texture.
---
--- See @<https://wiki.libsdl.org/SDL_QueryTexture SDL_QueryTexture>@ for C documentation.
-queryTexture :: MonadIO m => Texture -> m TextureInfo
-queryTexture (Texture tex) = liftIO $
-  alloca $ \pfPtr ->
-  alloca $ \acPtr ->
-  alloca $ \wPtr ->
-  alloca $ \hPtr -> do
-    throwIfNeg_ "SDL.Video.queryTexture" "SDL_QueryTexture" $
-      Raw.queryTexture tex pfPtr acPtr wPtr hPtr
-    TextureInfo <$>
-      fmap fromNumber (peek pfPtr) <*>
-      fmap fromNumber (peek acPtr) <*>
-      peek wPtr <*>
-      peek hPtr
-
--- | Allocate a new RGB surface.
---
--- See @<https://wiki.libsdl.org/SDL_CreateRGBSurface SDL_CreateRGBSurface>@ for C documentation.
-createRGBSurface :: (Functor m, MonadIO m)
-                 => V2 CInt -- ^ The size of the surface
-                 -> PixelFormat -- ^ The bit depth, red, green, blue and alpha mask for the pixels
-                 -> m Surface
-createRGBSurface (V2 w h) pf =
-  fmap unmanagedSurface $
-    throwIfNull "SDL.Video.createRGBSurface" "SDL_CreateRGBSurface" $ do
-      (bpp, V4 r g b a) <- pixelFormatToMasks pf
-      Raw.createRGBSurface 0 w h bpp r g b a
-
--- | Allocate a new RGB surface with existing pixel data.
---
--- See @<https://wiki.libsdl.org/SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom>@ for C documentation.
-createRGBSurfaceFrom :: (Functor m, MonadIO m)
-                     => MSV.IOVector Word8 -- ^ The existing pixel data
-                     -> V2 CInt -- ^ The size of the surface
-                     -> CInt -- ^ The pitch - the length of a row of pixels in bytes
-                     -> PixelFormat -- ^ The bit depth, red, green, blue and alpha mask for the pixels
-                     -> m Surface
-createRGBSurfaceFrom pixels (V2 w h) p pf = liftIO $
-  fmap (managedSurface pixels) $
-    throwIfNull "SDL.Video.createRGBSurfaceFrom" "SDL_CreateRGBSurfaceFrom" $ do
-      (bpp, V4 r g b a) <- pixelFormatToMasks pf
-      MSV.unsafeWith pixels $ \pixelPtr ->
-        Raw.createRGBSurfaceFrom (castPtr pixelPtr) w h bpp p r g b a
-
--- | Perform a fast fill of a rectangle with a specific color.
---
--- If there is a clip rectangle set on the destination (set via 'clipRect'), then this function will fill based on the intersection of the clip rectangle and the given 'Rectangle'.
---
--- See @<https://wiki.libsdl.org/SDL_FillRect SDL_FillRect>@ for C documentation.
-surfaceFillRect :: MonadIO m
-                => Surface -- ^ The 'Surface' that is the drawing target.
-                -> Maybe (Rectangle CInt) -- ^ The rectangle to fill, or 'Nothing' to fill the entire surface.
-                -> V4 Word8 -- ^ The color to fill with. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place. This colour will be implictly mapped to the closest approximation that matches the surface's pixel format.
-                -> m ()
-surfaceFillRect (Surface s _) rect (V4 r g b a) = liftIO $
-  throwIfNeg_ "SDL.Video.fillRect" "SDL_FillRect" $
-  maybeWith with rect $ \rectPtr -> do
-    format <- Raw.surfaceFormat <$> peek s
-    Raw.mapRGBA format r g b a >>= Raw.fillRect s (castPtr rectPtr)
-
--- | Perform a fast fill of a set of rectangles with a specific color.
---
--- If there is a clip rectangle set on any of the destinations (set via 'clipRect'), then this function will fill based on the intersection of the clip rectangle and the given 'Rectangle's.
---
--- See @<https://wiki.libsdl.org/SDL_FillRect SDL_FillRects>@ for C documentation.
-surfaceFillRects :: MonadIO m
-                 => Surface -- ^ The 'Surface' that is the drawing target.
-                 -> SV.Vector (Rectangle CInt) -- ^ A 'SV.Vector' of 'Rectangle's to be filled.
-                 -> V4 Word8 -- ^ The color to fill with. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place. This colour will be implictly mapped to the closest approximation that matches the surface's pixel format.
-                 -> m ()
-surfaceFillRects (Surface s _) rects (V4 r g b a) = liftIO $ do
-  throwIfNeg_ "SDL.Video.fillRects" "SDL_FillRects" $
-    SV.unsafeWith rects $ \rp -> do
-      format <- Raw.surfaceFormat <$> peek s
-      Raw.fillRects s
-                    (castPtr rp)
-                    (fromIntegral (SV.length rects))
-                    =<< Raw.mapRGBA format r g b a
-
--- | Free an RGB surface.
---
--- If the surface was created using 'createRGBSurfaceFrom' then the pixel data is not freed.
---
--- See @<https://wiki.libsdl.org/SDL_FreeSurface SDL_FreeSurface>@ for the C documentation.
-freeSurface :: MonadIO m => Surface -> m ()
-freeSurface (Surface s _) = Raw.freeSurface s
-
--- | Load a surface from a BMP file.
---
--- See @<https://wiki.libsdl.org/SDL_LoadBMP SDL_LoadBMP>@ for C documentation.
-loadBMP :: MonadIO m => FilePath -> m Surface
-loadBMP filePath = liftIO $
-  fmap unmanagedSurface $
-  throwIfNull "SDL.Video.loadBMP" "SDL_LoadBMP" $
-  withCString filePath $ Raw.loadBMP
-
-newtype SurfacePixelFormat = SurfacePixelFormat (Ptr Raw.PixelFormat)
-  deriving (Eq, Typeable)
-
--- It's possible we could use unsafePerformIO here, but I'm not
--- sure. surface->{w,h} are immutable, but do we need to guarantee that pointers
--- aren't reused by *different* surfaces.
--- | Retrive the width and height of a 'Surface'.
-surfaceDimensions :: MonadIO m => Surface -> m (V2 CInt)
-surfaceDimensions (Surface s _) = liftIO $ (V2 <$> Raw.surfaceW <*> Raw.surfaceH) <$> peek s
-
--- | Obtain the pointer to the underlying pixels in a surface. You should bracket
--- this call with 'lockSurface' and 'unlockSurface', respectively.
-surfacePixels :: MonadIO m => Surface -> m (Ptr ())
-surfacePixels (Surface s _) = liftIO $ Raw.surfacePixels <$> peek s
-
--- It's possible we could use unsafePerformIO here, but I'm not
--- sure. surface->format is immutable, but do we need to guarantee that pointers
--- aren't reused by *different* surfaces?
--- | Inspect the pixel format under a surface.
-surfaceFormat :: MonadIO m => Surface -> m SurfacePixelFormat
-surfaceFormat (Surface s _) = liftIO $ SurfacePixelFormat . Raw.surfaceFormat <$> peek s
-
-newtype Palette = Palette (Ptr Raw.Palette)
-  deriving (Eq, Typeable)
-
-formatPalette :: MonadIO m => SurfacePixelFormat -> m (Maybe Palette)
-formatPalette (SurfacePixelFormat f) = liftIO $ wrap . Raw.pixelFormatPalette <$> peek f
-  where wrap p
-          | p == nullPtr = Nothing
-          | otherwise = Just (Palette p)
-
-paletteNColors :: MonadIO m => Palette -> m CInt
-paletteNColors (Palette p) = liftIO $ Raw.paletteNColors <$> peek p
-
-paletteColors :: MonadIO m => Palette -> m (Maybe (SV.Vector (V4 Word8)))
-paletteColors q@(Palette p) = do
-  n <- liftIO $ fromIntegral <$> paletteNColors q
-  let wrap p' | p' == nullPtr = Nothing
-              | otherwise     = return p'
-  mv <- liftIO $ wrap . castPtr . Raw.paletteColors <$> peek p
-  mColor <- liftIO $ traverse newForeignPtr_ mv
-  return $ flip SV.unsafeFromForeignPtr0 n <$> mColor
-
-paletteColor :: MonadIO m => Palette -> CInt -> m (Maybe (V4 Word8))
-paletteColor q@(Palette p) i = do
-    rp <- liftIO $ peek p
-    m <- paletteNColors q
-    if m > i && i >= 0 then
-      liftIO $ fmap return . flip peekElemOff (fromIntegral i) . castPtr . Raw.paletteColors $ rp
-    else
-      return Nothing
-
--- | Set a range of colors in a palette.
---
--- See @<https://wiki.libsdl.org/SDL_SetPaletteColors SDL_SetPaletteColors>@ for C documentation.
-setPaletteColors :: MonadIO m
-                 => Palette -- ^ The 'Palette' to modify
-                 -> (SV.Vector (V4 Word8)) -- ^ A 'SV.Vector' of colours to copy into the palette
-                 -> CInt -- ^ The index of the first palette entry to modify
-                 -> m ()
-setPaletteColors (Palette p) colors first = liftIO $
-  throwIfNeg_ "SDL.Video.setPaletteColors" "SDL_SetPaletteColors" $
-  SV.unsafeWith colors $ \cp ->
-    Raw.setPaletteColors p (castPtr cp) first n
-  where
-    n = fromIntegral $ SV.length colors
-
--- | Get the SDL surface associated with the window.
---
--- See @<https://wiki.libsdl.org/SDL_GetWindowSurface SDL_GetWindowSurface>@ for C documentation.
-getWindowSurface :: (Functor m, MonadIO m) => Window -> m Surface
-getWindowSurface (Window w) =
-  fmap unmanagedSurface $
-  throwIfNull "SDL.Video.getWindowSurface" "SDL_GetWindowSurface" $
-  Raw.getWindowSurface w
-
--- | Get or set the blend mode used for drawing operations (fill and line).
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode>@ and @<https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode SDL_GetRenderDrawBlendMode>@ for C documentation.
-rendererDrawBlendMode :: Renderer -> StateVar BlendMode
-rendererDrawBlendMode (Renderer r) = makeStateVar getRenderDrawBlendMode setRenderDrawBlendMode
-  where
-  getRenderDrawBlendMode = liftIO $
-    alloca $ \bmPtr -> do
-      throwIfNeg_ "SDL.Video.Renderer.getRenderDrawBlendMode" "SDL_GetRenderDrawBlendMode" $
-        Raw.getRenderDrawBlendMode r bmPtr
-      fromNumber <$> peek bmPtr
-
-  setRenderDrawBlendMode bm =
-    throwIfNeg_ "SDL.Video.Renderer.setRenderDrawBlendMode" "SDL_SetRenderDrawBlendMode" $
-    Raw.setRenderDrawBlendMode r (toNumber bm)
-
--- | Get or set the color used for drawing operations (rect, line and clear).
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetRenderDrawColor SDL_SetRenderDrawColor>@ and @<https://wiki.libsdl.org/SDL_GetRenderDrawColor SDL_GetRenderDrawColor>@ for C documentation.
-rendererDrawColor :: Renderer -> StateVar (V4 Word8)
-rendererDrawColor (Renderer re) = makeStateVar getRenderDrawColor setRenderDrawColor
-  where
-  getRenderDrawColor = liftIO $
-    alloca $ \r ->
-    alloca $ \g ->
-    alloca $ \b ->
-    alloca $ \a -> do
-      throwIfNeg_ "SDL.Video.Renderer.getRenderDrawColor" "SDL_GetRenderDrawColor" $
-        Raw.getRenderDrawColor re r g b a
-      V4 <$> peek r <*> peek g <*> peek b <*> peek a
-
-  setRenderDrawColor (V4 r g b a) =
-    throwIfNeg_ "SDL.Video.setRenderDrawColor" "SDL_SetRenderDrawColor" $
-    Raw.setRenderDrawColor re r g b a
-
--- | Copy the window surface to the screen.
---
--- This is the function you use to reflect any changes to the surface on the screen.
---
--- See @<https://wiki.libsdl.org/SDL_UpdateWindowSurface SDL_UpdateWindowSurface>@ for C documentation.
-updateWindowSurface :: (Functor m, MonadIO m) => Window -> m ()
-updateWindowSurface (Window w) =
-  throwIfNeg_ "SDL.Video.updateWindowSurface" "SDL_UpdateWindowSurface" $
-    Raw.updateWindowSurface w
-
--- | Blend modes used in 'copy' and drawing operations.
-data BlendMode
-  = BlendNone
-    -- ^ No blending
-  | BlendAlphaBlend
-    -- ^ Alpha blending.
-    --
-    -- @
-    -- dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
-    -- dstA = srcA + (dstA * (1-srcA))
-    -- @
-  | BlendAdditive
-    -- ^ Additive blending
-    --
-    -- @
-    -- dstRGB = (srcRGB * srcA) + dstRGB
-    -- dstA = dstA
-    -- @
-  | BlendMod
-    -- ^ Color modulate
-    --
-    -- @
-    -- dstRGB = srcRGB * dstRGB
-    -- dstA = dstA
-    --
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber BlendMode Word32 where
-  fromNumber n = case n of
-    Raw.SDL_BLENDMODE_ADD -> BlendAdditive
-    Raw.SDL_BLENDMODE_BLEND -> BlendAlphaBlend
-    Raw.SDL_BLENDMODE_NONE -> BlendNone
-    Raw.SDL_BLENDMODE_MOD -> BlendMod
-    _ -> error $ "fromNumber<BlendMode>: unknown blend mode: " ++ show n
-
-instance ToNumber BlendMode Word32 where
-  toNumber BlendNone = Raw.SDL_BLENDMODE_NONE
-  toNumber BlendAlphaBlend = Raw.SDL_BLENDMODE_BLEND
-  toNumber BlendAdditive = Raw.SDL_BLENDMODE_ADD
-  toNumber BlendMod = Raw.SDL_BLENDMODE_MOD
-
-data Rectangle a = Rectangle (Point V2 a) (V2 a)
-  deriving (Eq, Functor, Generic, Ord, Read, Show, Typeable)
-
-instance Storable a => Storable (Rectangle a) where
-  sizeOf ~(Rectangle o s) = sizeOf o + sizeOf s
-  alignment _ = 0
-  peek ptr = do
-    o <- peek (castPtr ptr)
-    s <- peek (castPtr (ptr `plusPtr` sizeOf o))
-    return (Rectangle o s)
-  poke ptr (Rectangle o s) = do
-    poke (castPtr ptr) o
-    poke (castPtr (ptr `plusPtr` sizeOf o)) s
-
-data Surface = Surface (Ptr Raw.Surface) (Maybe (MSV.IOVector Word8))
-  deriving (Typeable)
-
-unmanagedSurface :: Ptr Raw.Surface -> Surface
-unmanagedSurface s = Surface s Nothing
-
-managedSurface :: MSV.IOVector Word8 -> Ptr Raw.Surface -> Surface
-managedSurface p s = Surface s (Just p)
-
-newtype Texture = Texture Raw.Texture
-  deriving (Eq, Typeable)
-
--- | Draw a rectangle outline on the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderDrawRect SDL_RenderDrawRect>@ for C documentation.
-drawRect :: MonadIO m
-         => Renderer
-         -> Maybe (Rectangle CInt) -- ^ The rectangle outline to draw. 'Nothing' for the entire rendering context.
-         -> m ()
-drawRect (Renderer r) rect = liftIO $
-  throwIfNeg_ "SDL.Video.drawRect" "SDL_RenderDrawRect" $
-  maybeWith with rect (Raw.renderDrawRect r . castPtr)
-
--- | Draw some number of rectangles on the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderDrawRects SDL_RenderDrawRects>@ for C documentation.
-drawRects :: MonadIO m => Renderer -> SV.Vector (Rectangle CInt) -> m ()
-drawRects (Renderer r) rects = liftIO $
-  throwIfNeg_ "SDL.Video.drawRects" "SDL_RenderDrawRects" $
-  SV.unsafeWith rects $ \rp ->
-    Raw.renderDrawRects r
-                        (castPtr rp)
-                        (fromIntegral (SV.length rects))
-
--- | Fill a rectangle on the current rendering target with the drawing color.
---
--- See @<https://wiki.libsdl.org/SDL_RenderFillRect SDL_RenderFillRect>@ for C documentation.
-fillRect :: MonadIO m
-         => Renderer
-         -> Maybe (Rectangle CInt) -- ^ The rectangle to fill. 'Nothing' for the entire rendering context.
-         -> m ()
-fillRect (Renderer r) rect = liftIO $ do
-  throwIfNeg_ "SDL.Video.fillRect" "SDL_RenderFillRect" $
-    maybeWith with rect $ \rPtr ->
-      Raw.renderFillRect r
-                         (castPtr rPtr)
-
--- | Fill some number of rectangles on the current rendering target with the drawing color.
---
--- See @<https://wiki.libsdl.org/SDL_RenderFillRects SDL_RenderFillRects>@ for C documentation.
-fillRects :: MonadIO m => Renderer -> SV.Vector (Rectangle CInt) -> m ()
-fillRects (Renderer r) rects = liftIO $
-  throwIfNeg_ "SDL.Video.fillRects" "SDL_RenderFillRects" $
-    SV.unsafeWith rects $ \rp ->
-      Raw.renderFillRects r
-                          (castPtr rp)
-                          (fromIntegral (SV.length rects))
-
--- | Clear the current rendering target with the drawing color.
---
--- See @<https://wiki.libsdl.org/SDL_RenderClear SDL_RenderClear>@ for C documentation.
-clear :: (Functor m, MonadIO m) => Renderer -> m ()
-clear (Renderer r) =
-  throwIfNeg_ "SDL.Video.clear" "SDL_RenderClear" $
-  Raw.renderClear r
-
--- | Get or set the drawing scale for rendering on the current target.
---
--- The drawing coordinates are scaled by the x\/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.
---
--- If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.
---
--- See @<https://wiki.libsdl.org/SDL_RenderSetScale SDL_RenderSetScale>@ and @<https://wiki.libsdl.org/SDL_RenderGetScale SDL_RenderGetScale>@ for C documentation.
-rendererScale :: Renderer -> StateVar (V2 CFloat)
-rendererScale (Renderer r) = makeStateVar renderGetScale renderSetScale
-  where
-  renderSetScale (V2 x y) =
-    throwIfNeg_ "SDL.Video.renderSetScale" "SDL_RenderSetScale" $
-    Raw.renderSetScale r x y
-
-  renderGetScale = liftIO $
-    alloca $ \w ->
-    alloca $ \h -> do
-      Raw.renderGetScale r w h
-      V2 <$> peek w <*> peek h
-
--- | Get or set the clip rectangle for rendering on the specified target.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_RenderSetClipRect SDL_RenderSetClipRect>@ and @<https://wiki.libsdl.org/SDL_RenderGetClipRect SDL_RenderGetClipRect>@ for C documentation.
-rendererClipRect :: Renderer -> StateVar (Maybe (Rectangle CInt))
-rendererClipRect (Renderer r) = makeStateVar renderGetClipRect renderSetClipRect
-  where
-  renderGetClipRect = liftIO $
-    alloca $ \rPtr -> do
-      Raw.renderGetClipRect r rPtr
-      maybePeek peek (castPtr rPtr)
-  renderSetClipRect rect =
-    liftIO $
-    throwIfNeg_ "SDL.Video.renderSetClipRect" "SDL_RenderSetClipRect" $
-    maybeWith with rect $ Raw.renderSetClipRect r . castPtr
-
--- | Get or set the drawing area for rendering on the current target.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_RenderSetViewport SDL_RenderSetViewport>@ and @<https://wiki.libsdl.org/SDL_RenderGetViewport SDL_RenderGetViewport>@ for C documentation.
-rendererViewport :: Renderer -> StateVar (Maybe (Rectangle CInt))
-rendererViewport (Renderer r) = makeStateVar renderGetViewport renderSetViewport
-  where
-  renderGetViewport = liftIO $
-    alloca $ \rect -> do
-      Raw.renderGetViewport r rect
-      maybePeek peek (castPtr rect)
-
-  renderSetViewport rect =
-    liftIO $
-    throwIfNeg_ "SDL.Video.renderSetViewport" "SDL_RenderSetViewport" $
-    maybeWith with rect $ Raw.renderSetViewport r . castPtr
-
--- | Update the screen with any rendering performed since the previous call.
---
--- SDL\'s rendering functions operate on a backbuffer; that is, calling a rendering function such as 'drawLine' does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.
---
--- Therefore, when using SDL's rendering API, one does all drawing intended for the frame, and then calls this function once per frame to present the final drawing to the user.
---
--- The backbuffer should be considered invalidated after each present; do not assume that previous contents will exist between frames. You are strongly encouraged to call 'clear' to initialize the backbuffer before starting each new frame's drawing, even if you plan to overwrite every pixel.
---
--- See @<https://wiki.libsdl.org/SDL_RenderPresent SDL_RenderPresent>@ for C documentation.
-present :: MonadIO m => Renderer -> m ()
-present (Renderer r) = Raw.renderPresent r
-
--- | Copy a portion of the texture to the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderCopy SDL_RenderCopy>@ for C documentation.
-copy :: MonadIO m
-     => Renderer -- ^ The rendering context
-     -> Texture -- ^ The source texture
-     -> Maybe (Rectangle CInt) -- ^ The source rectangle to copy, or 'Nothing' for the whole texture
-     -> Maybe (Rectangle CInt) -- ^ The destination rectangle to copy to, or 'Nothing' for the whole rendering target. The texture will be stretched to fill the given rectangle.
-     -> m ()
-copy (Renderer r) (Texture t) srcRect dstRect =
-  liftIO $
-  throwIfNeg_ "SDL.Video.copy" "SDL_RenderCopy" $
-  maybeWith with srcRect $ \src ->
-  maybeWith with dstRect $ \dst ->
-  Raw.renderCopy r t (castPtr src) (castPtr dst)
-
--- | Copy a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right.
---
--- See @<https://wiki.libsdl.org/SDL_RenderCopyEx SDL_RenderCopyEx>@ for C documentation.
-copyEx :: MonadIO m
-       => Renderer -- ^ The rendering context
-       -> Texture -- ^ The source texture
-       -> Maybe (Rectangle CInt) -- ^ The source rectangle to copy, or 'Nothing' for the whole texture
-       -> Maybe (Rectangle CInt) -- ^ The destination rectangle to copy to, or 'Nothing' for the whole rendering target. The texture will be stretched to fill the given rectangle.
-       -> CDouble -- ^ The angle of rotation in degrees. The rotation will be performed clockwise.
-       -> Maybe (Point V2 CInt) -- ^ The point indicating the center of the rotation, or 'Nothing' to rotate around the center of the destination rectangle
-       -> V2 Bool -- ^ Whether to flip the texture on the X and/or Y axis
-       -> m ()
-copyEx (Renderer r) (Texture t) srcRect dstRect theta center flips =
-  liftIO $
-  throwIfNeg_ "SDL.Video.copyEx" "SDL_RenderCopyEx" $
-  maybeWith with srcRect $ \src ->
-  maybeWith with dstRect $ \dst ->
-  maybeWith with center $ \c ->
-  Raw.renderCopyEx r t (castPtr src) (castPtr dst) theta (castPtr c)
-                   (case flips of
-                      V2 x y -> (if x then Raw.SDL_FLIP_HORIZONTAL else 0) .|.
-                               (if y then Raw.SDL_FLIP_VERTICAL else 0))
-
--- | Draw a line on the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderDrawLine SDL_RenderDrawLine>@ for C documentation.
-drawLine :: (Functor m,MonadIO m)
-         => Renderer
-         -> Point V2 CInt -- ^ The start point of the line
-         -> Point V2 CInt -- ^ The end point of the line
-         -> m ()
-drawLine (Renderer r) (P (V2 x y)) (P (V2 x' y')) =
-  throwIfNeg_ "SDL.Video.drawLine" "SDL_RenderDrawLine" $
-  Raw.renderDrawLine r x y x' y'
-
--- | Draw a series of connected lines on the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderDrawLines SDL_RenderDrawLines>@ for C documentation.
-drawLines :: MonadIO m
-          => Renderer
-          -> SV.Vector (Point V2 CInt) -- ^ A 'SV.Vector' of points along the line. SDL will draw lines between these points.
-          -> m ()
-drawLines (Renderer r) points =
-  liftIO $
-  throwIfNeg_ "SDL.Video.drawLines" "SDL_RenderDrawLines" $
-  SV.unsafeWith points $ \cp ->
-    Raw.renderDrawLines r
-                        (castPtr cp)
-                        (fromIntegral (SV.length points))
-
--- | Draw a point on the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderDrawPoint SDL_RenderDrawPoint>@ for C documentation.
-drawPoint :: (Functor m, MonadIO m) => Renderer -> Point V2 CInt -> m ()
-drawPoint (Renderer r) (P (V2 x y)) =
-  throwIfNeg_ "SDL.Video.drawPoint" "SDL_RenderDrawPoint" $
-  Raw.renderDrawPoint r x y
-
--- | Draw multiple points on the current rendering target.
---
--- See @<https://wiki.libsdl.org/SDL_RenderDrawPoints SDL_RenderDrawPoints>@ for C documentation.
-drawPoints :: MonadIO m => Renderer -> SV.Vector (Point V2 CInt) -> m ()
-drawPoints (Renderer r) points =
-  liftIO $
-  throwIfNeg_ "SDL.Video.drawPoints" "SDL_RenderDrawPoints" $
-  SV.unsafeWith points $ \cp ->
-    Raw.renderDrawPoints r
-                         (castPtr cp)
-                         (fromIntegral (SV.length points))
-
--- | Copy an existing surface into a new one that is optimized for blitting to a surface of a specified pixel format.
---
--- This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.
---
--- See @<https://wiki.libsdl.org/SDL_ConvertSurface SDL_ConvertSurface>@ for C documentation.
-convertSurface :: (Functor m,MonadIO m)
-               => Surface -- ^ The 'Surface' to convert
-               -> SurfacePixelFormat -- ^ The pixel format that the new surface is optimized for
-               -> m Surface
-convertSurface (Surface s _) (SurfacePixelFormat fmt) =
-  fmap unmanagedSurface $
-  throwIfNull "SDL.Video.Renderer.convertSurface" "SDL_ConvertSurface" $
-  Raw.convertSurface s fmt 0
-
--- | Perform a scaled surface copy to a destination surface.
---
--- See @<https://wiki.libsdl.org/SDL_BlitScaled SDL_BlitScaled>@ for C documentation.
-surfaceBlitScaled :: MonadIO m
-                  => Surface -- ^ The 'Surface' to be copied from
-                  -> Maybe (Rectangle CInt) -- ^ The rectangle to be copied, or 'Nothing' to copy the entire surface
-                  -> Surface -- ^ The 'Surface' that is the blit target
-                  -> Maybe (Rectangle CInt) -- ^ The rectangle that is copied into, or 'Nothing' to copy into the entire surface
-                  -> m ()
-surfaceBlitScaled (Surface src _) srcRect (Surface dst _) dstRect =
-  liftIO $
-  throwIfNeg_ "SDL.Video.blitSurface" "SDL_BlitSurface" $
-  maybeWith with srcRect $ \srcPtr ->
-  maybeWith with dstRect $ \dstPtr ->
-  Raw.blitScaled src (castPtr srcPtr) dst (castPtr dstPtr)
-
--- | Get or set the color key (transparent pixel color) for a surface.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetColorKey SDL_SetColorKey>@ and @<https://wiki.libsdl.org/SDL_GetColorKey SDL_GetColorKey>@ for C documentation.
-surfaceColorKey :: Surface -> StateVar (Maybe (V4 Word8))
-surfaceColorKey (Surface s _) = makeStateVar getColorKey setColorKey
-  where
-  getColorKey =
-    liftIO $
-    alloca $ \keyPtr -> do
-      ret <- Raw.getColorKey s keyPtr
-      if ret == -1
-        then return Nothing
-        else do format <- liftIO (Raw.surfaceFormat <$> peek s)
-                mapped <- peek keyPtr
-                alloca $ \r ->
-                  alloca $ \g ->
-                  alloca $ \b ->
-                  alloca $ \a ->
-                    do Raw.getRGBA mapped format r g b a
-                       Just <$> (V4 <$> peek r <*> peek g <*> peek b <*> peek a)
-  setColorKey key =
-    liftIO $
-    throwIfNeg_ "SDL.Video.Renderer.setColorKey" "SDL_SetColorKey" $
-    case key of
-      Nothing ->
-        alloca $ \keyPtr -> do
-          -- TODO Error checking?
-          ret <- Raw.getColorKey s keyPtr
-          if ret == -1
-            -- if ret == -1 then there is no key enabled, so we have nothing to
-            -- do.
-            then return 0
-            else do key' <- peek keyPtr
-                    Raw.setColorKey s 0 key'
-
-      Just (V4 r g b a) -> do
-        format <- liftIO (Raw.surfaceFormat <$> peek s)
-        Raw.mapRGBA format r g b a >>= Raw.setColorKey s 1
-
--- | Get or set the additional color value multiplied into render copy operations.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetTextureColorMod SDL_SetTextureColorMod>@ and @<https://wiki.libsdl.org/SDL_GetTextureColorMod SDL_GetTextureColorMod>@ for C documentation.
-textureColorMod :: Texture -> StateVar (V3 Word8)
-textureColorMod (Texture t) = makeStateVar getTextureColorMod setTextureColorMod
-  where
-  getTextureColorMod = liftIO $
-    alloca $ \r ->
-    alloca $ \g ->
-    alloca $ \b -> do
-      throwIfNeg_ "SDL.Video.Renderer.getTextureColorMod" "SDL_GetTextureColorMod" $
-        Raw.getTextureColorMod t r g b
-      V3 <$> peek r <*> peek g <*> peek b
-
-  setTextureColorMod (V3 r g b) =
-    throwIfNeg_ "SDL.Video.Renderer.setTextureColorMod" "SDL_SetTextureColorMod" $
-    Raw.setTextureColorMod t r g b
-
-data PixelFormat
-  = Unknown
-  | Index1LSB
-  | Index1MSB
-  | Index4LSB
-  | Index4MSB
-  | Index8
-  | RGB332
-  | RGB444
-  | RGB555
-  | BGR555
-  | ARGB4444
-  | RGBA4444
-  | ABGR4444
-  | BGRA4444
-  | ARGB1555
-  | RGBA5551
-  | ABGR1555
-  | BGRA5551
-  | RGB565
-  | BGR565
-  | RGB24
-  | BGR24
-  | RGB888
-  | RGBX8888
-  | BGR888
-  | BGRX8888
-  | ARGB8888
-  | RGBA8888
-  | ABGR8888
-  | BGRA8888
-  | ARGB2101010
-  | YV12
-  | IYUV
-  | YUY2
-  | UYVY
-  | YVYU
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber PixelFormat Word32 where
-  fromNumber n' = case n' of
-    Raw.SDL_PIXELFORMAT_UNKNOWN -> Unknown
-    Raw.SDL_PIXELFORMAT_INDEX1LSB -> Index1LSB
-    Raw.SDL_PIXELFORMAT_INDEX1MSB -> Index1MSB
-    Raw.SDL_PIXELFORMAT_INDEX4LSB -> Index4LSB
-    Raw.SDL_PIXELFORMAT_INDEX4MSB -> Index4MSB
-    Raw.SDL_PIXELFORMAT_INDEX8 -> Index8
-    Raw.SDL_PIXELFORMAT_RGB332 -> RGB332
-    Raw.SDL_PIXELFORMAT_RGB444 -> RGB444
-    Raw.SDL_PIXELFORMAT_RGB555 -> RGB555
-    Raw.SDL_PIXELFORMAT_BGR555 -> BGR555
-    Raw.SDL_PIXELFORMAT_ARGB4444 -> ARGB4444
-    Raw.SDL_PIXELFORMAT_RGBA4444 -> RGBA4444
-    Raw.SDL_PIXELFORMAT_ABGR4444 -> ABGR4444
-    Raw.SDL_PIXELFORMAT_BGRA4444 -> BGRA4444
-    Raw.SDL_PIXELFORMAT_ARGB1555 -> ARGB1555
-    Raw.SDL_PIXELFORMAT_RGBA5551 -> RGBA5551
-    Raw.SDL_PIXELFORMAT_ABGR1555 -> ABGR1555
-    Raw.SDL_PIXELFORMAT_BGRA5551 -> BGRA5551
-    Raw.SDL_PIXELFORMAT_RGB565 -> RGB565
-    Raw.SDL_PIXELFORMAT_BGR565 -> BGR565
-    Raw.SDL_PIXELFORMAT_RGB24 -> RGB24
-    Raw.SDL_PIXELFORMAT_BGR24 -> BGR24
-    Raw.SDL_PIXELFORMAT_RGB888 -> RGB888
-    Raw.SDL_PIXELFORMAT_RGBX8888 -> RGBX8888
-    Raw.SDL_PIXELFORMAT_BGR888 -> BGR888
-    Raw.SDL_PIXELFORMAT_BGRX8888 -> BGRX8888
-    Raw.SDL_PIXELFORMAT_ARGB8888 -> ARGB8888
-    Raw.SDL_PIXELFORMAT_RGBA8888 -> RGBA8888
-    Raw.SDL_PIXELFORMAT_ABGR8888 -> ABGR8888
-    Raw.SDL_PIXELFORMAT_BGRA8888 -> BGRA8888
-    Raw.SDL_PIXELFORMAT_ARGB2101010 -> ARGB2101010
-    Raw.SDL_PIXELFORMAT_YV12 -> YV12
-    Raw.SDL_PIXELFORMAT_IYUV -> IYUV
-    Raw.SDL_PIXELFORMAT_YUY2 -> YUY2
-    Raw.SDL_PIXELFORMAT_UYVY -> UYVY
-    Raw.SDL_PIXELFORMAT_YVYU -> YVYU
-    _ -> error "fromNumber: not numbered"
-
-instance ToNumber PixelFormat Word32 where
-  toNumber pf = case pf of
-    Unknown -> Raw.SDL_PIXELFORMAT_UNKNOWN
-    Index1LSB -> Raw.SDL_PIXELFORMAT_INDEX1LSB
-    Index1MSB -> Raw.SDL_PIXELFORMAT_INDEX1MSB
-    Index4LSB -> Raw.SDL_PIXELFORMAT_INDEX4LSB
-    Index4MSB -> Raw.SDL_PIXELFORMAT_INDEX4MSB
-    Index8 -> Raw.SDL_PIXELFORMAT_INDEX8
-    RGB332 -> Raw.SDL_PIXELFORMAT_RGB332
-    RGB444 -> Raw.SDL_PIXELFORMAT_RGB444
-    RGB555 -> Raw.SDL_PIXELFORMAT_RGB555
-    BGR555 -> Raw.SDL_PIXELFORMAT_BGR555
-    ARGB4444 -> Raw.SDL_PIXELFORMAT_ARGB4444
-    RGBA4444 -> Raw.SDL_PIXELFORMAT_RGBA4444
-    ABGR4444 -> Raw.SDL_PIXELFORMAT_ABGR4444
-    BGRA4444 -> Raw.SDL_PIXELFORMAT_BGRA4444
-    ARGB1555 -> Raw.SDL_PIXELFORMAT_ARGB1555
-    RGBA5551 -> Raw.SDL_PIXELFORMAT_RGBA5551
-    ABGR1555 -> Raw.SDL_PIXELFORMAT_ABGR1555
-    BGRA5551 -> Raw.SDL_PIXELFORMAT_BGRA5551
-    RGB565 -> Raw.SDL_PIXELFORMAT_RGB565
-    BGR565 -> Raw.SDL_PIXELFORMAT_BGR565
-    RGB24 -> Raw.SDL_PIXELFORMAT_RGB24
-    BGR24 -> Raw.SDL_PIXELFORMAT_BGR24
-    RGB888 -> Raw.SDL_PIXELFORMAT_RGB888
-    RGBX8888 -> Raw.SDL_PIXELFORMAT_RGBX8888
-    BGR888 -> Raw.SDL_PIXELFORMAT_BGR888
-    BGRX8888 -> Raw.SDL_PIXELFORMAT_BGRX8888
-    ARGB8888 -> Raw.SDL_PIXELFORMAT_ARGB8888
-    RGBA8888 -> Raw.SDL_PIXELFORMAT_RGBA8888
-    ABGR8888 -> Raw.SDL_PIXELFORMAT_ABGR8888
-    BGRA8888 -> Raw.SDL_PIXELFORMAT_BGRA8888
-    ARGB2101010 -> Raw.SDL_PIXELFORMAT_ARGB2101010
-    YV12 -> Raw.SDL_PIXELFORMAT_YV12
-    IYUV -> Raw.SDL_PIXELFORMAT_IYUV
-    YUY2 -> Raw.SDL_PIXELFORMAT_YUY2
-    UYVY -> Raw.SDL_PIXELFORMAT_UYVY
-    YVYU -> Raw.SDL_PIXELFORMAT_YVYU
-
--- | Renderer acceleration mode
-data RendererType
-  = UnacceleratedRenderer
-    -- ^ The renderer does not use hardware acceleration
-  | AcceleratedRenderer
-    -- ^ The renderer uses hardware acceleration and refresh rate is ignored
-  | AcceleratedVSyncRenderer
-    -- ^ The renderer uses hardware acceleration and present is synchronized with the refresh rate
-  | SoftwareRenderer
-    -- ^ The renderer is a software fallback
-  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)
-
--- | The configuration data used when creating windows.
-data RendererConfig = RendererConfig
-  { rendererType  :: RendererType
-    -- ^ The renderer's acceleration mode
-  , rendererTargetTexture :: Bool
-    -- ^ The renderer supports rendering to texture
-  } deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)
-
-instance FromNumber RendererConfig Word32 where
-  fromNumber n = RendererConfig
-    { rendererType          = rendererType'
-                                (n .&. Raw.SDL_RENDERER_SOFTWARE /= 0)
-                                (n .&. Raw.SDL_RENDERER_ACCELERATED /= 0)
-                                (n .&. Raw.SDL_RENDERER_PRESENTVSYNC /= 0)
-    , rendererTargetTexture = n .&. Raw.SDL_RENDERER_TARGETTEXTURE /= 0
-    }
-    where
-      rendererType' s a v | s         = SoftwareRenderer
-                          | a && v    = AcceleratedVSyncRenderer
-                          | a         = AcceleratedRenderer
-                          | otherwise = UnacceleratedRenderer
-
-instance ToNumber RendererConfig Word32 where
-  toNumber config = foldr (.|.) 0
-    [ if isSoftware then Raw.SDL_RENDERER_SOFTWARE else 0
-    , if not isSoftware then Raw.SDL_RENDERER_ACCELERATED else 0
-    , if rendererType config == AcceleratedVSyncRenderer then Raw.SDL_RENDERER_PRESENTVSYNC  else 0
-    , if rendererTargetTexture config then Raw.SDL_RENDERER_TARGETTEXTURE else 0
-    ]
-    where
-      isSoftware = rendererType config == SoftwareRenderer
-
--- | Default options for 'RendererConfig'.
---
--- @
--- 'defaultRenderer' = 'RendererConfig'
---   { 'rendererType'          = 'AcceleratedRenderer'
---   , 'rendererTargetTexture' = False
---   }
--- @
-defaultRenderer :: RendererConfig
-defaultRenderer = RendererConfig
-  { rendererType          = AcceleratedRenderer
-  , rendererTargetTexture = False
-  }
-
--- | Information about an instantiated 'Renderer'.
-data RendererInfo = RendererInfo
-  { rendererInfoName              :: Text
-    -- ^ The name of the renderer
-  , rendererInfoFlags             :: RendererConfig
-    -- ^ Supported renderer features
-  , rendererInfoNumTextureFormats :: Word32
-    -- ^ The number of available texture formats
-  , rendererInfoTextureFormats    :: [PixelFormat]
-    -- ^ The available texture formats
-  , rendererInfoMaxTextureWidth   :: CInt
-    -- ^ The maximum texture width
-  , rendererInfoMaxTextureHeight  :: CInt
-    -- ^ The maximum texture height
-  } deriving (Eq, Generic, Ord, Read, Show, Typeable)
-
-fromRawRendererInfo :: MonadIO m => Raw.RendererInfo -> m RendererInfo
-fromRawRendererInfo (Raw.RendererInfo name flgs ntf tfs mtw mth) = liftIO $ do
-    name' <- Text.decodeUtf8 <$> BS.packCString name
-    return $ RendererInfo name' (fromNumber flgs) ntf (fmap fromNumber tfs) mtw mth
-
--- | Get information about a rendering context.
---
--- See @<https://wiki.libsdl.org/SDL_GetRendererInfo SDL_GetRendererInfo>@ for C documentation.
-getRendererInfo :: MonadIO m => Renderer -> m RendererInfo
-getRendererInfo (Renderer renderer) = liftIO $
-  alloca $ \rptr -> do
-    throwIfNeg_ "getRendererInfo" "SDL_GetRendererInfo" $
-      Raw.getRendererInfo renderer rptr
-    peek rptr >>= fromRawRendererInfo
-
--- | Enumerate all known render drivers on the system, and determine their supported features.
---
--- See @<https://wiki.libsdl.org/SDL_GetRenderDriverInfo SDL_GetRenderDriverInfo>@ for C documentation.
-getRenderDriverInfo :: MonadIO m => m [RendererInfo]
-getRenderDriverInfo = liftIO $ do
-  count <- Raw.getNumRenderDrivers
-  traverse go [0..count-1]
-  where
-    go idx = alloca $ \rptr -> do
-               throwIfNeg_ "getRenderDriverInfo" "SDL_GetRenderDriverInfo" $
-                 Raw.getRenderDriverInfo idx rptr
-               peek rptr >>= fromRawRendererInfo
-
--- | Get or set the additional alpha value multiplied into render copy operations.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetTextureAlphaMod SDL_SetTextureAlphaMod>@ and @<https://wiki.libsdl.org/SDL_GetTextureAlphaMod SDL_GetTextureAlphaMod>@ for C documentation.
-textureAlphaMod :: Texture -> StateVar Word8
-textureAlphaMod (Texture t) = makeStateVar getTextureAlphaMod setTextureAlphaMod
-  where
-  getTextureAlphaMod = liftIO $
-    alloca $ \x -> do
-      throwIfNeg_ "SDL.Video.Renderer.getTextureAlphaMod" "SDL_GetTextureAlphaMod" $
-        Raw.getTextureAlphaMod t x
-      peek x
-
-  setTextureAlphaMod alpha =
-    throwIfNeg_ "SDL.Video.Renderer.setTextureAlphaMod" "SDL_SetTextureAlphaMod" $
-      Raw.setTextureAlphaMod t alpha
-
--- | Get or set the blend mode used for texture copy operations.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetTextureBlendMode SDL_SetTextureBlendMode>@ and @<https://wiki.libsdl.org/SDL_GetTextureBlendMode SDL_GetTextureBlendMode>@ for C documentation.
-textureBlendMode :: Texture -> StateVar BlendMode
-textureBlendMode (Texture t) = makeStateVar getTextureBlendMode setTextureBlendMode
-  where
-  getTextureBlendMode = liftIO $
-    alloca $ \x -> do
-      throwIfNeg_ "SDL.Video.Renderer.getTextureBlendMode" "SDL_GetTextureBlendMode" $
-        Raw.getTextureBlendMode t x
-      fromNumber <$> peek x
-
-  setTextureBlendMode bm =
-    throwIfNeg_ "SDL.Video.Renderer.setTextureBlendMode" "SDL_SetTextureBlendMode" $
-    Raw.setTextureBlendMode t (toNumber bm)
-
--- | Get or set the blend mode used for blit operations.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetSurfaceBlendMode SDL_SetSurfaceBlendMode>@ and @<https://wiki.libsdl.org/SDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode>@ for C documentation.
-surfaceBlendMode :: Surface -> StateVar BlendMode
-surfaceBlendMode (Surface s _) = makeStateVar getSurfaceBlendMode setSurfaceBlendMode
-  where
-  getSurfaceBlendMode = liftIO $
-    alloca $ \x -> do
-      throwIfNeg_ "SDL.Video.Renderer.getSurfaceBlendMode" "SDL_GetSurfaceBlendMode" $
-        Raw.getSurfaceBlendMode s x
-      fromNumber <$> peek x
-
-  setSurfaceBlendMode bm =
-    throwIfNeg_ "SDL.Video.Renderer.setSurfaceBlendMode" "SDL_SetSurfaceBlendMode" $
-    Raw.setSurfaceBlendMode s (toNumber bm)
-
--- | Get or set the current render target. 'Nothing' corresponds to the default render target.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_SetRenderTarget SDL_SetRenderTarget>@ and @<https://wiki.libsdl.org/SDL_GetRenderTarget SDL_GetRenderTarget>@ for C documentation.
-rendererRenderTarget :: Renderer -> StateVar (Maybe Texture)
-rendererRenderTarget (Renderer r) = makeStateVar getRenderTarget setRenderTarget
-  where
-  getRenderTarget = do
-    t <- Raw.getRenderTarget r
-    return $
-      if t == nullPtr
-        then Nothing
-        else Just (Texture t)
-
-  setRenderTarget texture =
-    throwIfNeg_ "SDL.Video.Renderer.setRenderTarget" "SDL_SetRenderTarget" $
-    case texture of
-      Nothing -> Raw.setRenderTarget r nullPtr
-      Just (Texture t) -> Raw.setRenderTarget r t
-
--- | Get or set the device independent resolution for rendering.
---
--- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.
---
--- See @<https://wiki.libsdl.org/SDL_RenderSetLogicalSize SDL_RenderSetLogicalSize>@ and @<https://wiki.libsdl.org/SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize>@ for C documentation.
-rendererLogicalSize :: Renderer -> StateVar (Maybe (V2 CInt))
-rendererLogicalSize (Renderer r) = makeStateVar renderGetLogicalSize renderSetLogicalSize
-  where
-  renderGetLogicalSize = liftIO $
-    alloca $ \w -> do
-    alloca $ \h -> do
-      Raw.renderGetLogicalSize r w h
-      v <- V2 <$> peek w <*> peek h
-      return $ if v == 0 then Nothing else Just v
-
-  renderSetLogicalSize v =
-    throwIfNeg_ "SDL.Video.renderSetLogicalSize" "SDL_RenderSetLogicalSize" $ do
-      let (x,y) = case v of Just (V2 vx vy) -> (vx, vy)
-                            Nothing -> (0,0)
-      Raw.renderSetLogicalSize r x y
-
--- | Determine whether a window supports the use of render targets.
---
--- See @<https://wiki.libsdl.org/SDL_RenderTargetSupported SDL_RenderTargetSupported>@ for C documentation.
-renderTargetSupported :: (MonadIO m) => Renderer -> m Bool
-renderTargetSupported (Renderer r) = Raw.renderTargetSupported r
-
--- | Convert the given the enumerated pixel format to a bpp value and RGBA masks.
---
--- See @<https://wiki.libsdl.org/SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks>@ for C documentation.
-pixelFormatToMasks :: (MonadIO m) => PixelFormat -> m (CInt, V4 Word32)
-pixelFormatToMasks pf = liftIO $
-  alloca $ \bpp ->
-  alloca $ \r ->
-  alloca $ \g ->
-  alloca $ \b ->
-  alloca $ \a -> do
-    throwIf_ not "SDL.Video.pixelFormatEnumToMasks" "SDL_PixelFormatEnumToMasks" $
-      Raw.pixelFormatEnumToMasks (toNumber pf) bpp r g b a
-    wrap <$> peek bpp <*> peek r <*> peek g <*> peek b <*> peek a
-    where
-      wrap bpp r g b a = (bpp, V4 r g b a)
-
--- | Convert a bpp value and RGBA masks to an enumerated pixel format.
---
--- See @<https://wiki.libsdl.org/SDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum>@ for C documentation.
-masksToPixelFormat :: (MonadIO m) => CInt -> V4 Word32 -> m PixelFormat
-masksToPixelFormat bpp (V4 r g b a) = liftIO $
-  fromNumber <$> Raw.masksToPixelFormatEnum bpp r g b a
+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PatternSynonyms #-}++-- | "SDL.Video.Renderer" provides a high-level interface to SDL's accelerated 2D rendering library.++module SDL.Video.Renderer+  ( Renderer++    -- * 'Renderer' Configuration+    -- | These configuration options can be used with 'SDL.Video.createRenderer' to create 'Renderer's.+  , RendererConfig(..)+  , defaultRenderer+  , RendererType(..)++  -- * Drawing Primitives+  , clear+  , copy+  , copyEx+  , drawLine+  , drawLines+  , drawPoint+  , drawPoints+  , drawRect+  , drawRects+  , fillRect+  , fillRects+  , present++  -- * 'Renderer' State+  -- | SDL exposes a stateful interface to 'Renderer's - the above primitives drawing routines will change their+  -- output depending on the value of these state variables.+  , rendererDrawBlendMode+  , rendererDrawColor+  , rendererRenderTarget+  , rendererClipRect+  , rendererLogicalSize+  , rendererScale+  , rendererViewport+  , renderTargetSupported++  -- * 'Surface's+  , Surface(..)+  , updateWindowSurface+  , surfaceBlit+  , surfaceBlitScaled+  , surfaceFillRect+  , surfaceFillRects++  -- ** Creating and Destroying 'Surface's+  , convertSurface+  , createRGBSurface+  , createRGBSurfaceFrom+  , freeSurface+  , getWindowSurface+  , loadBMP++  -- ** 'Surface' state+  , surfaceColorKey+  , surfaceBlendMode+  , surfaceDimensions+  , surfaceFormat+  , surfacePixels++  -- ** Accessing 'Surface' Data+  , lockSurface+  , unlockSurface++  -- * 'Palette's and pixel formats+  , Palette+  , paletteNColors+  , paletteColors+  , paletteColor+  , PixelFormat(..)+  , SurfacePixelFormat+  , formatPalette+  , setPaletteColors+  , pixelFormatToMasks+  , masksToPixelFormat++  -- * Textures+  , Texture++  -- ** Creating, Using and Destroying 'Texture's+  , createTexture+  , TextureAccess(..)+  , createTextureFromSurface+  , updateTexture+  , destroyTexture+  , glBindTexture+  , glUnbindTexture++  -- ** 'Texture' State+  , textureAlphaMod+  , textureBlendMode+  , BlendMode(..)+  , textureColorMod++  -- ** Accessing 'Texture' Data+  , lockTexture+  , unlockTexture+  , queryTexture+  , TextureInfo(..)++  , Rectangle(..)++  -- * Available 'Renderer's+  -- | These functions allow you to query the current system for available 'Renderer's that can be created+  -- with 'SDL.Video.createRenderer'.+  , getRendererInfo+  , RendererInfo(..)+  , getRenderDriverInfo+  ) where++import Control.Monad.IO.Class (MonadIO, liftIO)+import Data.Bits+import Data.Data (Data)+import Data.Foldable+import Data.StateVar+import Data.Text (Text)+import Data.Typeable+import Data.Word+import Foreign.C.String+import Foreign.C.Types+import Foreign.ForeignPtr+import Foreign.Marshal.Alloc+import Foreign.Marshal.Utils+import Foreign.Ptr+import Foreign.Storable+import GHC.Generics (Generic)+import Prelude hiding (foldr)+import SDL.Vect+import SDL.Internal.Exception+import SDL.Internal.Numbered+import SDL.Internal.Types+import qualified Data.ByteString as BS+import qualified Data.ByteString.Internal as BSI+import qualified Data.Text.Encoding as Text+import qualified Data.Vector.Storable as SV+import qualified Data.Vector.Storable.Mutable as MSV+import qualified SDL.Raw as Raw++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative+import Data.Traversable+#endif++-- | Perform a fast surface copy to a destination surface.+--+-- See @<https://wiki.libsdl.org/SDL_BlitSurface SDL_BlitSurface>@ for C documentation.+surfaceBlit :: MonadIO m+            => Surface -- ^ The 'Surface' to be copied from+            -> Maybe (Rectangle CInt) -- ^ The rectangle to be copied, or 'Nothing' to copy the entire surface+            -> Surface -- ^ The 'Surface' that is the blit target+            -> Maybe (Point V2 CInt) -- ^ The position to blit to+            -> m (Maybe (Rectangle CInt))+surfaceBlit (Surface src _) srcRect (Surface dst _) dstLoc = liftIO $+  maybeWith with srcRect $ \srcPtr ->+  maybeWith with (fmap (flip Rectangle 0) dstLoc) $ \dstPtr -> do+      _ <- throwIfNeg "SDL.Video.blitSurface" "SDL_BlitSurface" $+           Raw.blitSurface src (castPtr srcPtr) dst (castPtr dstPtr)+      maybe (pure Nothing) (\_ -> Just <$> peek dstPtr) dstLoc++-- | Create a texture for a rendering context.+--+-- See @<https://wiki.libsdl.org/SDL_CreateTexture SDL_CreateTexture>@ for C documentation.+createTexture :: (Functor m,MonadIO m)+              => Renderer -- ^ The rendering context.+              -> PixelFormat+              -> TextureAccess+              -> V2 CInt -- ^ The size of the texture.+              -> m Texture+createTexture (Renderer r) fmt access (V2 w h) =+  fmap Texture $+  throwIfNull "SDL.Video.Renderer.createTexture" "SDL_CreateTexture" $+  Raw.createTexture r (toNumber fmt) (toNumber access) w h++-- | Create a texture from an existing surface.+--+-- See @<https://wiki.libsdl.org/SDL_CreateTextureFromSurface SDL_CreateTextureFromSurface>@ for C documentation.+createTextureFromSurface :: (Functor m,MonadIO m)+                         => Renderer -- ^ The rendering context+                         -> Surface -- ^ The surface containing pixel data used to fill the texture+                         -> m Texture+createTextureFromSurface (Renderer r) (Surface s _) =+  fmap Texture $+  throwIfNull "SDL.Video.createTextureFromSurface" "SDL_CreateTextureFromSurface" $+  Raw.createTextureFromSurface r s++-- | Bind an OpenGL\/ES\/ES2 texture to the current context for use with when rendering OpenGL primitives directly.+--+-- See @<https://wiki.libsdl.org/SDL_GL_BindTexture SDL_GL_BindTexture>@ for C documentation.+glBindTexture :: (Functor m,MonadIO m)+              => Texture -- ^ The texture to bind to the current OpenGL\/ES\/ES2 context+              -> m ()+glBindTexture (Texture t) =+  throwIfNeg_ "SDL.Video.Renderer.glBindTexture" "SDL_GL_BindTexture" $+  Raw.glBindTexture t nullPtr nullPtr++-- | Unbind an OpenGL\/ES\/ES2 texture from the current context.+--+-- See @<https://wiki.libsdl.org/SDL_GL_UnbindTexture SDL_GL_UnbindTexture>@ for C documentation.+glUnbindTexture :: (Functor m,MonadIO m)+                => Texture -- ^ The texture to unbind from the current OpenGL\/ES\/ES2 context+                -> m ()+glUnbindTexture (Texture t) =+  throwIfNeg_ "SDL.Video.Renderer.glUnindTexture" "SDL_GL_UnbindTexture" $+  Raw.glUnbindTexture t++-- | Updates texture rectangle with new pixel data.+--+-- See @<https://wiki.libsdl.org/SDL_UpdateTexture SDL_UpdateTexture>@ for C documentation.+updateTexture :: (Functor m, MonadIO m)+              => Texture -- ^ The 'Texture' to be updated+              -> Maybe (Rectangle CInt) -- ^ The area to update, Nothing for entire texture+              -> BS.ByteString -- ^ The raw pixel data+              -> CInt -- ^ The number of bytes in a row of pixel data, including padding between lines+              -> m Texture+updateTexture tex@(Texture t) rect pixels pitch = do+  liftIO $ throwIfNeg_ "SDL.Video.updateTexture" "SDL_UpdateTexture" $+    maybeWith with rect $ \rectPtr ->+      let (pixelForeign, _, _) = BSI.toForeignPtr pixels+      in withForeignPtr pixelForeign $ \pixelsPtr ->+        Raw.updateTexture t (castPtr rectPtr) (castPtr pixelsPtr) pitch+  return tex++-- | Destroy the specified texture.+--+-- See @<https://wiki.libsdl.org/SDL_DestroyTexture SDL_DestroyTexture>@ for the C documentation.+destroyTexture :: MonadIO m => Texture -> m ()+destroyTexture (Texture t) = Raw.destroyTexture t++-- | Lock a portion of the texture for *write-only* pixel access.+--+-- See @<https://wiki.libsdl.org/SDL_LockTexture SDL_LockTexture>@ for C documentation.+lockTexture :: MonadIO m+            => Texture -- ^ The 'Texture' to lock for access, which must have been created with 'TextureAccessStreaming'+            -> Maybe (Rectangle CInt) -- ^ The area to lock for access; 'Nothing' to lock the entire texture+            -> m (Ptr (),CInt) -- ^ A pointer to the locked pixels, appropriately offset by the locked area, and the pitch of the locked pixels (the pitch is the length of one row in bytes).+lockTexture (Texture t) rect = liftIO $+  alloca $ \pixelsPtr ->+  alloca $ \pitchPtr ->+  maybeWith with rect $ \rectPtr -> do+    throwIfNeg_ "lockTexture" "SDL_LockTexture" $+      Raw.lockTexture t (castPtr rectPtr) pixelsPtr pitchPtr+    pixels <- peek pixelsPtr+    pitch <- peek pitchPtr+    return (pixels, pitch)++-- | Unlock a texture, uploading the changes to video memory, if needed.+--+-- /Warning/: See <https://bugzilla.libsdl.org/show_bug.cgi?id=1586 Bug No. 1586> before using this function!+--+-- See @<https://wiki.libsdl.org/SDL_UnlockTexture SDL_UnlockTexture>@ for C documentation.+unlockTexture :: MonadIO m => Texture -> m ()+unlockTexture (Texture t) = Raw.unlockTexture t++-- | Set up a surface for directly accessing the pixels.+--+-- See @<https://wiki.libsdl.org/SDL_LockSurface SDL_LockSurface>@ for C documentation.+lockSurface :: MonadIO m => Surface -> m ()+lockSurface (Surface s _) =+  throwIfNeg_ "lockSurface" "SDL_LockSurface" $+    Raw.lockSurface s++-- | Release a surface after directly accessing the pixels.+--+-- See @<https://wiki.libsdl.org/SDL_UnlockSurface SDL_UnlockSurface>@ for C documentation.+unlockSurface :: MonadIO m => Surface -> m ()+unlockSurface (Surface s _) = Raw.unlockSurface s++-- | Information to the GPU about how you will use a texture.+data TextureAccess+  = TextureAccessStatic+    -- ^ Changes rarely, cannot be locked+  | TextureAccessStreaming+    -- ^ changes frequently, can be locked+  | TextureAccessTarget+    -- ^ Can be used as a render target+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber TextureAccess CInt where+  fromNumber n' = case n' of+    Raw.SDL_TEXTUREACCESS_STATIC -> TextureAccessStatic+    Raw.SDL_TEXTUREACCESS_STREAMING -> TextureAccessStreaming+    Raw.SDL_TEXTUREACCESS_TARGET -> TextureAccessTarget+    _ -> error "Unknown value"++instance ToNumber TextureAccess CInt where+  toNumber t = case t of+    TextureAccessStatic -> Raw.SDL_TEXTUREACCESS_STATIC+    TextureAccessStreaming -> Raw.SDL_TEXTUREACCESS_STREAMING+    TextureAccessTarget -> Raw.SDL_TEXTUREACCESS_TARGET++data TextureInfo = TextureInfo+  { texturePixelFormat :: PixelFormat+    -- ^ Raw format of the texture; the actual format may differ, but pixel transfers will use this format+  , textureAccess      :: TextureAccess+    -- ^ The access available to the texture+  , textureWidth       :: CInt+    -- ^ The width of the texture+  , textureHeight      :: CInt+    -- ^ The height of the texture+  } deriving (Eq, Generic, Ord, Read, Show, Typeable)++-- | Query the attributes of a texture.+--+-- See @<https://wiki.libsdl.org/SDL_QueryTexture SDL_QueryTexture>@ for C documentation.+queryTexture :: MonadIO m => Texture -> m TextureInfo+queryTexture (Texture tex) = liftIO $+  alloca $ \pfPtr ->+  alloca $ \acPtr ->+  alloca $ \wPtr ->+  alloca $ \hPtr -> do+    throwIfNeg_ "SDL.Video.queryTexture" "SDL_QueryTexture" $+      Raw.queryTexture tex pfPtr acPtr wPtr hPtr+    TextureInfo <$>+      fmap fromNumber (peek pfPtr) <*>+      fmap fromNumber (peek acPtr) <*>+      peek wPtr <*>+      peek hPtr++-- | Allocate a new RGB surface.+--+-- See @<https://wiki.libsdl.org/SDL_CreateRGBSurface SDL_CreateRGBSurface>@ for C documentation.+createRGBSurface :: (Functor m, MonadIO m)+                 => V2 CInt -- ^ The size of the surface+                 -> PixelFormat -- ^ The bit depth, red, green, blue and alpha mask for the pixels+                 -> m Surface+createRGBSurface (V2 w h) pf =+  fmap unmanagedSurface $+    throwIfNull "SDL.Video.createRGBSurface" "SDL_CreateRGBSurface" $ do+      (bpp, V4 r g b a) <- pixelFormatToMasks pf+      Raw.createRGBSurface 0 w h bpp r g b a++-- | Allocate a new RGB surface with existing pixel data.+--+-- See @<https://wiki.libsdl.org/SDL_CreateRGBSurfaceFrom SDL_CreateRGBSurfaceFrom>@ for C documentation.+createRGBSurfaceFrom :: (Functor m, MonadIO m)+                     => MSV.IOVector Word8 -- ^ The existing pixel data+                     -> V2 CInt -- ^ The size of the surface+                     -> CInt -- ^ The pitch - the length of a row of pixels in bytes+                     -> PixelFormat -- ^ The bit depth, red, green, blue and alpha mask for the pixels+                     -> m Surface+createRGBSurfaceFrom pixels (V2 w h) p pf = liftIO $+  fmap (managedSurface pixels) $+    throwIfNull "SDL.Video.createRGBSurfaceFrom" "SDL_CreateRGBSurfaceFrom" $ do+      (bpp, V4 r g b a) <- pixelFormatToMasks pf+      MSV.unsafeWith pixels $ \pixelPtr ->+        Raw.createRGBSurfaceFrom (castPtr pixelPtr) w h bpp p r g b a++-- | Perform a fast fill of a rectangle with a specific color.+--+-- If there is a clip rectangle set on the destination (set via 'clipRect'), then this function will fill based on the intersection of the clip rectangle and the given 'Rectangle'.+--+-- See @<https://wiki.libsdl.org/SDL_FillRect SDL_FillRect>@ for C documentation.+surfaceFillRect :: MonadIO m+                => Surface -- ^ The 'Surface' that is the drawing target.+                -> Maybe (Rectangle CInt) -- ^ The rectangle to fill, or 'Nothing' to fill the entire surface.+                -> V4 Word8 -- ^ The color to fill with. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place. This colour will be implictly mapped to the closest approximation that matches the surface's pixel format.+                -> m ()+surfaceFillRect (Surface s _) rect (V4 r g b a) = liftIO $+  throwIfNeg_ "SDL.Video.fillRect" "SDL_FillRect" $+  maybeWith with rect $ \rectPtr -> do+    format <- Raw.surfaceFormat <$> peek s+    Raw.mapRGBA format r g b a >>= Raw.fillRect s (castPtr rectPtr)++-- | Perform a fast fill of a set of rectangles with a specific color.+--+-- If there is a clip rectangle set on any of the destinations (set via 'clipRect'), then this function will fill based on the intersection of the clip rectangle and the given 'Rectangle's.+--+-- See @<https://wiki.libsdl.org/SDL_FillRect SDL_FillRects>@ for C documentation.+surfaceFillRects :: MonadIO m+                 => Surface -- ^ The 'Surface' that is the drawing target.+                 -> SV.Vector (Rectangle CInt) -- ^ A 'SV.Vector' of 'Rectangle's to be filled.+                 -> V4 Word8 -- ^ The color to fill with. If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place. This colour will be implictly mapped to the closest approximation that matches the surface's pixel format.+                 -> m ()+surfaceFillRects (Surface s _) rects (V4 r g b a) = liftIO $ do+  throwIfNeg_ "SDL.Video.fillRects" "SDL_FillRects" $+    SV.unsafeWith rects $ \rp -> do+      format <- Raw.surfaceFormat <$> peek s+      Raw.fillRects s+                    (castPtr rp)+                    (fromIntegral (SV.length rects))+                    =<< Raw.mapRGBA format r g b a++-- | Free an RGB surface.+--+-- If the surface was created using 'createRGBSurfaceFrom' then the pixel data is not freed.+--+-- See @<https://wiki.libsdl.org/SDL_FreeSurface SDL_FreeSurface>@ for the C documentation.+freeSurface :: MonadIO m => Surface -> m ()+freeSurface (Surface s _) = Raw.freeSurface s++-- | Load a surface from a BMP file.+--+-- See @<https://wiki.libsdl.org/SDL_LoadBMP SDL_LoadBMP>@ for C documentation.+loadBMP :: MonadIO m => FilePath -> m Surface+loadBMP filePath = liftIO $+  fmap unmanagedSurface $+  throwIfNull "SDL.Video.loadBMP" "SDL_LoadBMP" $+  withCString filePath $ Raw.loadBMP++newtype SurfacePixelFormat = SurfacePixelFormat (Ptr Raw.PixelFormat)+  deriving (Eq, Typeable)++-- It's possible we could use unsafePerformIO here, but I'm not+-- sure. surface->{w,h} are immutable, but do we need to guarantee that pointers+-- aren't reused by *different* surfaces.+-- | Retrive the width and height of a 'Surface'.+surfaceDimensions :: MonadIO m => Surface -> m (V2 CInt)+surfaceDimensions (Surface s _) = liftIO $ (V2 <$> Raw.surfaceW <*> Raw.surfaceH) <$> peek s++-- | Obtain the pointer to the underlying pixels in a surface. You should bracket+-- this call with 'lockSurface' and 'unlockSurface', respectively.+surfacePixels :: MonadIO m => Surface -> m (Ptr ())+surfacePixels (Surface s _) = liftIO $ Raw.surfacePixels <$> peek s++-- It's possible we could use unsafePerformIO here, but I'm not+-- sure. surface->format is immutable, but do we need to guarantee that pointers+-- aren't reused by *different* surfaces?+-- | Inspect the pixel format under a surface.+surfaceFormat :: MonadIO m => Surface -> m SurfacePixelFormat+surfaceFormat (Surface s _) = liftIO $ SurfacePixelFormat . Raw.surfaceFormat <$> peek s++newtype Palette = Palette (Ptr Raw.Palette)+  deriving (Eq, Typeable)++formatPalette :: MonadIO m => SurfacePixelFormat -> m (Maybe Palette)+formatPalette (SurfacePixelFormat f) = liftIO $ wrap . Raw.pixelFormatPalette <$> peek f+  where wrap p+          | p == nullPtr = Nothing+          | otherwise = Just (Palette p)++paletteNColors :: MonadIO m => Palette -> m CInt+paletteNColors (Palette p) = liftIO $ Raw.paletteNColors <$> peek p++paletteColors :: MonadIO m => Palette -> m (Maybe (SV.Vector (V4 Word8)))+paletteColors q@(Palette p) = do+  n <- liftIO $ fromIntegral <$> paletteNColors q+  let wrap p' | p' == nullPtr = Nothing+              | otherwise     = return p'+  mv <- liftIO $ wrap . castPtr . Raw.paletteColors <$> peek p+  mColor <- liftIO $ traverse newForeignPtr_ mv+  return $ flip SV.unsafeFromForeignPtr0 n <$> mColor++paletteColor :: MonadIO m => Palette -> CInt -> m (Maybe (V4 Word8))+paletteColor q@(Palette p) i = do+    rp <- liftIO $ peek p+    m <- paletteNColors q+    if m > i && i >= 0 then+      liftIO $ fmap return . flip peekElemOff (fromIntegral i) . castPtr . Raw.paletteColors $ rp+    else+      return Nothing++-- | Set a range of colors in a palette.+--+-- See @<https://wiki.libsdl.org/SDL_SetPaletteColors SDL_SetPaletteColors>@ for C documentation.+setPaletteColors :: MonadIO m+                 => Palette -- ^ The 'Palette' to modify+                 -> (SV.Vector (V4 Word8)) -- ^ A 'SV.Vector' of colours to copy into the palette+                 -> CInt -- ^ The index of the first palette entry to modify+                 -> m ()+setPaletteColors (Palette p) colors first = liftIO $+  throwIfNeg_ "SDL.Video.setPaletteColors" "SDL_SetPaletteColors" $+  SV.unsafeWith colors $ \cp ->+    Raw.setPaletteColors p (castPtr cp) first n+  where+    n = fromIntegral $ SV.length colors++-- | Get the SDL surface associated with the window.+--+-- See @<https://wiki.libsdl.org/SDL_GetWindowSurface SDL_GetWindowSurface>@ for C documentation.+getWindowSurface :: (Functor m, MonadIO m) => Window -> m Surface+getWindowSurface (Window w) =+  fmap unmanagedSurface $+  throwIfNull "SDL.Video.getWindowSurface" "SDL_GetWindowSurface" $+  Raw.getWindowSurface w++-- | Get or set the blend mode used for drawing operations (fill and line).+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode SDL_SetRenderDrawBlendMode>@ and @<https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode SDL_GetRenderDrawBlendMode>@ for C documentation.+rendererDrawBlendMode :: Renderer -> StateVar BlendMode+rendererDrawBlendMode (Renderer r) = makeStateVar getRenderDrawBlendMode setRenderDrawBlendMode+  where+  getRenderDrawBlendMode = liftIO $+    alloca $ \bmPtr -> do+      throwIfNeg_ "SDL.Video.Renderer.getRenderDrawBlendMode" "SDL_GetRenderDrawBlendMode" $+        Raw.getRenderDrawBlendMode r bmPtr+      fromNumber <$> peek bmPtr++  setRenderDrawBlendMode bm =+    throwIfNeg_ "SDL.Video.Renderer.setRenderDrawBlendMode" "SDL_SetRenderDrawBlendMode" $+    Raw.setRenderDrawBlendMode r (toNumber bm)++-- | Get or set the color used for drawing operations (rect, line and clear).+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetRenderDrawColor SDL_SetRenderDrawColor>@ and @<https://wiki.libsdl.org/SDL_GetRenderDrawColor SDL_GetRenderDrawColor>@ for C documentation.+rendererDrawColor :: Renderer -> StateVar (V4 Word8)+rendererDrawColor (Renderer re) = makeStateVar getRenderDrawColor setRenderDrawColor+  where+  getRenderDrawColor = liftIO $+    alloca $ \r ->+    alloca $ \g ->+    alloca $ \b ->+    alloca $ \a -> do+      throwIfNeg_ "SDL.Video.Renderer.getRenderDrawColor" "SDL_GetRenderDrawColor" $+        Raw.getRenderDrawColor re r g b a+      V4 <$> peek r <*> peek g <*> peek b <*> peek a++  setRenderDrawColor (V4 r g b a) =+    throwIfNeg_ "SDL.Video.setRenderDrawColor" "SDL_SetRenderDrawColor" $+    Raw.setRenderDrawColor re r g b a++-- | Copy the window surface to the screen.+--+-- This is the function you use to reflect any changes to the surface on the screen.+--+-- See @<https://wiki.libsdl.org/SDL_UpdateWindowSurface SDL_UpdateWindowSurface>@ for C documentation.+updateWindowSurface :: (Functor m, MonadIO m) => Window -> m ()+updateWindowSurface (Window w) =+  throwIfNeg_ "SDL.Video.updateWindowSurface" "SDL_UpdateWindowSurface" $+    Raw.updateWindowSurface w++-- | Blend modes used in 'copy' and drawing operations.+data BlendMode+  = BlendNone+    -- ^ No blending+  | BlendAlphaBlend+    -- ^ Alpha blending.+    --+    -- @+    -- dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))+    -- dstA = srcA + (dstA * (1-srcA))+    -- @+  | BlendAdditive+    -- ^ Additive blending+    --+    -- @+    -- dstRGB = (srcRGB * srcA) + dstRGB+    -- dstA = dstA+    -- @+  | BlendMod+    -- ^ Color modulate+    --+    -- @+    -- dstRGB = srcRGB * dstRGB+    -- dstA = dstA+    --+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber BlendMode Word32 where+  fromNumber n = case n of+    Raw.SDL_BLENDMODE_ADD -> BlendAdditive+    Raw.SDL_BLENDMODE_BLEND -> BlendAlphaBlend+    Raw.SDL_BLENDMODE_NONE -> BlendNone+    Raw.SDL_BLENDMODE_MOD -> BlendMod+    _ -> error $ "fromNumber<BlendMode>: unknown blend mode: " ++ show n++instance ToNumber BlendMode Word32 where+  toNumber BlendNone = Raw.SDL_BLENDMODE_NONE+  toNumber BlendAlphaBlend = Raw.SDL_BLENDMODE_BLEND+  toNumber BlendAdditive = Raw.SDL_BLENDMODE_ADD+  toNumber BlendMod = Raw.SDL_BLENDMODE_MOD++data Rectangle a = Rectangle (Point V2 a) (V2 a)+  deriving (Eq, Functor, Generic, Ord, Read, Show, Typeable)++instance Storable a => Storable (Rectangle a) where+  sizeOf ~(Rectangle o s) = sizeOf o + sizeOf s+  alignment _ = 0+  peek ptr = do+    o <- peek (castPtr ptr)+    s <- peek (castPtr (ptr `plusPtr` sizeOf o))+    return (Rectangle o s)+  poke ptr (Rectangle o s) = do+    poke (castPtr ptr) o+    poke (castPtr (ptr `plusPtr` sizeOf o)) s++data Surface = Surface (Ptr Raw.Surface) (Maybe (MSV.IOVector Word8))+  deriving (Typeable)++unmanagedSurface :: Ptr Raw.Surface -> Surface+unmanagedSurface s = Surface s Nothing++managedSurface :: MSV.IOVector Word8 -> Ptr Raw.Surface -> Surface+managedSurface p s = Surface s (Just p)++newtype Texture = Texture Raw.Texture+  deriving (Eq, Typeable)++-- | Draw a rectangle outline on the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderDrawRect SDL_RenderDrawRect>@ for C documentation.+drawRect :: MonadIO m+         => Renderer+         -> Maybe (Rectangle CInt) -- ^ The rectangle outline to draw. 'Nothing' for the entire rendering context.+         -> m ()+drawRect (Renderer r) rect = liftIO $+  throwIfNeg_ "SDL.Video.drawRect" "SDL_RenderDrawRect" $+  maybeWith with rect (Raw.renderDrawRect r . castPtr)++-- | Draw some number of rectangles on the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderDrawRects SDL_RenderDrawRects>@ for C documentation.+drawRects :: MonadIO m => Renderer -> SV.Vector (Rectangle CInt) -> m ()+drawRects (Renderer r) rects = liftIO $+  throwIfNeg_ "SDL.Video.drawRects" "SDL_RenderDrawRects" $+  SV.unsafeWith rects $ \rp ->+    Raw.renderDrawRects r+                        (castPtr rp)+                        (fromIntegral (SV.length rects))++-- | Fill a rectangle on the current rendering target with the drawing color.+--+-- See @<https://wiki.libsdl.org/SDL_RenderFillRect SDL_RenderFillRect>@ for C documentation.+fillRect :: MonadIO m+         => Renderer+         -> Maybe (Rectangle CInt) -- ^ The rectangle to fill. 'Nothing' for the entire rendering context.+         -> m ()+fillRect (Renderer r) rect = liftIO $ do+  throwIfNeg_ "SDL.Video.fillRect" "SDL_RenderFillRect" $+    maybeWith with rect $ \rPtr ->+      Raw.renderFillRect r+                         (castPtr rPtr)++-- | Fill some number of rectangles on the current rendering target with the drawing color.+--+-- See @<https://wiki.libsdl.org/SDL_RenderFillRects SDL_RenderFillRects>@ for C documentation.+fillRects :: MonadIO m => Renderer -> SV.Vector (Rectangle CInt) -> m ()+fillRects (Renderer r) rects = liftIO $+  throwIfNeg_ "SDL.Video.fillRects" "SDL_RenderFillRects" $+    SV.unsafeWith rects $ \rp ->+      Raw.renderFillRects r+                          (castPtr rp)+                          (fromIntegral (SV.length rects))++-- | Clear the current rendering target with the drawing color.+--+-- See @<https://wiki.libsdl.org/SDL_RenderClear SDL_RenderClear>@ for C documentation.+clear :: (Functor m, MonadIO m) => Renderer -> m ()+clear (Renderer r) =+  throwIfNeg_ "SDL.Video.clear" "SDL_RenderClear" $+  Raw.renderClear r++-- | Get or set the drawing scale for rendering on the current target.+--+-- The drawing coordinates are scaled by the x\/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.+--+-- If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.+--+-- See @<https://wiki.libsdl.org/SDL_RenderSetScale SDL_RenderSetScale>@ and @<https://wiki.libsdl.org/SDL_RenderGetScale SDL_RenderGetScale>@ for C documentation.+rendererScale :: Renderer -> StateVar (V2 CFloat)+rendererScale (Renderer r) = makeStateVar renderGetScale renderSetScale+  where+  renderSetScale (V2 x y) =+    throwIfNeg_ "SDL.Video.renderSetScale" "SDL_RenderSetScale" $+    Raw.renderSetScale r x y++  renderGetScale = liftIO $+    alloca $ \w ->+    alloca $ \h -> do+      Raw.renderGetScale r w h+      V2 <$> peek w <*> peek h++-- | Get or set the clip rectangle for rendering on the specified target.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_RenderSetClipRect SDL_RenderSetClipRect>@ and @<https://wiki.libsdl.org/SDL_RenderGetClipRect SDL_RenderGetClipRect>@ for C documentation.+rendererClipRect :: Renderer -> StateVar (Maybe (Rectangle CInt))+rendererClipRect (Renderer r) = makeStateVar renderGetClipRect renderSetClipRect+  where+  renderGetClipRect = liftIO $+    alloca $ \rPtr -> do+      Raw.renderGetClipRect r rPtr+      maybePeek peek (castPtr rPtr)+  renderSetClipRect rect =+    liftIO $+    throwIfNeg_ "SDL.Video.renderSetClipRect" "SDL_RenderSetClipRect" $+    maybeWith with rect $ Raw.renderSetClipRect r . castPtr++-- | Get or set the drawing area for rendering on the current target.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_RenderSetViewport SDL_RenderSetViewport>@ and @<https://wiki.libsdl.org/SDL_RenderGetViewport SDL_RenderGetViewport>@ for C documentation.+rendererViewport :: Renderer -> StateVar (Maybe (Rectangle CInt))+rendererViewport (Renderer r) = makeStateVar renderGetViewport renderSetViewport+  where+  renderGetViewport = liftIO $+    alloca $ \rect -> do+      Raw.renderGetViewport r rect+      maybePeek peek (castPtr rect)++  renderSetViewport rect =+    liftIO $+    throwIfNeg_ "SDL.Video.renderSetViewport" "SDL_RenderSetViewport" $+    maybeWith with rect $ Raw.renderSetViewport r . castPtr++-- | Update the screen with any rendering performed since the previous call.+--+-- SDL\'s rendering functions operate on a backbuffer; that is, calling a rendering function such as 'drawLine' does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.+--+-- Therefore, when using SDL's rendering API, one does all drawing intended for the frame, and then calls this function once per frame to present the final drawing to the user.+--+-- The backbuffer should be considered invalidated after each present; do not assume that previous contents will exist between frames. You are strongly encouraged to call 'clear' to initialize the backbuffer before starting each new frame's drawing, even if you plan to overwrite every pixel.+--+-- See @<https://wiki.libsdl.org/SDL_RenderPresent SDL_RenderPresent>@ for C documentation.+present :: MonadIO m => Renderer -> m ()+present (Renderer r) = Raw.renderPresent r++-- | Copy a portion of the texture to the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderCopy SDL_RenderCopy>@ for C documentation.+copy :: MonadIO m+     => Renderer -- ^ The rendering context+     -> Texture -- ^ The source texture+     -> Maybe (Rectangle CInt) -- ^ The source rectangle to copy, or 'Nothing' for the whole texture+     -> Maybe (Rectangle CInt) -- ^ The destination rectangle to copy to, or 'Nothing' for the whole rendering target. The texture will be stretched to fill the given rectangle.+     -> m ()+copy (Renderer r) (Texture t) srcRect dstRect =+  liftIO $+  throwIfNeg_ "SDL.Video.copy" "SDL_RenderCopy" $+  maybeWith with srcRect $ \src ->+  maybeWith with dstRect $ \dst ->+  Raw.renderCopy r t (castPtr src) (castPtr dst)++-- | Copy a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right.+--+-- See @<https://wiki.libsdl.org/SDL_RenderCopyEx SDL_RenderCopyEx>@ for C documentation.+copyEx :: MonadIO m+       => Renderer -- ^ The rendering context+       -> Texture -- ^ The source texture+       -> Maybe (Rectangle CInt) -- ^ The source rectangle to copy, or 'Nothing' for the whole texture+       -> Maybe (Rectangle CInt) -- ^ The destination rectangle to copy to, or 'Nothing' for the whole rendering target. The texture will be stretched to fill the given rectangle.+       -> CDouble -- ^ The angle of rotation in degrees. The rotation will be performed clockwise.+       -> Maybe (Point V2 CInt) -- ^ The point indicating the center of the rotation, or 'Nothing' to rotate around the center of the destination rectangle+       -> V2 Bool -- ^ Whether to flip the texture on the X and/or Y axis+       -> m ()+copyEx (Renderer r) (Texture t) srcRect dstRect theta center flips =+  liftIO $+  throwIfNeg_ "SDL.Video.copyEx" "SDL_RenderCopyEx" $+  maybeWith with srcRect $ \src ->+  maybeWith with dstRect $ \dst ->+  maybeWith with center $ \c ->+  Raw.renderCopyEx r t (castPtr src) (castPtr dst) theta (castPtr c)+                   (case flips of+                      V2 x y -> (if x then Raw.SDL_FLIP_HORIZONTAL else 0) .|.+                               (if y then Raw.SDL_FLIP_VERTICAL else 0))++-- | Draw a line on the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderDrawLine SDL_RenderDrawLine>@ for C documentation.+drawLine :: (Functor m,MonadIO m)+         => Renderer+         -> Point V2 CInt -- ^ The start point of the line+         -> Point V2 CInt -- ^ The end point of the line+         -> m ()+drawLine (Renderer r) (P (V2 x y)) (P (V2 x' y')) =+  throwIfNeg_ "SDL.Video.drawLine" "SDL_RenderDrawLine" $+  Raw.renderDrawLine r x y x' y'++-- | Draw a series of connected lines on the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderDrawLines SDL_RenderDrawLines>@ for C documentation.+drawLines :: MonadIO m+          => Renderer+          -> SV.Vector (Point V2 CInt) -- ^ A 'SV.Vector' of points along the line. SDL will draw lines between these points.+          -> m ()+drawLines (Renderer r) points =+  liftIO $+  throwIfNeg_ "SDL.Video.drawLines" "SDL_RenderDrawLines" $+  SV.unsafeWith points $ \cp ->+    Raw.renderDrawLines r+                        (castPtr cp)+                        (fromIntegral (SV.length points))++-- | Draw a point on the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderDrawPoint SDL_RenderDrawPoint>@ for C documentation.+drawPoint :: (Functor m, MonadIO m) => Renderer -> Point V2 CInt -> m ()+drawPoint (Renderer r) (P (V2 x y)) =+  throwIfNeg_ "SDL.Video.drawPoint" "SDL_RenderDrawPoint" $+  Raw.renderDrawPoint r x y++-- | Draw multiple points on the current rendering target.+--+-- See @<https://wiki.libsdl.org/SDL_RenderDrawPoints SDL_RenderDrawPoints>@ for C documentation.+drawPoints :: MonadIO m => Renderer -> SV.Vector (Point V2 CInt) -> m ()+drawPoints (Renderer r) points =+  liftIO $+  throwIfNeg_ "SDL.Video.drawPoints" "SDL_RenderDrawPoints" $+  SV.unsafeWith points $ \cp ->+    Raw.renderDrawPoints r+                         (castPtr cp)+                         (fromIntegral (SV.length points))++-- | Copy an existing surface into a new one that is optimized for blitting to a surface of a specified pixel format.+--+-- This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.+--+-- See @<https://wiki.libsdl.org/SDL_ConvertSurface SDL_ConvertSurface>@ for C documentation.+convertSurface :: (Functor m,MonadIO m)+               => Surface -- ^ The 'Surface' to convert+               -> SurfacePixelFormat -- ^ The pixel format that the new surface is optimized for+               -> m Surface+convertSurface (Surface s _) (SurfacePixelFormat fmt) =+  fmap unmanagedSurface $+  throwIfNull "SDL.Video.Renderer.convertSurface" "SDL_ConvertSurface" $+  Raw.convertSurface s fmt 0++-- | Perform a scaled surface copy to a destination surface.+--+-- See @<https://wiki.libsdl.org/SDL_BlitScaled SDL_BlitScaled>@ for C documentation.+surfaceBlitScaled :: MonadIO m+                  => Surface -- ^ The 'Surface' to be copied from+                  -> Maybe (Rectangle CInt) -- ^ The rectangle to be copied, or 'Nothing' to copy the entire surface+                  -> Surface -- ^ The 'Surface' that is the blit target+                  -> Maybe (Rectangle CInt) -- ^ The rectangle that is copied into, or 'Nothing' to copy into the entire surface+                  -> m ()+surfaceBlitScaled (Surface src _) srcRect (Surface dst _) dstRect =+  liftIO $+  throwIfNeg_ "SDL.Video.blitSurface" "SDL_BlitSurface" $+  maybeWith with srcRect $ \srcPtr ->+  maybeWith with dstRect $ \dstPtr ->+  Raw.blitScaled src (castPtr srcPtr) dst (castPtr dstPtr)++-- | Get or set the color key (transparent pixel color) for a surface.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetColorKey SDL_SetColorKey>@ and @<https://wiki.libsdl.org/SDL_GetColorKey SDL_GetColorKey>@ for C documentation.+surfaceColorKey :: Surface -> StateVar (Maybe (V4 Word8))+surfaceColorKey (Surface s _) = makeStateVar getColorKey setColorKey+  where+  getColorKey =+    liftIO $+    alloca $ \keyPtr -> do+      ret <- Raw.getColorKey s keyPtr+      if ret == -1+        then return Nothing+        else do format <- liftIO (Raw.surfaceFormat <$> peek s)+                mapped <- peek keyPtr+                alloca $ \r ->+                  alloca $ \g ->+                  alloca $ \b ->+                  alloca $ \a ->+                    do Raw.getRGBA mapped format r g b a+                       Just <$> (V4 <$> peek r <*> peek g <*> peek b <*> peek a)+  setColorKey key =+    liftIO $+    throwIfNeg_ "SDL.Video.Renderer.setColorKey" "SDL_SetColorKey" $+    case key of+      Nothing ->+        alloca $ \keyPtr -> do+          -- TODO Error checking?+          ret <- Raw.getColorKey s keyPtr+          if ret == -1+            -- if ret == -1 then there is no key enabled, so we have nothing to+            -- do.+            then return 0+            else do key' <- peek keyPtr+                    Raw.setColorKey s 0 key'++      Just (V4 r g b a) -> do+        format <- liftIO (Raw.surfaceFormat <$> peek s)+        Raw.mapRGBA format r g b a >>= Raw.setColorKey s 1++-- | Get or set the additional color value multiplied into render copy operations.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetTextureColorMod SDL_SetTextureColorMod>@ and @<https://wiki.libsdl.org/SDL_GetTextureColorMod SDL_GetTextureColorMod>@ for C documentation.+textureColorMod :: Texture -> StateVar (V3 Word8)+textureColorMod (Texture t) = makeStateVar getTextureColorMod setTextureColorMod+  where+  getTextureColorMod = liftIO $+    alloca $ \r ->+    alloca $ \g ->+    alloca $ \b -> do+      throwIfNeg_ "SDL.Video.Renderer.getTextureColorMod" "SDL_GetTextureColorMod" $+        Raw.getTextureColorMod t r g b+      V3 <$> peek r <*> peek g <*> peek b++  setTextureColorMod (V3 r g b) =+    throwIfNeg_ "SDL.Video.Renderer.setTextureColorMod" "SDL_SetTextureColorMod" $+    Raw.setTextureColorMod t r g b++data PixelFormat+  = Unknown+  | Index1LSB+  | Index1MSB+  | Index4LSB+  | Index4MSB+  | Index8+  | RGB332+  | RGB444+  | RGB555+  | BGR555+  | ARGB4444+  | RGBA4444+  | ABGR4444+  | BGRA4444+  | ARGB1555+  | RGBA5551+  | ABGR1555+  | BGRA5551+  | RGB565+  | BGR565+  | RGB24+  | BGR24+  | RGB888+  | RGBX8888+  | BGR888+  | BGRX8888+  | ARGB8888+  | RGBA8888+  | ABGR8888+  | BGRA8888+  | ARGB2101010+  | YV12+  | IYUV+  | YUY2+  | UYVY+  | YVYU+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber PixelFormat Word32 where+  fromNumber n' = case n' of+    Raw.SDL_PIXELFORMAT_UNKNOWN -> Unknown+    Raw.SDL_PIXELFORMAT_INDEX1LSB -> Index1LSB+    Raw.SDL_PIXELFORMAT_INDEX1MSB -> Index1MSB+    Raw.SDL_PIXELFORMAT_INDEX4LSB -> Index4LSB+    Raw.SDL_PIXELFORMAT_INDEX4MSB -> Index4MSB+    Raw.SDL_PIXELFORMAT_INDEX8 -> Index8+    Raw.SDL_PIXELFORMAT_RGB332 -> RGB332+    Raw.SDL_PIXELFORMAT_RGB444 -> RGB444+    Raw.SDL_PIXELFORMAT_RGB555 -> RGB555+    Raw.SDL_PIXELFORMAT_BGR555 -> BGR555+    Raw.SDL_PIXELFORMAT_ARGB4444 -> ARGB4444+    Raw.SDL_PIXELFORMAT_RGBA4444 -> RGBA4444+    Raw.SDL_PIXELFORMAT_ABGR4444 -> ABGR4444+    Raw.SDL_PIXELFORMAT_BGRA4444 -> BGRA4444+    Raw.SDL_PIXELFORMAT_ARGB1555 -> ARGB1555+    Raw.SDL_PIXELFORMAT_RGBA5551 -> RGBA5551+    Raw.SDL_PIXELFORMAT_ABGR1555 -> ABGR1555+    Raw.SDL_PIXELFORMAT_BGRA5551 -> BGRA5551+    Raw.SDL_PIXELFORMAT_RGB565 -> RGB565+    Raw.SDL_PIXELFORMAT_BGR565 -> BGR565+    Raw.SDL_PIXELFORMAT_RGB24 -> RGB24+    Raw.SDL_PIXELFORMAT_BGR24 -> BGR24+    Raw.SDL_PIXELFORMAT_RGB888 -> RGB888+    Raw.SDL_PIXELFORMAT_RGBX8888 -> RGBX8888+    Raw.SDL_PIXELFORMAT_BGR888 -> BGR888+    Raw.SDL_PIXELFORMAT_BGRX8888 -> BGRX8888+    Raw.SDL_PIXELFORMAT_ARGB8888 -> ARGB8888+    Raw.SDL_PIXELFORMAT_RGBA8888 -> RGBA8888+    Raw.SDL_PIXELFORMAT_ABGR8888 -> ABGR8888+    Raw.SDL_PIXELFORMAT_BGRA8888 -> BGRA8888+    Raw.SDL_PIXELFORMAT_ARGB2101010 -> ARGB2101010+    Raw.SDL_PIXELFORMAT_YV12 -> YV12+    Raw.SDL_PIXELFORMAT_IYUV -> IYUV+    Raw.SDL_PIXELFORMAT_YUY2 -> YUY2+    Raw.SDL_PIXELFORMAT_UYVY -> UYVY+    Raw.SDL_PIXELFORMAT_YVYU -> YVYU+    _ -> error "fromNumber: not numbered"++instance ToNumber PixelFormat Word32 where+  toNumber pf = case pf of+    Unknown -> Raw.SDL_PIXELFORMAT_UNKNOWN+    Index1LSB -> Raw.SDL_PIXELFORMAT_INDEX1LSB+    Index1MSB -> Raw.SDL_PIXELFORMAT_INDEX1MSB+    Index4LSB -> Raw.SDL_PIXELFORMAT_INDEX4LSB+    Index4MSB -> Raw.SDL_PIXELFORMAT_INDEX4MSB+    Index8 -> Raw.SDL_PIXELFORMAT_INDEX8+    RGB332 -> Raw.SDL_PIXELFORMAT_RGB332+    RGB444 -> Raw.SDL_PIXELFORMAT_RGB444+    RGB555 -> Raw.SDL_PIXELFORMAT_RGB555+    BGR555 -> Raw.SDL_PIXELFORMAT_BGR555+    ARGB4444 -> Raw.SDL_PIXELFORMAT_ARGB4444+    RGBA4444 -> Raw.SDL_PIXELFORMAT_RGBA4444+    ABGR4444 -> Raw.SDL_PIXELFORMAT_ABGR4444+    BGRA4444 -> Raw.SDL_PIXELFORMAT_BGRA4444+    ARGB1555 -> Raw.SDL_PIXELFORMAT_ARGB1555+    RGBA5551 -> Raw.SDL_PIXELFORMAT_RGBA5551+    ABGR1555 -> Raw.SDL_PIXELFORMAT_ABGR1555+    BGRA5551 -> Raw.SDL_PIXELFORMAT_BGRA5551+    RGB565 -> Raw.SDL_PIXELFORMAT_RGB565+    BGR565 -> Raw.SDL_PIXELFORMAT_BGR565+    RGB24 -> Raw.SDL_PIXELFORMAT_RGB24+    BGR24 -> Raw.SDL_PIXELFORMAT_BGR24+    RGB888 -> Raw.SDL_PIXELFORMAT_RGB888+    RGBX8888 -> Raw.SDL_PIXELFORMAT_RGBX8888+    BGR888 -> Raw.SDL_PIXELFORMAT_BGR888+    BGRX8888 -> Raw.SDL_PIXELFORMAT_BGRX8888+    ARGB8888 -> Raw.SDL_PIXELFORMAT_ARGB8888+    RGBA8888 -> Raw.SDL_PIXELFORMAT_RGBA8888+    ABGR8888 -> Raw.SDL_PIXELFORMAT_ABGR8888+    BGRA8888 -> Raw.SDL_PIXELFORMAT_BGRA8888+    ARGB2101010 -> Raw.SDL_PIXELFORMAT_ARGB2101010+    YV12 -> Raw.SDL_PIXELFORMAT_YV12+    IYUV -> Raw.SDL_PIXELFORMAT_IYUV+    YUY2 -> Raw.SDL_PIXELFORMAT_YUY2+    UYVY -> Raw.SDL_PIXELFORMAT_UYVY+    YVYU -> Raw.SDL_PIXELFORMAT_YVYU++-- | Renderer acceleration mode+data RendererType+  = UnacceleratedRenderer+    -- ^ The renderer does not use hardware acceleration+  | AcceleratedRenderer+    -- ^ The renderer uses hardware acceleration and refresh rate is ignored+  | AcceleratedVSyncRenderer+    -- ^ The renderer uses hardware acceleration and present is synchronized with the refresh rate+  | SoftwareRenderer+    -- ^ The renderer is a software fallback+  deriving (Bounded, Data, Enum, Eq, Generic, Ord, Read, Show, Typeable)++-- | The configuration data used when creating windows.+data RendererConfig = RendererConfig+  { rendererType  :: RendererType+    -- ^ The renderer's acceleration mode+  , rendererTargetTexture :: Bool+    -- ^ The renderer supports rendering to texture+  } deriving (Data, Eq, Generic, Ord, Read, Show, Typeable)++instance FromNumber RendererConfig Word32 where+  fromNumber n = RendererConfig+    { rendererType          = rendererType'+                                (n .&. Raw.SDL_RENDERER_SOFTWARE /= 0)+                                (n .&. Raw.SDL_RENDERER_ACCELERATED /= 0)+                                (n .&. Raw.SDL_RENDERER_PRESENTVSYNC /= 0)+    , rendererTargetTexture = n .&. Raw.SDL_RENDERER_TARGETTEXTURE /= 0+    }+    where+      rendererType' s a v | s         = SoftwareRenderer+                          | a && v    = AcceleratedVSyncRenderer+                          | a         = AcceleratedRenderer+                          | otherwise = UnacceleratedRenderer++instance ToNumber RendererConfig Word32 where+  toNumber config = foldr (.|.) 0+    [ if isSoftware then Raw.SDL_RENDERER_SOFTWARE else 0+    , if not isSoftware then Raw.SDL_RENDERER_ACCELERATED else 0+    , if rendererType config == AcceleratedVSyncRenderer then Raw.SDL_RENDERER_PRESENTVSYNC  else 0+    , if rendererTargetTexture config then Raw.SDL_RENDERER_TARGETTEXTURE else 0+    ]+    where+      isSoftware = rendererType config == SoftwareRenderer++-- | Default options for 'RendererConfig'.+--+-- @+-- 'defaultRenderer' = 'RendererConfig'+--   { 'rendererType'          = 'AcceleratedRenderer'+--   , 'rendererTargetTexture' = False+--   }+-- @+defaultRenderer :: RendererConfig+defaultRenderer = RendererConfig+  { rendererType          = AcceleratedRenderer+  , rendererTargetTexture = False+  }++-- | Information about an instantiated 'Renderer'.+data RendererInfo = RendererInfo+  { rendererInfoName              :: Text+    -- ^ The name of the renderer+  , rendererInfoFlags             :: RendererConfig+    -- ^ Supported renderer features+  , rendererInfoNumTextureFormats :: Word32+    -- ^ The number of available texture formats+  , rendererInfoTextureFormats    :: [PixelFormat]+    -- ^ The available texture formats+  , rendererInfoMaxTextureWidth   :: CInt+    -- ^ The maximum texture width+  , rendererInfoMaxTextureHeight  :: CInt+    -- ^ The maximum texture height+  } deriving (Eq, Generic, Ord, Read, Show, Typeable)++fromRawRendererInfo :: MonadIO m => Raw.RendererInfo -> m RendererInfo+fromRawRendererInfo (Raw.RendererInfo name flgs ntf tfs mtw mth) = liftIO $ do+    name' <- Text.decodeUtf8 <$> BS.packCString name+    return $ RendererInfo name' (fromNumber flgs) ntf (fmap fromNumber tfs) mtw mth++-- | Get information about a rendering context.+--+-- See @<https://wiki.libsdl.org/SDL_GetRendererInfo SDL_GetRendererInfo>@ for C documentation.+getRendererInfo :: MonadIO m => Renderer -> m RendererInfo+getRendererInfo (Renderer renderer) = liftIO $+  alloca $ \rptr -> do+    throwIfNeg_ "getRendererInfo" "SDL_GetRendererInfo" $+      Raw.getRendererInfo renderer rptr+    peek rptr >>= fromRawRendererInfo++-- | Enumerate all known render drivers on the system, and determine their supported features.+--+-- See @<https://wiki.libsdl.org/SDL_GetRenderDriverInfo SDL_GetRenderDriverInfo>@ for C documentation.+getRenderDriverInfo :: MonadIO m => m [RendererInfo]+getRenderDriverInfo = liftIO $ do+  count <- Raw.getNumRenderDrivers+  traverse go [0..count-1]+  where+    go idx = alloca $ \rptr -> do+               throwIfNeg_ "getRenderDriverInfo" "SDL_GetRenderDriverInfo" $+                 Raw.getRenderDriverInfo idx rptr+               peek rptr >>= fromRawRendererInfo++-- | Get or set the additional alpha value multiplied into render copy operations.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetTextureAlphaMod SDL_SetTextureAlphaMod>@ and @<https://wiki.libsdl.org/SDL_GetTextureAlphaMod SDL_GetTextureAlphaMod>@ for C documentation.+textureAlphaMod :: Texture -> StateVar Word8+textureAlphaMod (Texture t) = makeStateVar getTextureAlphaMod setTextureAlphaMod+  where+  getTextureAlphaMod = liftIO $+    alloca $ \x -> do+      throwIfNeg_ "SDL.Video.Renderer.getTextureAlphaMod" "SDL_GetTextureAlphaMod" $+        Raw.getTextureAlphaMod t x+      peek x++  setTextureAlphaMod alpha =+    throwIfNeg_ "SDL.Video.Renderer.setTextureAlphaMod" "SDL_SetTextureAlphaMod" $+      Raw.setTextureAlphaMod t alpha++-- | Get or set the blend mode used for texture copy operations.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetTextureBlendMode SDL_SetTextureBlendMode>@ and @<https://wiki.libsdl.org/SDL_GetTextureBlendMode SDL_GetTextureBlendMode>@ for C documentation.+textureBlendMode :: Texture -> StateVar BlendMode+textureBlendMode (Texture t) = makeStateVar getTextureBlendMode setTextureBlendMode+  where+  getTextureBlendMode = liftIO $+    alloca $ \x -> do+      throwIfNeg_ "SDL.Video.Renderer.getTextureBlendMode" "SDL_GetTextureBlendMode" $+        Raw.getTextureBlendMode t x+      fromNumber <$> peek x++  setTextureBlendMode bm =+    throwIfNeg_ "SDL.Video.Renderer.setTextureBlendMode" "SDL_SetTextureBlendMode" $+    Raw.setTextureBlendMode t (toNumber bm)++-- | Get or set the blend mode used for blit operations.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetSurfaceBlendMode SDL_SetSurfaceBlendMode>@ and @<https://wiki.libsdl.org/SDL_GetSurfaceBlendMode SDL_GetSurfaceBlendMode>@ for C documentation.+surfaceBlendMode :: Surface -> StateVar BlendMode+surfaceBlendMode (Surface s _) = makeStateVar getSurfaceBlendMode setSurfaceBlendMode+  where+  getSurfaceBlendMode = liftIO $+    alloca $ \x -> do+      throwIfNeg_ "SDL.Video.Renderer.getSurfaceBlendMode" "SDL_GetSurfaceBlendMode" $+        Raw.getSurfaceBlendMode s x+      fromNumber <$> peek x++  setSurfaceBlendMode bm =+    throwIfNeg_ "SDL.Video.Renderer.setSurfaceBlendMode" "SDL_SetSurfaceBlendMode" $+    Raw.setSurfaceBlendMode s (toNumber bm)++-- | Get or set the current render target. 'Nothing' corresponds to the default render target.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_SetRenderTarget SDL_SetRenderTarget>@ and @<https://wiki.libsdl.org/SDL_GetRenderTarget SDL_GetRenderTarget>@ for C documentation.+rendererRenderTarget :: Renderer -> StateVar (Maybe Texture)+rendererRenderTarget (Renderer r) = makeStateVar getRenderTarget setRenderTarget+  where+  getRenderTarget = do+    t <- Raw.getRenderTarget r+    return $+      if t == nullPtr+        then Nothing+        else Just (Texture t)++  setRenderTarget texture =+    throwIfNeg_ "SDL.Video.Renderer.setRenderTarget" "SDL_SetRenderTarget" $+    case texture of+      Nothing -> Raw.setRenderTarget r nullPtr+      Just (Texture t) -> Raw.setRenderTarget r t++-- | Get or set the device independent resolution for rendering.+--+-- This 'StateVar' can be modified using '$=' and the current value retrieved with 'get'.+--+-- See @<https://wiki.libsdl.org/SDL_RenderSetLogicalSize SDL_RenderSetLogicalSize>@ and @<https://wiki.libsdl.org/SDL_RenderGetLogicalSize SDL_RenderGetLogicalSize>@ for C documentation.+rendererLogicalSize :: Renderer -> StateVar (Maybe (V2 CInt))+rendererLogicalSize (Renderer r) = makeStateVar renderGetLogicalSize renderSetLogicalSize+  where+  renderGetLogicalSize = liftIO $+    alloca $ \w -> do+    alloca $ \h -> do+      Raw.renderGetLogicalSize r w h+      v <- V2 <$> peek w <*> peek h+      return $ if v == 0 then Nothing else Just v++  renderSetLogicalSize v =+    throwIfNeg_ "SDL.Video.renderSetLogicalSize" "SDL_RenderSetLogicalSize" $ do+      let (x,y) = case v of Just (V2 vx vy) -> (vx, vy)+                            Nothing -> (0,0)+      Raw.renderSetLogicalSize r x y++-- | Determine whether a window supports the use of render targets.+--+-- See @<https://wiki.libsdl.org/SDL_RenderTargetSupported SDL_RenderTargetSupported>@ for C documentation.+renderTargetSupported :: (MonadIO m) => Renderer -> m Bool+renderTargetSupported (Renderer r) = Raw.renderTargetSupported r++-- | Convert the given the enumerated pixel format to a bpp value and RGBA masks.+--+-- See @<https://wiki.libsdl.org/SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks>@ for C documentation.+pixelFormatToMasks :: (MonadIO m) => PixelFormat -> m (CInt, V4 Word32)+pixelFormatToMasks pf = liftIO $+  alloca $ \bpp ->+  alloca $ \r ->+  alloca $ \g ->+  alloca $ \b ->+  alloca $ \a -> do+    throwIf_ not "SDL.Video.pixelFormatEnumToMasks" "SDL_PixelFormatEnumToMasks" $+      Raw.pixelFormatEnumToMasks (toNumber pf) bpp r g b a+    wrap <$> peek bpp <*> peek r <*> peek g <*> peek b <*> peek a+    where+      wrap bpp r g b a = (bpp, V4 r g b a)++-- | Convert a bpp value and RGBA masks to an enumerated pixel format.+--+-- See @<https://wiki.libsdl.org/SDL_MasksToPixelFormatEnum SDL_MasksToPixelFormatEnum>@ for C documentation.+masksToPixelFormat :: (MonadIO m) => CInt -> V4 Word32 -> m PixelFormat+masksToPixelFormat bpp (V4 r g b a) = liftIO $+  fromNumber <$> Raw.masksToPixelFormatEnum bpp r g b a