# nodesnim/thirdparty/sdl2

Dark Mode

Search:
Group by:

do not import this, it is included in sdl2.nimpixel format flagsfunctions whose names have been shortened by elision of a type nameSDL_vulkan.hSDL_keyboard.h:Create an SDL_PixelFormat structure from a pixel format enum.define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY)define SDL_BUTTON(X) (1 << ((X)-1))compatibility functionsdefine SDL_SaveBMP(surface, file)

# Types

    csize_t_const = csize_t

    Scancode {...}{.size: 4.} = enum
      SDL_SCANCODE_UNKNOWN = 0, SDL_SCANCODE_A = 4, SDL_SCANCODE_B = 5, SDL_SCANCODE_C = 6,
      SDL_SCANCODE_D = 7, SDL_SCANCODE_E = 8, SDL_SCANCODE_F = 9, SDL_SCANCODE_G = 10,
      SDL_SCANCODE_H = 11, SDL_SCANCODE_I = 12, SDL_SCANCODE_J = 13, SDL_SCANCODE_K = 14,
      SDL_SCANCODE_L = 15, SDL_SCANCODE_M = 16, SDL_SCANCODE_N = 17, SDL_SCANCODE_O = 18,
      SDL_SCANCODE_P = 19, SDL_SCANCODE_Q = 20, SDL_SCANCODE_R = 21, SDL_SCANCODE_S = 22,
      SDL_SCANCODE_T = 23, SDL_SCANCODE_U = 24, SDL_SCANCODE_V = 25, SDL_SCANCODE_W = 26,
      SDL_SCANCODE_X = 27, SDL_SCANCODE_Y = 28, SDL_SCANCODE_Z = 29, SDL_SCANCODE_1 = 30,
      SDL_SCANCODE_2 = 31, SDL_SCANCODE_3 = 32, SDL_SCANCODE_4 = 33, SDL_SCANCODE_5 = 34,
      SDL_SCANCODE_6 = 35, SDL_SCANCODE_7 = 36, SDL_SCANCODE_8 = 37, SDL_SCANCODE_9 = 38,
      SDL_SCANCODE_0 = 39, SDL_SCANCODE_RETURN = 40, SDL_SCANCODE_ESCAPE = 41,
      SDL_SCANCODE_BACKSPACE = 42, SDL_SCANCODE_TAB = 43, SDL_SCANCODE_SPACE = 44,
      SDL_SCANCODE_MINUS = 45, SDL_SCANCODE_EQUALS = 46, SDL_SCANCODE_LEFTBRACKET = 47,
      SDL_SCANCODE_RIGHTBRACKET = 48, SDL_SCANCODE_BACKSLASH = 49,
      SDL_SCANCODE_NONUSHASH = 50, SDL_SCANCODE_SEMICOLON = 51,
      SDL_SCANCODE_APOSTROPHE = 52, SDL_SCANCODE_GRAVE = 53, SDL_SCANCODE_COMMA = 54,
      SDL_SCANCODE_PERIOD = 55, SDL_SCANCODE_SLASH = 56, SDL_SCANCODE_CAPSLOCK = 57,
      SDL_SCANCODE_F1 = 58, SDL_SCANCODE_F2 = 59, SDL_SCANCODE_F3 = 60, SDL_SCANCODE_F4 = 61,
      SDL_SCANCODE_F5 = 62, SDL_SCANCODE_F6 = 63, SDL_SCANCODE_F7 = 64, SDL_SCANCODE_F8 = 65,
      SDL_SCANCODE_F9 = 66, SDL_SCANCODE_F10 = 67, SDL_SCANCODE_F11 = 68,
      SDL_SCANCODE_F12 = 69, SDL_SCANCODE_PRINTSCREEN = 70, SDL_SCANCODE_SCROLLLOCK = 71,
      SDL_SCANCODE_PAUSE = 72, SDL_SCANCODE_INSERT = 73, SDL_SCANCODE_HOME = 74,
      SDL_SCANCODE_PAGEUP = 75, SDL_SCANCODE_DELETE = 76, SDL_SCANCODE_END = 77,
      SDL_SCANCODE_PAGEDOWN = 78, SDL_SCANCODE_RIGHT = 79, SDL_SCANCODE_LEFT = 80,
      SDL_SCANCODE_DOWN = 81, SDL_SCANCODE_UP = 82, SDL_SCANCODE_NUMLOCKCLEAR = 83,
      SDL_SCANCODE_KP_DIVIDE = 84, SDL_SCANCODE_KP_MULTIPLY = 85,
      SDL_SCANCODE_KP_MINUS = 86, SDL_SCANCODE_KP_PLUS = 87, SDL_SCANCODE_KP_ENTER = 88,
      SDL_SCANCODE_KP_1 = 89, SDL_SCANCODE_KP_2 = 90, SDL_SCANCODE_KP_3 = 91,
      SDL_SCANCODE_KP_4 = 92, SDL_SCANCODE_KP_5 = 93, SDL_SCANCODE_KP_6 = 94,
      SDL_SCANCODE_KP_7 = 95, SDL_SCANCODE_KP_8 = 96, SDL_SCANCODE_KP_9 = 97,
      SDL_SCANCODE_KP_0 = 98, SDL_SCANCODE_KP_PERIOD = 99,
      SDL_SCANCODE_NONUSBACKSLASH = 100, SDL_SCANCODE_APPLICATION = 101,
      SDL_SCANCODE_POWER = 102, SDL_SCANCODE_KP_EQUALS = 103, SDL_SCANCODE_F13 = 104,
      SDL_SCANCODE_F14 = 105, SDL_SCANCODE_F15 = 106, SDL_SCANCODE_F16 = 107,
      SDL_SCANCODE_F17 = 108, SDL_SCANCODE_F18 = 109, SDL_SCANCODE_F19 = 110,
      SDL_SCANCODE_F20 = 111, SDL_SCANCODE_F21 = 112, SDL_SCANCODE_F22 = 113,
      SDL_SCANCODE_F23 = 114, SDL_SCANCODE_F24 = 115, SDL_SCANCODE_EXECUTE = 116,
      SDL_SCANCODE_HELP = 117, SDL_SCANCODE_MENU = 118, SDL_SCANCODE_SELECT = 119,
      SDL_SCANCODE_STOP = 120, SDL_SCANCODE_AGAIN = 121, SDL_SCANCODE_UNDO = 122,
      SDL_SCANCODE_CUT = 123, SDL_SCANCODE_COPY = 124, SDL_SCANCODE_PASTE = 125,
      SDL_SCANCODE_FIND = 126, SDL_SCANCODE_MUTE = 127, SDL_SCANCODE_VOLUMEUP = 128,
      SDL_SCANCODE_VOLUMEDOWN = 129, SDL_SCANCODE_KP_COMMA = 133,
      SDL_SCANCODE_KP_EQUALSAS400 = 134, SDL_SCANCODE_INTERNATIONAL1 = 135,
      SDL_SCANCODE_INTERNATIONAL2 = 136, SDL_SCANCODE_INTERNATIONAL3 = 137,
      SDL_SCANCODE_INTERNATIONAL4 = 138, SDL_SCANCODE_INTERNATIONAL5 = 139,
      SDL_SCANCODE_INTERNATIONAL6 = 140, SDL_SCANCODE_INTERNATIONAL7 = 141,
      SDL_SCANCODE_INTERNATIONAL8 = 142, SDL_SCANCODE_INTERNATIONAL9 = 143,
      SDL_SCANCODE_LANG1 = 144, SDL_SCANCODE_LANG2 = 145, SDL_SCANCODE_LANG3 = 146,
      SDL_SCANCODE_LANG4 = 147, SDL_SCANCODE_LANG5 = 148, SDL_SCANCODE_LANG6 = 149,
      SDL_SCANCODE_LANG7 = 150, SDL_SCANCODE_LANG8 = 151, SDL_SCANCODE_LANG9 = 152,
      SDL_SCANCODE_ALTERASE = 153, SDL_SCANCODE_SYSREQ = 154, SDL_SCANCODE_CANCEL = 155,
      SDL_SCANCODE_CLEAR = 156, SDL_SCANCODE_PRIOR = 157, SDL_SCANCODE_RETURN2 = 158,
      SDL_SCANCODE_SEPARATOR = 159, SDL_SCANCODE_OUT = 160, SDL_SCANCODE_OPER = 161,
      SDL_SCANCODE_CLEARAGAIN = 162, SDL_SCANCODE_CRSEL = 163, SDL_SCANCODE_EXSEL = 164,
      SDL_SCANCODE_KP_00 = 176, SDL_SCANCODE_KP_000 = 177,
      SDL_SCANCODE_THOUSANDSSEPARATOR = 178, SDL_SCANCODE_DECIMALSEPARATOR = 179,
      SDL_SCANCODE_CURRENCYUNIT = 180, SDL_SCANCODE_CURRENCYSUBUNIT = 181,
      SDL_SCANCODE_KP_LEFTPAREN = 182, SDL_SCANCODE_KP_RIGHTPAREN = 183,
      SDL_SCANCODE_KP_LEFTBRACE = 184, SDL_SCANCODE_KP_RIGHTBRACE = 185,
      SDL_SCANCODE_KP_TAB = 186, SDL_SCANCODE_KP_BACKSPACE = 187, SDL_SCANCODE_KP_A = 188,
      SDL_SCANCODE_KP_B = 189, SDL_SCANCODE_KP_C = 190, SDL_SCANCODE_KP_D = 191,
      SDL_SCANCODE_KP_E = 192, SDL_SCANCODE_KP_F = 193, SDL_SCANCODE_KP_XOR = 194,
      SDL_SCANCODE_KP_POWER = 195, SDL_SCANCODE_KP_PERCENT = 196,
      SDL_SCANCODE_KP_LESS = 197, SDL_SCANCODE_KP_GREATER = 198,
      SDL_SCANCODE_KP_AMPERSAND = 199, SDL_SCANCODE_KP_DBLAMPERSAND = 200,
      SDL_SCANCODE_KP_VERTICALBAR = 201, SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
      SDL_SCANCODE_KP_COLON = 203, SDL_SCANCODE_KP_HASH = 204,
      SDL_SCANCODE_KP_SPACE = 205, SDL_SCANCODE_KP_AT = 206, SDL_SCANCODE_KP_EXCLAM = 207,
      SDL_SCANCODE_KP_MEMSTORE = 208, SDL_SCANCODE_KP_MEMRECALL = 209,
      SDL_SCANCODE_KP_MEMCLEAR = 210, SDL_SCANCODE_KP_MEMADD = 211,
      SDL_SCANCODE_KP_MEMSUBTRACT = 212, SDL_SCANCODE_KP_MEMMULTIPLY = 213,
      SDL_SCANCODE_KP_MEMDIVIDE = 214, SDL_SCANCODE_KP_PLUSMINUS = 215,
      SDL_SCANCODE_KP_CLEAR = 216, SDL_SCANCODE_KP_CLEARENTRY = 217,
      SDL_SCANCODE_KP_BINARY = 218, SDL_SCANCODE_KP_OCTAL = 219,
      SDL_SCANCODE_KP_DECIMAL = 220, SDL_SCANCODE_KP_HEXADECIMAL = 221,
      SDL_SCANCODE_LCTRL = 224, SDL_SCANCODE_LSHIFT = 225, SDL_SCANCODE_LALT = 226,
      SDL_SCANCODE_LGUI = 227, SDL_SCANCODE_RCTRL = 228, SDL_SCANCODE_RSHIFT = 229,
      SDL_SCANCODE_RALT = 230, SDL_SCANCODE_RGUI = 231, SDL_SCANCODE_MODE = 257,
      SDL_SCANCODE_AUDIONEXT = 258, SDL_SCANCODE_AUDIOPREV = 259,
      SDL_SCANCODE_AUDIOSTOP = 260, SDL_SCANCODE_AUDIOPLAY = 261,
      SDL_SCANCODE_AUDIOMUTE = 262, SDL_SCANCODE_MEDIASELECT = 263,
      SDL_SCANCODE_WWW = 264, SDL_SCANCODE_MAIL = 265, SDL_SCANCODE_CALCULATOR = 266,
      SDL_SCANCODE_COMPUTER = 267, SDL_SCANCODE_AC_SEARCH = 268,
      SDL_SCANCODE_AC_HOME = 269, SDL_SCANCODE_AC_BACK = 270,
      SDL_SCANCODE_AC_FORWARD = 271, SDL_SCANCODE_AC_STOP = 272,
      SDL_SCANCODE_AC_REFRESH = 273, SDL_SCANCODE_AC_BOOKMARKS = 274,
      SDL_SCANCODE_BRIGHTNESSDOWN = 275, SDL_SCANCODE_BRIGHTNESSUP = 276,
      SDL_SCANCODE_DISPLAYSWITCH = 277, SDL_SCANCODE_KBDILLUMTOGGLE = 278,
      SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280,
      SDL_SCANCODE_EJECT = 281, SDL_SCANCODE_SLEEP = 282, SDL_NUM_SCANCODES = 512

    Keymod {...}{.size: 4.} = enum
      KMOD_NONE = 0x00000000, KMOD_LSHIFT = 0x00000001, KMOD_RSHIFT = 0x00000002,
      KMOD_LCTRL = 0x00000040, KMOD_RCTRL = 0x00000080, KMOD_LALT = 0x00000100,
      KMOD_RALT = 0x00000200, KMOD_LGUI = 0x00000400, KMOD_RGUI = 0x00000800,
      KMOD_NUM = 0x00001000, KMOD_CAPS = 0x00002000, KMOD_MODE = 0x00004000,
      KMOD_RESERVED = 0x00008000

    WindowEventID {...}{.size: 1.} = enum
      WindowEvent_None = 0, WindowEvent_Shown, WindowEvent_Hidden, WindowEvent_Exposed,
      WindowEvent_Moved, WindowEvent_Resized, WindowEvent_SizeChanged,
      WindowEvent_Minimized, WindowEvent_Maximized, WindowEvent_Restored,
      WindowEvent_Enter, WindowEvent_Leave, WindowEvent_FocusGained,
      WindowEvent_FocusLost, WindowEvent_Close, WindowEvent_TakeFocus,
      WindowEvent_HitTest

    EventType {...}{.size: 4.} = enum
      QuitEvent = 0x00000100, AppTerminating, AppLowMemory, AppWillEnterBackground,
      AppDidEnterBackground, AppWillEnterForeground, AppDidEnterForeground,
      DisplayEvent = 0x00000150, WindowEvent = 0x00000200, SysWMEvent,
      KeyDown = 0x00000300, KeyUp, TextEditing, TextInput, KeymapChanged,
      MouseMotion = 0x00000400, MouseButtonDown, MouseButtonUp, MouseWheel,
      JoyAxisMotion = 0x00000600, JoyBallMotion, JoyHatMotion, JoyButtonDown, JoyButtonUp,
      JoyDeviceAdded, JoyDeviceRemoved, ControllerAxisMotion = 0x00000650,
      ControllerButtonDown, ControllerButtonUp, ControllerDeviceAdded,
      ControllerDeviceRemoved, ControllerDeviceRemapped, FingerDown = 0x00000700,
      FingerUp, FingerMotion, DollarGesture = 0x00000800, DollarRecord, MultiGesture,
      ClipboardUpdate = 0x00000900, DropFile = 0x00001000, DropText, DropBegin,
      DropComplete, AudioDeviceAdded = 0x00001100, AudioDeviceRemoved = 0x00001101,
      SensorUpdate = 0x00001200, RenderTargetsReset = 0x00002000, RenderDeviceReset,
      UserEvent = 0x00008000, UserEvent1, UserEvent2, UserEvent3, UserEvent4, UserEvent5,
      LastEvent = 0x0000FFFF

    Event = object
      kind*: EventType
      padding: array[56 - 4, byte]

    QuitEventPtr = ptr QuitEventObj

    QuitEventObj = object
      kind*: EventType
      timestamp*: uint32

    WindowEventPtr = ptr WindowEventObj

    WindowEventObj = object
      kind*: EventType
      timestamp*: uint32
      windowID*: uint32
      event*: WindowEventID
      pad*: array[56 - 13, byte]

    KeyboardEventPtr = ptr KeyboardEventObj

    KeyboardEventObj = object
      kind*: EventType
      timestamp*: uint32
      windowID*: uint32
      state*: uint8
      repeat*: bool
      keysym*: KeySym
      pad*: array[24, byte]

    TextEditingEventPtr = ptr TextEditingEventObj

    TextEditingEventObj = object
      kind*: EventType
      timestamp*: uint32
      windowID*: uint32
      text*: array[SDL_TEXTEDITINGEVENT_TEXT_SIZE, char]
      start*, length*: int32
      pad*: array[8, byte]

    TextInputEventPtr = ptr TextInputEventObj

    TextInputEventObj = object
      kind*: EventType
      timestamp*: uint32
      windowID*: uint32
      text*: array[SDL_TEXTINPUTEVENT_TEXT_SIZE, char]
      pad*: array[24, byte]

    MouseMotionEventPtr = ptr MouseMotionEventObj

    MouseMotionEventObj = object
      kind*: EventType
      timestamp*, windowID*: uint32
      which*: uint32
      state*: uint32
      x*, y*, xrel*, yrel*: int32
      pad*: array[20, byte]

    MouseButtonEventPtr = ptr MouseButtonEventObj

    MouseButtonEventObj = object
      kind*: EventType
      timestamp*, windowID*: uint32
      which*: uint32
      button*: uint8
      state*: uint8
      clicks*: uint8
      x*, y*: cint
      pad*: array[28, byte]

    MouseWheelEventPtr = ptr MouseWheelEventObj

    MouseWheelEventObj = object
      kind*: EventType
      timestamp*, windowID*: uint32
      which*: uint32
      x*, y*: cint
      direction*: MouseWheelDirection

    JoyAxisEventPtr = ptr JoyAxisEventObj

    JoyAxisEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32
      axis*: uint8
      pad1, pad2, pad3: uint8
      value*: int16

    JoyBallEventPtr = ptr JoyBallEventObj

    JoyBallEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32
      ball*, pad1, pad2, pad3: uint8
      xrel*, yrel*: int16

    JoyHatEventPtr = ptr JoyHatEventObj

    JoyHatEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32
      hat*, value*: uint8

    JoyButtonEventPtr = ptr JoyButtonEventObj

    JoyButtonEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32
      button*, state*: uint8

    JoyDeviceEventPtr = ptr JoyDeviceEventObj

    JoyDeviceEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32

    ControllerAxisEventPtr = ptr ControllerAxisEventObj

    ControllerAxisEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32
      axis*, pad1, pad2, pad3: uint8
      value*: int16

    ControllerButtonEventPtr = ptr ControllerButtonEventObj

    ControllerButtonEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32
      button*, state*: uint8

    ControllerDeviceEventPtr = ptr ControllerDeviceEventObj

    ControllerDeviceEventObj = object
      kind*: EventType
      timestamp*: uint32
      which*: int32

    TouchID = int64

    FingerID = int64

    TouchFingerEventPtr = ptr TouchFingerEventObj

    TouchFingerEventObj = object
      kind*: EventType
      timestamp*: uint32
      touchID*: TouchID
      fingerID*: FingerID
      x*, y*, dx*, dy*, pressure*: cfloat
      pad*: array[24, byte]

    MultiGestureEventPtr = ptr MultiGestureEventObj

    MultiGestureEventObj = object
      kind*: EventType
      timestamp*: uint32
      touchID*: TouchID
      dTheta*, dDist*, x*, y*: cfloat
      numFingers*: uint16

    Finger = object
      id*: FingerID
      x*, y*: cfloat
      pressure*: cfloat

    DollarGestureEventPtr = ptr DollarGestureEventObj

    DollarGestureEventObj = object
      kind*: EventType
      timestamp*: uint32
      touchID*: TouchID
      gestureID*: GestureID
      numFingers*: uint32
      error*, x*, y*: float

    DropEventPtr = ptr DropEventObj

    DropEventObj = object
      kind*: EventType
      timestamp*: uint32
      file*: cstring

    UserEventPtr = ptr UserEventObj

    UserEventObj = object
      kind*: EventType
      timestamp*, windowID*: uint32
      code*: int32
      data1*, data2*: pointer

    Eventaction {...}{.size: 4.} = enum
      SDL_ADDEVENT, SDL_PEEKEVENT, SDL_GETEVENT

    EventFilter = proc (userdata: pointer; event: ptr Event): Bool32 {...}{.cdecl.}

    SDL_Return {...}{.size: 4.} = enum
      SdlError = -1, SdlSuccess = 0 ## \
                              ##  Return value for many SDL functions. Any function that returns like this \
                              ##  should also be discardable

    Bool32 {...}{.size: 4.} = enum
      False32 = 0, True32 = 1          ## \
                        ##  SDL_bool

    KeyState {...}{.size: 1.} = enum
      KeyReleased = 0, KeyPressed

    KeySym {...}{.pure.} = object
      scancode*: Scancode
      sym*: cint                   ## Keycode
      modstate*: int16
      unicode*: cint

    Point = tuple[x, y: cint]

    Rect = tuple[x, y: cint, w, h: cint]

    GLattr {...}{.size: 4.} = enum
      SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE,
      SDL_GL_BUFFER_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_DEPTH_SIZE, SDL_GL_STENCIL_SIZE,
      SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_BLUE_SIZE,
      SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS,
      SDL_GL_MULTISAMPLESAMPLES, SDL_GL_ACCELERATED_VISUAL, SDL_GL_RETAINED_BACKING,
      SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_EGL,
      SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_PROFILE_MASK,
      SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
      SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_CONTEXT_RESET_NOTIFICATION,
      SDL_GL_CONTEXT_NO_ERROR

    MouseWheelDirection {...}{.size: 4.} = enum
      SDL_MOUSEWHEEL_NORMAL, SDL_MOUSEWHEEL_FLIPPED

    DisplayMode = object
      format*: cuint
      w*, h*, refresh_rate*: cint
      driverData*: pointer

    WindowPtr = ptr object

    RendererPtr = ptr object

    TexturePtr = ptr object

    CursorPtr = ptr object

    GlContextPtr = ptr object

    SDL_Version = object
      major*, minor*, patch*: uint8

    RendererInfoPtr = ptr RendererInfo

    RendererInfo {...}{.pure, final.} = object
      name*: cstring
      flags*: uint32
      num_texture_formats*: uint32
      texture_formats*: array[0 .. 16 - 1, uint32]
      max_texture_width*: cint
      max_texture_height*: cint

    TextureAccess {...}{.size: 4.} = enum
      SDL_TEXTUREACCESS_STATIC, SDL_TEXTUREACCESS_STREAMING, SDL_TEXTUREACCESS_TARGET

    TextureModulate {...}{.size: 4.} = enum
      SDL_TEXTUREMODULATE_NONE, SDL_TEXTUREMODULATE_COLOR, SDL_TEXTUREMODULATE_ALPHA

    RendererFlip = cint

    SysWMType {...}{.size: 4.} = enum
      SysWM_Unknown, SysWM_Windows, SysWM_X11, SysWM_DirectFB, SysWM_Cocoa, SysWM_UIkit,
      SysWM_Wayland, SysWM_Mir, SysWM_WinRT, SysWM_Android, SysWM_Vivante

    WMinfo = object
      version*: SDL_Version
      subsystem*: SysWMType
      padding*: array[64, byte]     ## if the low-level stuff is important to you check \
                             ## SDL_syswm.h and cast padding to the right type

    Color {...}{.pure, final.} = tuple[r: uint8, g: uint8, b: uint8, a: uint8]

    Palette {...}{.pure, final.} = object
      ncolors*: cint
      colors*: ptr Color
      version*: uint32
      refcount*: cint

    PixelFormat {...}{.pure, final.} = object
      format*: uint32
      palette*: ptr Palette
      BitsPerPixel*: uint8
      BytesPerPixel*: uint8
      padding*: array[0 .. 2 - 1, uint8]
      Rmask*: uint32
      Gmask*: uint32
      Bmask*: uint32
      Amask*: uint32
      Rloss*: uint8
      Gloss*: uint8
      Bloss*: uint8
      Aloss*: uint8
      Rshift*: uint8
      Gshift*: uint8
      Bshift*: uint8
      Ashift*: uint8
      refcount*: cint
      next*: ptr PixelFormat

    BlitMapPtr {...}{.pure.} = ptr object

  couldnt find SDL_BlitMap ?

    SurfacePtr = ptr Surface

    Surface {...}{.pure, final.} = object
      flags*: uint32
      format*: ptr PixelFormat
      w*, h*, pitch*: int32
      pixels*: pointer
      userdata*: pointer
      locked*: int32
      lock_data*: pointer
      clip_rect*: Rect
      map: BlitMapPtr
      refcount*: cint

    BlendMode {...}{.size: 4.} = enum
      BlendMode_None = 0x00000000, BlendMode_Blend = 0x00000001,
      BlendMode_Add = 0x00000002, BlendMode_Mod = 0x00000004

    BlitFunction = proc (src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr;
                      dstrect: ptr Rect): cint {...}{.cdecl.}

    TimerCallback = proc (interval: uint32; param: pointer): uint32 {...}{.cdecl.}

    TimerID = cint

    MessageBoxColor {...}{.pure, final.} = object
      r*: uint8
      g*: uint8
      b*: uint8

    MessageBoxColorType = enum
      SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_TEXT,
      SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND,
      SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, SDL_MESSAGEBOX_COLOR_MAX

    MessageBoxColorScheme {...}{.pure, final.} = object
      colors*: array[MessageBoxColorType, MessageBoxColor]

    MessageBoxButtonData {...}{.pure, final.} = object
      flags*: cint
      buttonid*: cint
      text*: cstring

    MessageBoxData {...}{.pure, final.} = object
      flags*: cint
      window*: WindowPtr
      title*, message*: cstring
      numbuttons*: cint
      buttons*: ptr MessageBoxButtonData
      colorScheme*: ptr MessageBoxColorScheme

    RWopsPtr = ptr RWops

    RWops {...}{.pure, final.} = object
      size*: proc (context: RWopsPtr): int64 {...}{.cdecl, tags: [], raises: [].}
      seek*: proc (context: RWopsPtr; offset: int64; whence: cint): int64 {...}{.cdecl, tags: [],
          raises: [].}
      read*: proc (context: RWopsPtr; destination: pointer; size, maxnum: csize_t_const): csize_t_const {...}{.
          cdecl, tags: [ReadIOEffect], raises: [].}
      write*: proc (context: RWopsPtr; source: pointer; size: csize_t_const;
                  num: csize_t_const): csize_t_const {...}{.cdecl, tags: [WriteIOEffect],
          raises: [].}
      close*: proc (context: RWopsPtr): cint {...}{.cdecl, tags: [WriteIOEffect].}
      kind*: cint
      mem*: Mem

    Mem {...}{.final.} = object
      base*: ptr byte
      here*: ptr byte
      stop*: ptr byte

    VoidCallback = proc (arg: pointer): void {...}{.cdecl.}

    VulkanInstance = VkHandle

    VulkanSurface = VkNonDispatchableHandle

    SystemCursor = enum
      SDL_SYSTEM_CURSOR_ARROW,    ## Arrow
      SDL_SYSTEM_CURSOR_IBEAM,    ## I-beam
      SDL_SYSTEM_CURSOR_WAIT,     ## Wait
      SDL_SYSTEM_CURSOR_CROSSHAIR, ## Crosshair
      SDL_SYSTEM_CURSOR_WAITARROW, ## Small wait cursor (or Wait if not available)
      SDL_SYSTEM_CURSOR_SIZENWSE, ## Double arrow pointing northwest and southeast
      SDL_SYSTEM_CURSOR_SIZENESW, ## Double arrow pointing northeast and southwest
      SDL_SYSTEM_CURSOR_SIZEWE,   ## Double arrow pointing west and east
      SDL_SYSTEM_CURSOR_SIZENS,   ## Double arrow pointing north and south
      SDL_SYSTEM_CURSOR_SIZEALL,  ## Four pointed arrow pointing north, south, east, and west
      SDL_SYSTEM_CURSOR_NO,       ## Slashed circle or crossbones
      SDL_SYSTEM_CURSOR_HAND      ## Hand

# Lets

    defaultEvent = Event(kind: QuitEvent)

  a default "initialized" Event

# Consts

    LibName = "libSDL2.so"

    K_UNKNOWN: cint = 0

    K_BACKSPACE: cint = 8'i32

    K_TAB: cint = 9'i32

    K_RETURN: cint = 13'i32

    K_ESCAPE: cint = 27'i32

    K_SPACE: cint = 32'i32

    K_EXCLAIM: cint = 33'i32

    K_QUOTEDBL: cint = 34'i32

    K_HASH: cint = 35'i32

    K_DOLLAR: cint = 36'i32

    K_PERCENT: cint = 37'i32

    K_AMPERSAND: cint = 38'i32

    K_QUOTE: cint = 39'i32

    K_LEFTPAREN: cint = 40'i32

    K_RIGHTPAREN: cint = 41'i32

    K_ASTERISK: cint = 42'i32

    K_PLUS: cint = 43'i32

    K_COMMA: cint = 44'i32

    K_MINUS: cint = 45'i32

    K_PERIOD: cint = 46'i32

    K_SLASH: cint = 47'i32

    K_0: cint = 48'i32

    K_1: cint = 49'i32

    K_2: cint = 50'i32

    K_3: cint = 51'i32

    K_4: cint = 52'i32

    K_5: cint = 53'i32

    K_6: cint = 54'i32

    K_7: cint = 55'i32

    K_8: cint = 56'i32

    K_9: cint = 57'i32

    K_COLON: cint = 58'i32

    K_SEMICOLON: cint = 59'i32

    K_LESS: cint = 60'i32

    K_EQUALS: cint = 61'i32

    K_GREATER: cint = 62'i32

    K_QUESTION: cint = 63'i32

    K_AT: cint = 64'i32

    K_LEFTBRACKET: cint = 91'i32

    K_BACKSLASH: cint = 92'i32

    K_RIGHTBRACKET: cint = 93'i32

    K_CARET: cint = 94'i32

    K_UNDERSCORE: cint = 95'i32

    K_BACKQUOTE: cint = 96'i32

    K_a: cint = 97'i32

    K_b: cint = 98'i32

    K_c: cint = 99'i32

    K_d: cint = 100'i32

    K_e: cint = 101'i32

    K_f: cint = 102'i32

    K_g: cint = 103'i32

    K_h: cint = 104'i32

    K_i: cint = 105'i32

    K_j: cint = 106'i32

    K_k: cint = 107'i32

    K_l: cint = 108'i32

    K_m: cint = 109'i32

    K_n: cint = 110'i32

    K_o: cint = 111'i32

    K_p: cint = 112'i32

    K_q: cint = 113'i32

    K_r: cint = 114'i32

    K_s: cint = 115'i32

    K_t: cint = 116'i32

    K_u: cint = 117'i32

    K_v: cint = 118'i32

    K_w: cint = 119'i32

    K_x: cint = 120'i32

    K_y: cint = 121'i32

    K_z: cint = 122'i32

    K_DELETE: cint = 127'i32

    K_CAPSLOCK: cint = 1073741881'i32

    K_F1: cint = 1073741882'i32

    K_F2: cint = 1073741883'i32

    K_F3: cint = 1073741884'i32

    K_F4: cint = 1073741885'i32

    K_F5: cint = 1073741886'i32

    K_F6: cint = 1073741887'i32

    K_F7: cint = 1073741888'i32

    K_F8: cint = 1073741889'i32

    K_F9: cint = 1073741890'i32

    K_F10: cint = 1073741891'i32

    K_F11: cint = 1073741892'i32

    K_F12: cint = 1073741893'i32

    K_PRINTSCREEN: cint = 1073741894'i32

    K_SCROLLLOCK: cint = 1073741895'i32

    K_PAUSE: cint = 1073741896'i32

    K_INSERT: cint = 1073741897'i32

    K_HOME: cint = 1073741898'i32

    K_PAGEUP: cint = 1073741899'i32

    K_END: cint = 1073741901'i32

    K_PAGEDOWN: cint = 1073741902'i32

    K_RIGHT: cint = 1073741903'i32

    K_LEFT: cint = 1073741904'i32

    K_DOWN: cint = 1073741905'i32

    K_UP: cint = 1073741906'i32

    K_NUMLOCKCLEAR: cint = 1073741907'i32

    K_KP_DIVIDE: cint = 1073741908'i32

    K_KP_MULTIPLY: cint = 1073741909'i32

    K_KP_MINUS: cint = 1073741910'i32

    K_KP_PLUS: cint = 1073741911'i32

    K_KP_ENTER: cint = 1073741912'i32

    K_KP_1: cint = 1073741913'i32

    K_KP_2: cint = 1073741914'i32

    K_KP_3: cint = 1073741915'i32

    K_KP_4: cint = 1073741916'i32

    K_KP_5: cint = 1073741917'i32

    K_KP_6: cint = 1073741918'i32

    K_KP_7: cint = 1073741919'i32

    K_KP_8: cint = 1073741920'i32

    K_KP_9: cint = 1073741921'i32

    K_KP_0: cint = 1073741922'i32

    K_KP_PERIOD: cint = 1073741923'i32

    K_APPLICATION: cint = 1073741925'i32

    K_POWER: cint = 1073741926'i32

    K_KP_EQUALS: cint = 1073741927'i32

    K_F13: cint = 1073741928'i32

    K_F14: cint = 1073741929'i32

    K_F15: cint = 1073741930'i32

    K_F16: cint = 1073741931'i32

    K_F17: cint = 1073741932'i32

    K_F18: cint = 1073741933'i32

    K_F19: cint = 1073741934'i32

    K_F20: cint = 1073741935'i32

    K_F21: cint = 1073741936'i32

    K_F22: cint = 1073741937'i32

    K_F23: cint = 1073741938'i32

    K_F24: cint = 1073741939'i32

    K_EXECUTE: cint = 1073741940'i32

    K_HELP: cint = 1073741941'i32

    K_MENU: cint = 1073741942'i32

    K_SELECT: cint = 1073741943'i32

    K_STOP: cint = 1073741944'i32

    K_AGAIN: cint = 1073741945'i32

    K_UNDO: cint = 1073741946'i32

    K_CUT: cint = 1073741947'i32

    K_COPY: cint = 1073741948'i32

    K_PASTE: cint = 1073741949'i32

    K_FIND: cint = 1073741950'i32

    K_MUTE: cint = 1073741951'i32

    K_VOLUMEUP: cint = 1073741952'i32

    K_VOLUMEDOWN: cint = 1073741953'i32

    K_KP_COMMA: cint = 1073741957'i32

    K_KP_EQUALSAS400: cint = 1073741958'i32

    K_ALTERASE: cint = 1073741977'i32

    K_SYSREQ: cint = 1073741978'i32

    K_CANCEL: cint = 1073741979'i32

    K_CLEAR: cint = 1073741980'i32

    K_PRIOR: cint = 1073741981'i32

    K_RETURN2: cint = 1073741982'i32

    K_SEPARATOR: cint = 1073741983'i32

    K_OUT: cint = 1073741984'i32

    K_OPER: cint = 1073741985'i32

    K_CLEARAGAIN: cint = 1073741986'i32

    K_CRSEL: cint = 1073741987'i32

    K_EXSEL: cint = 1073741988'i32

    K_KP_00: cint = 1073742000'i32

    K_KP_000: cint = 1073742001'i32

    K_THOUSANDSSEPARATOR: cint = 1073742002'i32

    K_DECIMALSEPARATOR: cint = 1073742003'i32

    K_CURRENCYUNIT: cint = 1073742004'i32

    K_CURRENCYSUBUNIT: cint = 1073742005'i32

    K_KP_LEFTPAREN: cint = 1073742006'i32

    K_KP_RIGHTPAREN: cint = 1073742007'i32

    K_KP_LEFTBRACE: cint = 1073742008'i32

    K_KP_RIGHTBRACE: cint = 1073742009'i32

    K_KP_TAB: cint = 1073742010'i32

    K_KP_BACKSPACE: cint = 1073742011'i32

    K_KP_A: cint = 1073742012'i32

    K_KP_B: cint = 1073742013'i32

    K_KP_C: cint = 1073742014'i32

    K_KP_D: cint = 1073742015'i32

    K_KP_E: cint = 1073742016'i32

    K_KP_F: cint = 1073742017'i32

    K_KP_XOR: cint = 1073742018'i32

    K_KP_POWER: cint = 1073742019'i32

    K_KP_PERCENT: cint = 1073742020'i32

    K_KP_LESS: cint = 1073742021'i32

    K_KP_GREATER: cint = 1073742022'i32

    K_KP_AMPERSAND: cint = 1073742023'i32

    K_KP_DBLAMPERSAND: cint = 1073742024'i32

    K_KP_VERTICALBAR: cint = 1073742025'i32

    K_KP_DBLVERTICALBAR: cint = 1073742026'i32

    K_KP_COLON: cint = 1073742027'i32

    K_KP_HASH: cint = 1073742028'i32

    K_KP_SPACE: cint = 1073742029'i32

    K_KP_AT: cint = 1073742030'i32

    K_KP_EXCLAM: cint = 1073742031'i32

    K_KP_MEMSTORE: cint = 1073742032'i32

    K_KP_MEMRECALL: cint = 1073742033'i32

    K_KP_MEMCLEAR: cint = 1073742034'i32

    K_KP_MEMADD: cint = 1073742035'i32

    K_KP_MEMSUBTRACT: cint = 1073742036'i32

    K_KP_MEMMULTIPLY: cint = 1073742037'i32

    K_KP_MEMDIVIDE: cint = 1073742038'i32

    K_KP_PLUSMINUS: cint = 1073742039'i32

    K_KP_CLEAR: cint = 1073742040'i32

    K_KP_CLEARENTRY: cint = 1073742041'i32

    K_KP_BINARY: cint = 1073742042'i32

    K_KP_OCTAL: cint = 1073742043'i32

    K_KP_DECIMAL: cint = 1073742044'i32

    K_KP_HEXADECIMAL: cint = 1073742045'i32

    K_LCTRL: cint = 1073742048'i32

    K_LSHIFT: cint = 1073742049'i32

    K_LALT: cint = 1073742050'i32

    K_LGUI: cint = 1073742051'i32

    K_RCTRL: cint = 1073742052'i32

    K_RSHIFT: cint = 1073742053'i32

    K_RALT: cint = 1073742054'i32

    K_RGUI: cint = 1073742055'i32

    K_MODE: cint = 1073742081'i32

    K_AUDIONEXT: cint = 1073742082'i32

    K_AUDIOPREV: cint = 1073742083'i32

    K_AUDIOSTOP: cint = 1073742084'i32

    K_AUDIOPLAY: cint = 1073742085'i32

    K_AUDIOMUTE: cint = 1073742086'i32

    K_MEDIASELECT: cint = 1073742087'i32

    K_WWW: cint = 1073742088'i32

    K_MAIL: cint = 1073742089'i32

    K_CALCULATOR: cint = 1073742090'i32

    K_COMPUTER: cint = 1073742091'i32

    K_AC_SEARCH: cint = 1073742092'i32

    K_AC_HOME: cint = 1073742093'i32

    K_AC_BACK: cint = 1073742094'i32

    K_AC_FORWARD: cint = 1073742095'i32

    K_AC_STOP: cint = 1073742096'i32

    K_AC_REFRESH: cint = 1073742097'i32

    K_AC_BOOKMARKS: cint = 1073742098'i32

    K_BRIGHTNESSDOWN: cint = 1073742099'i32

    K_BRIGHTNESSUP: cint = 1073742100'i32

    K_DISPLAYSWITCH: cint = 1073742101'i32

    K_KBDILLUMTOGGLE: cint = 1073742102'i32

    K_KBDILLUMDOWN: cint = 1073742103'i32

    K_KBDILLUMUP: cint = 1073742104'i32

    K_EJECT: cint = 1073742105'i32

    K_SLEEP: cint = 1073742106'i32

    SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32

    SDL_TEXTINPUTEVENT_TEXT_SIZE = 32

    SDL_GL_CONTEXT_PROFILE_CORE: cint = 0x00000001

    SDL_GL_CONTEXT_PROFILE_COMPATIBILITY: cint = 0x00000002

    SDL_GL_CONTEXT_PROFILE_ES: cint = 0x00000004

    SDL_GL_CONTEXT_DEBUG_FLAG: cint = 0x00000001

    SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG: cint = 0x00000002

    SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG: cint = 0x00000004

    SDL_GL_CONTEXT_RESET_ISOLATION_FLAG: cint = 0x00000008

    SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE: cint = 0x00000000

    SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH: cint = 0x00000001

    SDL_WINDOW_FULLSCREEN: cuint = 0x00000001

    SDL_WINDOW_OPENGL: cuint = 0x00000002

    SDL_WINDOW_SHOWN: cuint = 0x00000004

    SDL_WINDOW_HIDDEN: cuint = 0x00000008

    SDL_WINDOW_BORDERLESS: cuint = 0x00000010

    SDL_WINDOW_RESIZABLE: cuint = 0x00000020

    SDL_WINDOW_MINIMIZED: cuint = 0x00000040

    SDL_WINDOW_MAXIMIZED: cuint = 0x00000080

    SDL_WINDOW_INPUT_GRABBED: cuint = 0x00000100

    SDL_WINDOW_INPUT_FOCUS: cuint = 0x00000200

    SDL_WINDOW_MOUSE_FOCUS: cuint = 0x00000400

    SDL_WINDOW_FULLSCREEN_DESKTOP: cuint = 4097'u32

    SDL_WINDOW_FOREIGN: cuint = 0x00000800

    SDL_WINDOW_ALLOW_HIGHDPI: cuint = 0x00002000

    SDL_WINDOW_MOUSE_CAPTURE: cuint = 0x00004000

    SDL_WINDOW_VULKAN: cuint = 0x10000000

    SDL_FLIP_NONE: cint = 0x00000000

    SDL_FLIP_HORIZONTAL: cint = 0x00000001

    SDL_FLIP_VERTICAL: cint = 0x00000002

    SDL_ALPHA_OPAQUE = 255

    SDL_ALPHA_TRANSPARENT = 0

    SDL_PIXELTYPE_UNKNOWN = 0

    SDL_PIXELTYPE_INDEX1 = 1

    SDL_PIXELTYPE_INDEX4 = 2

    SDL_PIXELTYPE_INDEX8 = 3

    SDL_PIXELTYPE_PACKED8 = 4

    SDL_PIXELTYPE_PACKED16 = 5

    SDL_PIXELTYPE_PACKED32 = 6

    SDL_PIXELTYPE_ARRAYU8 = 7

    SDL_PIXELTYPE_ARRAYU16 = 8

    SDL_PIXELTYPE_ARRAYU32 = 9

    SDL_PIXELTYPE_ARRAYF16 = 10

    SDL_PIXELTYPE_ARRAYF32 = 11

    SDL_BITMAPORDER_NONE = 0

    SDL_BITMAPORDER_4321 = 1

    SDL_BITMAPORDER_1234 = 2

    SDL_PACKEDORDER_NONE = 0

    SDL_PACKEDORDER_XRGB = 1

    SDL_PACKEDORDER_RGBX = 2

    SDL_PACKEDORDER_ARGB = 3

    SDL_PACKEDORDER_RGBA = 4

    SDL_PACKEDORDER_XBGR = 5

    SDL_PACKEDORDER_BGRX = 6

    SDL_PACKEDORDER_ABGR = 7

    SDL_PACKEDORDER_BGRA = 8

    SDL_ARRAYORDER_NONE = 0

    SDL_ARRAYORDER_RGB = 1

    SDL_ARRAYORDER_RGBA = 2

    SDL_ARRAYORDER_ARGB = 3

    SDL_ARRAYORDER_BGR = 4

    SDL_ARRAYORDER_BGRA = 5

    SDL_ARRAYORDER_ABGR = 6

    SDL_PACKEDLAYOUT_NONE = 0

    SDL_PACKEDLAYOUT_332 = 1

    SDL_PACKEDLAYOUT_4444 = 2

    SDL_PACKEDLAYOUT_1555 = 3

    SDL_PACKEDLAYOUT_5551 = 4

    SDL_PACKEDLAYOUT_565 = 5

    SDL_PACKEDLAYOUT_8888 = 6

    SDL_PACKEDLAYOUT_2101010 = 7

    SDL_PACKEDLAYOUT_1010102 = 8

    SDL_PIXELFORMAT_UNKNOWN = 0

    SDL_PIXELFORMAT_INDEX1LSB = 286261504'u

    SDL_PIXELFORMAT_INDEX1MSB = 287310080'u

    SDL_PIXELFORMAT_INDEX4LSB = 303039488'u

    SDL_PIXELFORMAT_INDEX4MSB = 304088064'u

    SDL_PIXELFORMAT_INDEX8 = 318769153'u

    SDL_PIXELFORMAT_RGB332 = 336660481'u

    SDL_PIXELFORMAT_RGB444 = 353504258'u

    SDL_PIXELFORMAT_RGB555 = 353570562'u

    SDL_PIXELFORMAT_BGR555 = 357764866'u

    SDL_PIXELFORMAT_ARGB4444 = 355602434'u

    SDL_PIXELFORMAT_RGBA4444 = 356651010'u

    SDL_PIXELFORMAT_ABGR4444 = 359796738'u

    SDL_PIXELFORMAT_BGRA4444 = 360845314'u

    SDL_PIXELFORMAT_ARGB1555 = 355667970'u

    SDL_PIXELFORMAT_RGBA5551 = 356782082'u

    SDL_PIXELFORMAT_ABGR1555 = 359862274'u

    SDL_PIXELFORMAT_BGRA5551 = 360976386'u

    SDL_PIXELFORMAT_RGB565 = 353701890'u

    SDL_PIXELFORMAT_BGR565 = 357896194'u

    SDL_PIXELFORMAT_RGB24 = 386930691'u

    SDL_PIXELFORMAT_BGR24 = 390076419'u

    SDL_PIXELFORMAT_RGB888 = 370546692'u

    SDL_PIXELFORMAT_RGBX8888 = 371595268'u

    SDL_PIXELFORMAT_BGR888 = 374740996'u

    SDL_PIXELFORMAT_BGRX8888 = 375789572'u

    SDL_PIXELFORMAT_ARGB8888 = 372645892'u

    SDL_PIXELFORMAT_RGBA8888 = 373694468'u

    SDL_PIXELFORMAT_ABGR8888 = 376840196'u

    SDL_PIXELFORMAT_BGRA8888 = 377888772'u

    SDL_PIXELFORMAT_ARGB2101010 = 372711428'u

    SDL_PIXELFORMAT_YV12 = 842094169'u32

    SDL_PIXELFORMAT_IYUV = 1448433993'u32

    SDL_PIXELFORMAT_YUY2 = 844715353'u32

    SDL_PIXELFORMAT_UYVY = 1498831189'u32

    SDL_PIXELFORMAT_YVYU = 1431918169'u32

    Renderer_Software: cint = 0x00000001

    Renderer_Accelerated: cint = 0x00000002

    Renderer_PresentVsync: cint = 0x00000004

    Renderer_TargetTexture: cint = 0x00000008

    SDL_SWSURFACE = 0

    SDL_PREALLOC = 0x00000001

    SDL_RLEACCEL = 0x00000002

    SDL_DONTFREE = 0x00000004

    INIT_TIMER = 0x00000001

    INIT_AUDIO = 0x00000010

    INIT_VIDEO = 0x00000020

    INIT_JOYSTICK = 0x00000200

    INIT_HAPTIC = 0x00001000

    INIT_GAMECONTROLLER = 0x00002000

    INIT_EVENTS = 0x00004000

    INIT_NOPARACHUTE = 0x00100000

    INIT_EVERYTHING = 0x0000FFFF

    SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000

    SDL_WINDOWPOS_UNDEFINED: cint = 536805376'i32

    SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000

    SDL_WINDOWPOS_CENTERED: cint = 805240832'i32

    SDL_MESSAGEBOX_ERROR = 0x00000010

    SDL_MESSAGEBOX_WARNING = 0x00000020

    SDL_MESSAGEBOX_INFORMATION = 0x00000040

    SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001

    SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002

    SDL_ANDROID_EXTERNAL_STORAGE_READ = 1'i32

    SDL_ANDROID_EXTERNAL_STORAGE_WRITE = 2'i32

    SDL_QUERY = -1

    SDL_IGNORE = 0

    SDL_DISABLE = 0

    SDL_ENABLE = 1

    BUTTON_LEFT = 1'u8

    BUTTON_MIDDLE = 2'u8

    BUTTON_RIGHT = 3'u8

    BUTTON_X1 = 4'u8

    BUTTON_X2 = 5'u8

    BUTTON_LMASK = 1'u8

    BUTTON_MMASK = 2'u8

    BUTTON_RMASK = 4'u8

    BUTTON_X1MASK = 8'u8

    BUTTON_X2MASK = 16'u8

    SDL_TOUCH_MOUSEID = 4294967295'u32

    HINT_RENDER_SCALE_QUALITY = "SDL_RENDER_SCALE_QUALITY"

# Procs

    proc evWindow(event`gensym16655034: Event): WindowEventPtr {...}{.raises: [], tags: [].}

    proc window(event`gensym16655035: Event): WindowEventPtr {...}{.raises: [], tags: [].}

    proc evKeyboard(event`gensym16690217: Event): KeyboardEventPtr {...}{.raises: [], tags: [].}

    proc key(event`gensym16690218: Event): KeyboardEventPtr {...}{.raises: [], tags: [].}

    proc evTextEditing(event`gensym16725217: Event): TextEditingEventPtr {...}{.raises: [],
        tags: [].}

    proc edit(event`gensym16725218: Event): TextEditingEventPtr {...}{.raises: [], tags: [].}

    proc evTextInput(event`gensym16760217: Event): TextInputEventPtr {...}{.raises: [],
        tags: [].}

    proc text(event`gensym16760218: Event): TextInputEventPtr {...}{.raises: [], tags: [].}

    proc evMouseMotion(event`gensym16795217: Event): MouseMotionEventPtr {...}{.raises: [],
        tags: [].}

    proc motion(event`gensym16795218: Event): MouseMotionEventPtr {...}{.raises: [], tags: [].}

    proc evMouseButton(event`gensym16830217: Event): MouseButtonEventPtr {...}{.raises: [],
        tags: [].}

    proc button(event`gensym16830218: Event): MouseButtonEventPtr {...}{.raises: [], tags: [].}

    proc evMouseWheel(event`gensym16865217: Event): MouseWheelEventPtr {...}{.raises: [],
        tags: [].}

    proc wheel(event`gensym16865218: Event): MouseWheelEventPtr {...}{.raises: [], tags: [].}

    proc EvJoyAxis(event`gensym16900217: Event): JoyAxisEventPtr {...}{.raises: [], tags: [].}

    proc jaxis(event`gensym16900218: Event): JoyAxisEventPtr {...}{.raises: [], tags: [].}

    proc EvJoyBall(event`gensym16935217: Event): JoyBallEventPtr {...}{.raises: [], tags: [].}

    proc jball(event`gensym16935218: Event): JoyBallEventPtr {...}{.raises: [], tags: [].}

    proc EvJoyHat(event`gensym16970217: Event): JoyHatEventPtr {...}{.raises: [], tags: [].}

    proc jhat(event`gensym16970218: Event): JoyHatEventPtr {...}{.raises: [], tags: [].}

    proc EvJoyButton(event`gensym17005217: Event): JoyButtonEventPtr {...}{.raises: [],
        tags: [].}

    proc jbutton(event`gensym17005218: Event): JoyButtonEventPtr {...}{.raises: [], tags: [].}

    proc EvJoyDevice(event`gensym17040217: Event): JoyDeviceEventPtr {...}{.raises: [],
        tags: [].}

    proc jdevice(event`gensym17040218: Event): JoyDeviceEventPtr {...}{.raises: [], tags: [].}

    proc EvControllerAxis(event`gensym17075217: Event): ControllerAxisEventPtr {...}{.
        raises: [], tags: [].}

    proc caxis(event`gensym17075218: Event): ControllerAxisEventPtr {...}{.raises: [], tags: [].}

    proc EvControllerButton(event`gensym17110217: Event): ControllerButtonEventPtr {...}{.
        raises: [], tags: [].}

    proc cbutton(event`gensym17110218: Event): ControllerButtonEventPtr {...}{.raises: [],
        tags: [].}

    proc EvControllerDevice(event`gensym17145217: Event): ControllerDeviceEventPtr {...}{.
        raises: [], tags: [].}

    proc cdevice(event`gensym17145218: Event): ControllerDeviceEventPtr {...}{.raises: [],
        tags: [].}

    proc EvTouchFinger(event`gensym17180217: Event): TouchFingerEventPtr {...}{.raises: [],
        tags: [].}

    proc tfinger(event`gensym17180218: Event): TouchFingerEventPtr {...}{.raises: [], tags: [].}

    proc EvMultiGesture(event`gensym17215217: Event): MultiGestureEventPtr {...}{.raises: [],
        tags: [].}

    proc mgesture(event`gensym17215218: Event): MultiGestureEventPtr {...}{.raises: [],
        tags: [].}

    proc EvDollarGesture(event`gensym17250217: Event): DollarGestureEventPtr {...}{.
        raises: [], tags: [].}

    proc dgesture(event`gensym17250218: Event): DollarGestureEventPtr {...}{.raises: [],
        tags: [].}

    proc evDropFile(event`gensym17285217: Event): DropEventPtr {...}{.raises: [], tags: [].}

    proc drop(event`gensym17285218: Event): DropEventPtr {...}{.raises: [], tags: [].}

    proc evQuit(event`gensym17320217: Event): QuitEventPtr {...}{.raises: [], tags: [].}

    proc quit(event`gensym17320218: Event): QuitEventPtr {...}{.raises: [], tags: [].}

    proc evUser(event`gensym17355217: Event): UserEventPtr {...}{.raises: [], tags: [].}

    proc user(event`gensym17355218: Event): UserEventPtr {...}{.raises: [], tags: [].}

    proc getWMInfo(window: WindowPtr; info: var WMinfo): Bool32 {...}{.
        importc: "SDL_GetWindowWMInfo".}

    proc setLogicalSize(renderer: RendererPtr; w, h: cint): cint {...}{.
        importc: "SDL_RenderSetLogicalSize".}

    proc getLogicalSize(renderer: RendererPtr; w, h: var cint) {...}{.
        importc: "SDL_RenderGetLogicalSize".}

    proc setDrawColor(renderer: RendererPtr; r, g, b: uint8; a = 255'u8): SDL_Return {...}{.
        importc: "SDL_SetRenderDrawColor", discardable.}

    proc setDrawColor(renderer: RendererPtr; c: Color) {...}{.raises: [], tags: [].}

    proc getDrawColor(renderer: RendererPtr; r, g, b, a: var uint8): SDL_Return {...}{.
        importc: "SDL_GetRenderDrawColor", discardable.}

    proc setDrawBlendMode(renderer: RendererPtr; blendMode: BlendMode): SDL_Return {...}{.
        importc: "SDL_SetRenderDrawBlendMode", discardable.}

    proc getDrawBlendMode(renderer: RendererPtr; blendMode: var BlendMode): SDL_Return {...}{.
        importc: "SDL_GetRenderDrawBlendMode", discardable.}

    proc destroy(texture: TexturePtr) {...}{.importc: "SDL_DestroyTexture".}

    proc destroy(renderer: RendererPtr) {...}{.importc: "SDL_DestroyRenderer".}

    proc getDisplayIndex(window: WindowPtr): cint {...}{.importc: "SDL_GetWindowDisplayIndex".}

    proc setDisplayMode(window: WindowPtr; mode: ptr DisplayMode): SDL_Return {...}{.
        importc: "SDL_SetWindowDisplayMode".}

    proc getDisplayMode(window: WindowPtr; mode: var DisplayMode): cint {...}{.
        importc: "SDL_GetWindowDisplayMode".}

    proc getPixelFormat(window: WindowPtr): uint32 {...}{.importc: "SDL_GetWindowPixelFormat".}

    proc getID(window: WindowPtr): uint32 {...}{.importc: "SDL_GetWindowID".}

    proc getFlags(window: WindowPtr): uint32 {...}{.importc: "SDL_GetWindowFlags".}

    proc setTitle(window: WindowPtr; title: cstring) {...}{.importc: "SDL_SetWindowTitle".}

    proc getTitle(window: WindowPtr): cstring {...}{.importc: "SDL_GetWindowTitle".}

    proc setIcon(window: WindowPtr; icon: SurfacePtr) {...}{.importc: "SDL_SetWindowIcon".}

    proc setData(window: WindowPtr; name: cstring; userdata: pointer): pointer {...}{.
        importc: "SDL_SetWindowData".}

    proc getData(window: WindowPtr; name: cstring): pointer {...}{.importc: "SDL_GetWindowData".}

    proc setPosition(window: WindowPtr; x, y: cint) {...}{.importc: "SDL_SetWindowPosition".}

    proc getPosition(window: WindowPtr; x, y: var cint) {...}{.importc: "SDL_GetWindowPosition".}

    proc setSize(window: WindowPtr; w, h: cint) {...}{.importc: "SDL_SetWindowSize".}

    proc getSize(window: WindowPtr; w, h: var cint) {...}{.importc: "SDL_GetWindowSize".}

    proc setBordered(window: WindowPtr; bordered: Bool32) {...}{.
        importc: "SDL_SetWindowBordered".}

    proc setFullscreen(window: WindowPtr; fullscreen: uint32): SDL_Return {...}{.
        importc: "SDL_SetWindowFullscreen".}

    proc getSurface(window: WindowPtr): SurfacePtr {...}{.importc: "SDL_GetWindowSurface".}

    proc updateSurface(window: WindowPtr): SDL_Return {...}{.
        importc: "SDL_UpdateWindowSurface".}

    proc updateSurfaceRects(window: WindowPtr; rects: ptr Rect; numrects: cint): SDL_Return {...}{.
        importc: "SDL_UpdateWindowSurfaceRects".}

    proc setGrab(window: WindowPtr; grabbed: Bool32) {...}{.importc: "SDL_SetWindowGrab".}

    proc getGrab(window: WindowPtr): Bool32 {...}{.importc: "SDL_GetWindowGrab".}

    proc setBrightness(window: WindowPtr; brightness: cfloat): SDL_Return {...}{.
        importc: "SDL_SetWindowBrightness".}

    proc getBrightness(window: WindowPtr): cfloat {...}{.importc: "SDL_GetWindowBrightness".}

    proc setGammaRamp(window: WindowPtr; red, green, blue: ptr uint16): SDL_Return {...}{.
        importc: "SDL_SetWindowGammaRamp".}

    proc getGammaRamp(window: WindowPtr; red: ptr uint16; green: ptr uint16; blue: ptr uint16): cint {...}{.
        importc: "SDL_GetWindowGammaRamp".}

    proc init(flags: cint): SDL_Return {...}{.discardable, importc: "SDL_Init".}

    proc initSubSystem(flags: uint32): cint {...}{.importc: "SDL_InitSubSystem".}

    proc quitSubSystem(flags: uint32) {...}{.importc: "SDL_QuitSubSystem".}

    proc wasInit(flags: uint32): uint32 {...}{.importc: "SDL_WasInit".}

    proc quit() {...}{.importc: "SDL_Quit".}

    proc getPlatform(): cstring {...}{.importc: "SDL_GetPlatform".}

    proc getVersion(ver: var SDL_Version) {...}{.importc: "SDL_GetVersion".}

    proc getRevision(): cstring {...}{.importc: "SDL_GetRevision".}

    proc getRevisionNumber(): cint {...}{.importc: "SDL_GetRevisionNumber".}

    proc getBasePath(): cstring {...}{.importc: "SDL_GetBasePath".}

    proc getPrefPath(org, app: cstring): cstring {...}{.importc: "SDL_GetPrefPath".}

    proc getNumRenderDrivers(): cint {...}{.importc: "SDL_GetNumRenderDriver".}

    proc getRenderDriverInfo(index: cint; info: var RendererInfo): SDL_Return {...}{.
        importc: "SDL_GetRenderDriverInfo".}

    proc createWindowAndRenderer(width, height: cint; window_flags: uint32;
                                window: var WindowPtr; renderer: var RendererPtr): SDL_Return {...}{.
        importc: "SDL_CreateWindowAndRenderer".}

    proc createRenderer(window: WindowPtr; index: cint; flags: cint): RendererPtr {...}{.
        importc: "SDL_CreateRenderer".}

    proc createSoftwareRenderer(surface: SurfacePtr): RendererPtr {...}{.
        importc: "SDL_CreateSoftwareRenderer".}

    proc getRenderer(window: WindowPtr): RendererPtr {...}{.importc: "SDL_GetRenderer".}

    proc getRendererInfo(renderer: RendererPtr; info: RendererInfoPtr): cint {...}{.
        importc: "SDL_GetRendererInfo".}

    proc getRendererOutputSize(renderer: RendererPtr; w: ptr cint; h: ptr cint): cint {...}{.
        importc: "SDL_GetRendererOutputSize".}

    proc createTexture(renderer: RendererPtr; format: uint32; access, w, h: cint): TexturePtr {...}{.
        importc: "SDL_CreateTexture".}

    proc createTextureFromSurface(renderer: RendererPtr; surface: SurfacePtr): TexturePtr {...}{.
        importc: "SDL_CreateTextureFromSurface".}

    proc createTexture(renderer: RendererPtr; surface: SurfacePtr): TexturePtr {...}{.inline,
        raises: [], tags: [].}

    proc queryTexture(texture: TexturePtr; format: ptr uint32; access, w, h: ptr cint): SDL_Return {...}{.
        discardable, importc: "SDL_QueryTexture".}

    proc setTextureColorMod(texture: TexturePtr; r, g, b: uint8): SDL_Return {...}{.
        importc: "SDL_SetTextureColorMod".}

    proc getTextureColorMod(texture: TexturePtr; r, g, b: var uint8): SDL_Return {...}{.
        importc: "SDL_GetTextureColorMod".}

    proc setTextureAlphaMod(texture: TexturePtr; alpha: uint8): SDL_Return {...}{.
        importc: "SDL_SetTextureAlphaMod", discardable.}

    proc getTextureAlphaMod(texture: TexturePtr; alpha: var uint8): SDL_Return {...}{.
        importc: "SDL_GetTextureAlphaMod", discardable.}

    proc setTextureBlendMode(texture: TexturePtr; blendMode: BlendMode): SDL_Return {...}{.
        importc: "SDL_SetTextureBlendMode", discardable.}

    proc getTextureBlendMode(texture: TexturePtr; blendMode: var BlendMode): SDL_Return {...}{.
        importc: "SDL_GetTextureBlendMode", discardable.}

    proc updateTexture(texture: TexturePtr; rect: ptr Rect; pixels: pointer; pitch: cint): SDL_Return {...}{.
        importc: "SDL_UpdateTexture", discardable.}

    proc lockTexture(texture: TexturePtr; rect: ptr Rect; pixels: ptr pointer;
                    pitch: ptr cint): SDL_Return {...}{.importc: "SDL_LockTexture", discardable.}

    proc unlockTexture(texture: TexturePtr) {...}{.importc: "SDL_UnlockTexture".}

    proc renderTargetSupported(renderer: RendererPtr): Bool32 {...}{.
        importc: "SDL_RenderTargetSupported".}

    proc setRenderTarget(renderer: RendererPtr; texture: TexturePtr): SDL_Return {...}{.
        discardable, importc: "SDL_SetRenderTarget".}

    proc getRenderTarget(renderer: RendererPtr): TexturePtr {...}{.
        importc: "SDL_GetRenderTarget".}

    proc setViewport(renderer: RendererPtr; rect: ptr Rect): SDL_Return {...}{.
        importc: "SDL_RenderSetViewport", discardable.}

    proc getViewport(renderer: RendererPtr; rect: var Rect) {...}{.
        importc: "SDL_RenderGetViewport".}

    proc setScale(renderer: RendererPtr; scaleX, scaleY: cfloat): SDL_Return {...}{.
        importc: "SDL_RenderSetScale", discardable.}

    proc getScale(renderer: RendererPtr; scaleX, scaleY: var cfloat) {...}{.
        importc: "SDL_RenderGetScale".}

    proc drawPoint(renderer: RendererPtr; x, y: cint): SDL_Return {...}{.
        importc: "SDL_RenderDrawPoint", discardable.}

    proc drawPoints(renderer: RendererPtr; points: ptr Point; count: cint): SDL_Return {...}{.
        importc: "SDL_RenderDrawPoints", discardable.}

    proc drawLine(renderer: RendererPtr; x1, y1, x2, y2: cint): SDL_Return {...}{.
        importc: "SDL_RenderDrawLine", discardable.}

    proc drawLines(renderer: RendererPtr; points: ptr Point; count: cint): SDL_Return {...}{.
        importc: "SDL_RenderDrawLines", discardable.}

    proc drawRect(renderer: RendererPtr; rect: var Rect): SDL_Return {...}{.
        importc: "SDL_RenderDrawRect", discardable.}

    proc drawRect(renderer: RendererPtr; rect: ptr Rect = nil): SDL_Return {...}{.
        importc: "SDL_RenderDrawRect", discardable.}

    proc drawRects(renderer: RendererPtr; rects: ptr Rect; count: cint): SDL_Return {...}{.
        importc: "SDL_RenderDrawRects".}

    proc fillRect(renderer: RendererPtr; rect: var Rect): SDL_Return {...}{.
        importc: "SDL_RenderFillRect", discardable.}

    proc fillRect(renderer: RendererPtr; rect: ptr Rect = nil): SDL_Return {...}{.
        importc: "SDL_RenderFillRect", discardable.}

    proc fillRects(renderer: RendererPtr; rects: ptr Rect; count: cint): SDL_Return {...}{.
        importc: "SDL_RenderFillRects", discardable.}

    proc copy(renderer: RendererPtr; texture: TexturePtr; srcrect, dstrect: ptr Rect): SDL_Return {...}{.
        importc: "SDL_RenderCopy", discardable.}

    proc copyEx(renderer: RendererPtr; texture: TexturePtr; srcrect, dstrect: var Rect;
               angle: cdouble; center: ptr Point; flip: RendererFlip = SDL_FLIP_NONE): SDL_Return {...}{.
        importc: "SDL_RenderCopyEx", discardable.}

    proc copyEx(renderer: RendererPtr; texture: TexturePtr; srcrect, dstrect: ptr Rect;
               angle: cdouble; center: ptr Point; flip: RendererFlip = SDL_FLIP_NONE): SDL_Return {...}{.
        importc: "SDL_RenderCopyEx", discardable.}

    proc clear(renderer: RendererPtr): cint {...}{.importc: "SDL_RenderClear", discardable.}

    proc readPixels(renderer: RendererPtr; rect: var Rect; format: cint; pixels: pointer;
                   pitch: cint): cint {...}{.importc: "SDL_RenderReadPixels".}

    proc readPixels(renderer: RendererPtr; rect: ptr Rect; format: cint; pixels: pointer;
                   pitch: cint): cint {...}{.importc: "SDL_RenderReadPixels".}

    proc present(renderer: RendererPtr) {...}{.importc: "SDL_RenderPresent".}

    proc glBindTexture(texture: TexturePtr; texw, texh: var cfloat): cint {...}{.
        importc: "SDL_GL_BindTexture".}

    proc glUnbindTexture(texture: TexturePtr) {...}{.importc: "SDL_GL_UnbindTexture".}

    proc createRGBSurface(flags: cint; width, height, depth: cint;
                         Rmask, Gmask, BMask, Amask: uint32): SurfacePtr {...}{.
        importc: "SDL_CreateRGBSurface".}

    proc createRGBSurfaceFrom(pixels: pointer; width, height, depth, pitch: cint;
                             Rmask, Gmask, Bmask, Amask: uint32): SurfacePtr {...}{.
        importc: "SDL_CreateRGBSurfaceFrom".}

    proc freeSurface(surface: SurfacePtr) {...}{.importc: "SDL_FreeSurface".}

    proc setSurfacePalette(surface: SurfacePtr; palette: ptr Palette): cint {...}{.
        importc: "SDL_SetSurfacePalette".}

    proc lockSurface(surface: SurfacePtr): cint {...}{.importc: "SDL_LockSurface".}

    proc unlockSurface(surface: SurfacePtr) {...}{.importc: "SDL_UnlockSurface".}

    proc loadBMP_RW(src: RWopsPtr; freesrc: cint): SurfacePtr {...}{.importc: "SDL_LoadBMP_RW".}

    proc rwFromFile(file: cstring; mode: cstring): RWopsPtr {...}{.importc: "SDL_RWFromFile".}

    proc rwFromFP(fp: File; autoclose: Bool32): RWopsPtr {...}{.importc: "SDL_RWFromFP".}

    proc rwFromMem(mem: pointer; size: cint): RWopsPtr {...}{.importc: "SDL_RWFromMem".}

    proc rwFromConstMem(mem: pointer; size: cint): RWopsPtr {...}{.
        importc: "SDL_RWFromConstMem".}

    proc allocRW(): RWopsPtr {...}{.importc: "SDL_AllocRW".}

    proc freeRW(area: RWopsPtr) {...}{.importc: "SDL_FreeRW".}

    proc saveBMP_RW(surface: SurfacePtr; dst: RWopsPtr; freedst: cint): SDL_Return {...}{.
        importc: "SDL_SaveBMP_RW".}

    proc setSurfaceRLE(surface: SurfacePtr; flag: cint): cint {...}{.
        importc: "SDL_SetSurfaceRLE".}

    proc setColorKey(surface: SurfacePtr; flag: cint; key: uint32): cint {...}{.
        importc: "SDL_SetColorKey".}

    proc getColorKey(surface: SurfacePtr; key: var uint32): cint {...}{.
        importc: "SDL_GetColorKey".}

    proc setSurfaceColorMod(surface: SurfacePtr; r, g, b: uint8): cint {...}{.
        importc: "SDL_SetSurfaceColorMod".}

    proc getSurfaceColorMod(surface: SurfacePtr; r, g, b: var uint8): cint {...}{.
        importc: "SDL_GetSurfaceColorMod".}

    proc setSurfaceAlphaMod(surface: SurfacePtr; alpha: uint8): cint {...}{.
        importc: "SDL_SetSurfaceAlphaMod".}

    proc getSurfaceAlphaMod(surface: SurfacePtr; alpha: var uint8): cint {...}{.
        importc: "SDL_GetSurfaceAlphaMod".}

    proc setSurfaceBlendMode(surface: SurfacePtr; blendMode: BlendMode): cint {...}{.
        importc: "SDL_SetSurfaceBlendMode".}

    proc getSurfaceBlendMode(surface: SurfacePtr; blendMode: ptr BlendMode): cint {...}{.
        importc: "SDL_GetSurfaceBlendMode".}

    proc setClipRect(surface: SurfacePtr; rect: ptr Rect): Bool32 {...}{.
        importc: "SDL_SetClipRect".}

    proc getClipRect(surface: SurfacePtr; rect: ptr Rect) {...}{.importc: "SDL_GetClipRect".}

    proc setClipRect(renderer: RendererPtr; rect: ptr Rect): cint {...}{.
        importc: "SDL_RenderSetClipRect".}

    proc getClipRect(renderer: RendererPtr; rect: ptr Rect): cint {...}{.
        importc: "SDL_RenderGetClipRect".}

    proc isClipEnabled(renderer: RendererPtr): cint {...}{.importc: "SDL_RenderIsClipEnabled".}

    proc convertSurface(src: SurfacePtr; fmt: ptr PixelFormat; flags: cint): SurfacePtr {...}{.
        importc: "SDL_ConvertSurface".}

    proc convertSurfaceFormat(src: SurfacePtr; pixel_format, flags: uint32): SurfacePtr {...}{.
        importc: "SDL_ConvertSurfaceFormat".}

    proc convertPixels(width, height: cint; src_format: uint32; src: pointer;
                      src_pitch: cint; dst_format: uint32; dst: pointer; dst_pitch: cint): cint {...}{.
        importc: "SDL_ConvertPixels".}

    proc fillRect(dst: SurfacePtr; rect: ptr Rect; color: uint32): SDL_Return {...}{.
        importc: "SDL_FillRect", discardable.}

    proc fillRects(dst: SurfacePtr; rects: ptr Rect; count: cint; color: uint32): cint {...}{.
        importc: "SDL_FillRects".}

    proc upperBlit(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr; dstrect: ptr Rect): SDL_Return {...}{.
        importc: "SDL_UpperBlit".}

    proc lowerBlit(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr; dstrect: ptr Rect): SDL_Return {...}{.
        importc: "SDL_LowerBlit".}

    proc softStretch(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr; dstrect: ptr Rect): SDL_Return {...}{.
        importc: "SDL_SoftStretch".}

    proc upperBlitScaled(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr;
                        dstrect: ptr Rect): SDL_Return {...}{.importc: "SDL_UpperBlitScaled".}

    proc lowerBlitScaled(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr;
                        dstrect: ptr Rect): SDL_Return {...}{.importc: "SDL_LowerBlitScaled".}

    proc readU8(src: RWopsPtr): uint8 {...}{.importc: "SDL_ReadU8".}

    proc readLE16(src: RWopsPtr): uint16 {...}{.importc: "SDL_ReadLE16".}

    proc readBE16(src: RWopsPtr): uint16 {...}{.importc: "SDL_ReadBE16".}

    proc readLE32(src: RWopsPtr): uint32 {...}{.importc: "SDL_ReadLE32".}

    proc readBE32(src: RWopsPtr): uint32 {...}{.importc: "SDL_ReadBE32".}

    proc readLE64(src: RWopsPtr): uint64 {...}{.importc: "SDL_ReadLE64".}

    proc readBE64(src: RWopsPtr): uint64 {...}{.importc: "SDL_ReadBE64".}

    proc writeU8(dst: RWopsPtr; value: uint8): csize_t_const {...}{.importc: "SDL_WriteU8".}

    proc writeLE16(dst: RWopsPtr; value: uint16): csize_t_const {...}{.importc: "SDL_WriteLE16".}

    proc writeBE16(dst: RWopsPtr; value: uint16): csize_t_const {...}{.importc: "SDL_WriteBE16".}

    proc writeLE32(dst: RWopsPtr; value: uint32): csize_t_const {...}{.importc: "SDL_WriteLE32".}

    proc writeBE32(dst: RWopsPtr; value: uint32): csize_t_const {...}{.importc: "SDL_WriteBE32".}

    proc writeLE64(dst: RWopsPtr; value: uint64): csize_t_const {...}{.importc: "SDL_WriteLE64".}

    proc writeBE64(dst: RWopsPtr; value: uint64): csize_t_const {...}{.importc: "SDL_WriteBE64".}

    proc showMessageBox(messageboxdata: ptr MessageBoxData; buttonid: var cint): cint {...}{.
        importc: "SDL_ShowMessageBox".}

    proc showSimpleMessageBox(flags: uint32; title, message: cstring; window: WindowPtr): cint {...}{.
        importc: "SDL_ShowSimpleMessageBox".}

    proc getNumVideoDrivers(): cint {...}{.importc: "SDL_GetNumVideoDrivers".}

    proc getVideoDriver(index: cint): cstring {...}{.importc: "SDL_GetVideoDriver".}

    proc videoInit(driver_name: cstring): SDL_Return {...}{.importc: "SDL_VideoInit".}

    proc videoQuit() {...}{.importc: "SDL_VideoQuit".}

    proc getCurrentVideoDriver(): cstring {...}{.importc: "SDL_GetCurrentVideoDriver".}

    proc getNumVideoDisplays(): cint {...}{.importc: "SDL_GetNumVideoDisplays".}

    proc getDisplayBounds(displayIndex: cint; rect: var Rect): SDL_Return {...}{.
        importc: "SDL_GetDisplayBounds".}

    proc getNumDisplayModes(displayIndex: cint): cint {...}{.
        importc: "SDL_GetNumDisplayModes".}

    proc getDisplayMode(displayIndex: cint; modeIndex: cint; mode: var DisplayMode): SDL_Return {...}{.
        importc: "SDL_GetDisplayMode".}

    proc getDesktopDisplayMode(displayIndex: cint; mode: var DisplayMode): SDL_Return {...}{.
        importc: "SDL_GetDesktopDisplayMode".}

    proc getCurrentDisplayMode(displayIndex: cint; mode: var DisplayMode): SDL_Return {...}{.
        importc: "SDL_GetCurrentDisplayMode".}

    proc getClosestDisplayMode(displayIndex: cint; mode: ptr DisplayMode;
                              closest: ptr DisplayMode): ptr DisplayMode {...}{.
        importc: "SDL_GetClosestDisplayMode".}

    proc getDisplayDPI(displayIndex: cint; ddpi, hdpi, vdpi: ptr cfloat): SDL_Return {...}{.
        importc: "SDL_GetDisplayDPI".}

    proc createWindow(title: cstring; x, y, w, h: cint; flags: uint32): WindowPtr {...}{.
        importc: "SDL_CreateWindow".}

    proc createWindowFrom(data: pointer): WindowPtr {...}{.importc: "SDL_CreateWindowFrom".}

    proc getWindowFromID(id: uint32): WindowPtr {...}{.importc: "SDL_GetWindowFromID".}

    proc showWindow(window: WindowPtr) {...}{.importc: "SDL_ShowWindow".}

    proc hideWindow(window: WindowPtr) {...}{.importc: "SDL_HideWindow".}

    proc raiseWindow(window: WindowPtr) {...}{.importc: "SDL_RaiseWindow".}

    proc maximizeWindow(window: WindowPtr) {...}{.importc: "SDL_MaximizeWindow".}

    proc minimizeWindow(window: WindowPtr) {...}{.importc: "SDL_MinimizeWindow".}

    proc restoreWindow(window: WindowPtr) {...}{.importc: "SDL_RestoreWindow".}

    proc destroyWindow(window: WindowPtr) {...}{.importc: "SDL_DestroyWindow".}

    proc isScreenSaverEnabled(): Bool32 {...}{.importc: "SDL_IsScreenSaverEnabled".}

    proc enableScreenSaver() {...}{.importc: "SDL_EnableScreenSaver".}

    proc disableScreenSaver() {...}{.importc: "SDL_DisableScreenSaver".}

    proc getTicks(): uint32 {...}{.importc: "SDL_GetTicks".}

    proc getPerformanceCounter(): uint64 {...}{.importc: "SDL_GetPerformanceCounter".}

    proc getPerformanceFrequency(): uint64 {...}{.importc: "SDL_GetPerformanceFrequency".}

    proc delay(ms: uint32) {...}{.importc: "SDL_Delay".}

    proc addTimer(interval: uint32; callback: TimerCallback; param: pointer): TimerID {...}{.
        importc: "SDL_AddTimer".}

    proc removeTimer(id: TimerID): Bool32 {...}{.importc: "SDL_RemoveTimer".}

    proc glLoadLibrary(path: cstring): SDL_Return {...}{.discardable,
        importc: "SDL_GL_LoadLibrary".}

    proc glGetProcAddress(procedure: cstring): pointer {...}{.
        importc: "SDL_GL_GetProcAddress".}

    proc glUnloadLibrary() {...}{.importc: "SDL_GL_UnloadLibrary".}

    proc glExtensionSupported(extension: cstring): bool {...}{.
        importc: "SDL_GL_ExtensionSupported".}

    proc glSetAttribute(attr: GLattr; value: cint): cint {...}{.importc: "SDL_GL_SetAttribute".}

    proc glGetAttribute(attr: GLattr; value: var cint): cint {...}{.
        importc: "SDL_GL_GetAttribute".}

    proc glCreateContext(window: WindowPtr): GlContextPtr {...}{.
        importc: "SDL_GL_CreateContext".}

  Create an OpenGL context for use with an OpenGL window, and make it current.

    proc glMakeCurrent(window: WindowPtr; context: GlContextPtr): cint {...}{.
        importc: "SDL_GL_MakeCurrent".}

    proc glGetCurrentWindow(): WindowPtr {...}{.importc: "SDL_GL_GetCurrentWindow".}

    proc glGetCurrentContext(): GlContextPtr {...}{.importc: "SDL_GL_GetCurrentContext".}

    proc glGetDrawableSize(window: WindowPtr; w, h: var cint) {...}{.
        importc: "SDL_GL_GetDrawableSize".}

    proc glSetSwapInterval(interval: cint): cint {...}{.importc: "SDL_GL_SetSwapInterval".}

    proc glGetSwapInterval(): cint {...}{.importc: "SDL_GL_GetSwapInterval".}

    proc glSwapWindow(window: WindowPtr) {...}{.importc: "SDL_GL_SwapWindow".}

  Swap the OpenGL buffers for a window, if double-buffering is supported.

    proc glDeleteContext(context: GlContextPtr) {...}{.importc: "SDL_GL_DeleteContext".}

    proc vulkanLoadLibrary(path: cstring): cint {...}{.importc: "SDL_Vulkan_LoadLibrary".}

    proc vulkanGetVkGetInstanceProcAddr(): pointer {...}{.
        importc: "SDL_Vulkan_GetVkGetInstanceProcAddr".}

    proc vulkanUnloadLibrary() {...}{.importc: "SDL_Vulkan_UnloadLibrary".}

    proc vulkanGetInstanceExtensions(window: WindowPtr; pCount: ptr cuint;
                                    pNames: cstringArray): Bool32 {...}{.
        importc: "SDL_Vulkan_GetInstanceExtensions".}

    proc vulkanCreateSurface(window: WindowPtr; instance: VulkanInstance;
                            surface: ptr VulkanSurface): Bool32 {...}{.
        importc: "SDL_Vulkan_CreateSurface".}

    proc vulkanGetDrawableSize(window: WindowPtr; w, h: ptr cint) {...}{.
        importc: "SDL_Vulkan_GetDrawableSize".}

    proc getKeyboardFocus(): WindowPtr {...}{.importc: "SDL_GetKeyboardFocus".}

    proc getKeyboardState(numkeys: ptr int = nil): ptr array[0 .. SDL_NUM_SCANCODES.int, uint8] {...}{.
        importc: "SDL_GetKeyboardState".}

    proc getModState(): Keymod {...}{.importc: "SDL_GetModState".}

    proc setModState(state: Keymod) {...}{.importc: "SDL_SetModState".}

    proc getKeyFromScancode(scancode: Scancode): cint {...}{.
        importc: "SDL_GetKeyFromScancode".}

    proc getScancodeFromKey(key: cint): Scancode {...}{.importc: "SDL_GetScancodeFromKey".}

    proc getScancodeName(scancode: Scancode): cstring {...}{.importc: "SDL_GetScancodeName".}

    proc getScancodeFromName(name: cstring): Scancode {...}{.
        importc: "SDL_GetScancodeFromName".}

    proc getKeyName(key: cint): cstring {...}{.importc: "SDL_GetKeyName".}

    proc getKeyFromName(name: cstring): cint {...}{.importc: "SDL_GetKeyFromName".}

    proc startTextInput() {...}{.importc: "SDL_StartTextInput".}

    proc isTextInputActive(): bool {...}{.importc: "SDL_IsTextInputActive".}

    proc stopTextInput() {...}{.importc: "SDL_StopTextInput".}

    proc setTextInputRect(rect: ptr Rect) {...}{.importc: "SDL_SetTextInputRect".}

    proc hasScreenKeyboardSupport(): bool {...}{.importc: "SDL_HasScreenKeyboardSupport".}

    proc isScreenKeyboardShown(window: WindowPtr): bool {...}{.
        importc: "SDL_IsScreenKeyboardShown".}

    proc getMouseFocus(): WindowPtr {...}{.importc: "SDL_GetMouseFocus".}

    proc getMouseState(x, y: var cint): uint8 {...}{.importc: "SDL_GetMouseState", discardable.}

    proc getMouseState(x, y: ptr cint): uint8 {...}{.importc: "SDL_GetMouseState", discardable.}

    proc getRelativeMouseState(x, y: var cint): uint8 {...}{.
        importc: "SDL_GetRelativeMouseState".}

    proc warpMouseInWindow(window: WindowPtr; x, y: cint) {...}{.
        importc: "SDL_WarpMouseInWindow".}

    proc setRelativeMouseMode(enabled: Bool32): SDL_Return {...}{.
        importc: "SDL_SetRelativeMouseMode".}

    proc captureMouse(enabled: Bool32): SDL_Return {...}{.importc: "SDL_CaptureMouse".}

    proc getRelativeMouseMode(): Bool32 {...}{.importc: "SDL_GetRelativeMouseMode".}

    proc createCursor(data, mask: ptr uint8; w, h, hot_x, hot_y: cint): CursorPtr {...}{.
        importc: "SDL_CreateCursor".}

    proc createColorCursor(surface: SurfacePtr; hot_x, hot_y: cint): CursorPtr {...}{.
        importc: "SDL_CreateColorCursor".}

    proc createSystemCursor(c: SystemCursor): CursorPtr {...}{.
        importc: "SDL_CreateSystemCursor".}

    proc setCursor(cursor: CursorPtr) {...}{.importc: "SDL_SetCursor".}

    proc getCursor(): CursorPtr {...}{.importc: "SDL_GetCursor".}

    proc freeCursor(cursor: CursorPtr) {...}{.importc: "SDL_FreeCursor".}

    proc showCursor(toggle: bool): Bool32 {...}{.importc: "SDL_ShowCursor", discardable.}

    proc pumpEvents() {...}{.importc: "SDL_PumpEvents".}

    proc peepEvents(events: ptr Event; numevents: cint; action: Eventaction;
                   minType: uint32; maxType: uint32): cint {...}{.importc: "SDL_PeepEvents".}

    proc hasEvent(kind: uint32): Bool32 {...}{.importc: "SDL_HasEvent".}

    proc hasEvents(minType: uint32; maxType: uint32): Bool32 {...}{.importc: "SDL_HasEvents".}

    proc flushEvent(kind: uint32) {...}{.importc: "SDL_FlushEvent".}

    proc flushEvents(minType: uint32; maxType: uint32) {...}{.importc: "SDL_FlushEvents".}

    proc pollEvent(event: var Event): Bool32 {...}{.importc: "SDL_PollEvent".}

    proc waitEvent(event: var Event): Bool32 {...}{.importc: "SDL_WaitEvent".}

    proc waitEventTimeout(event: var Event; timeout: cint): Bool32 {...}{.
        importc: "SDL_WaitEventTimeout".}

    proc pushEvent(event: ptr Event): cint {...}{.importc: "SDL_PushEvent".}

    proc setEventFilter(filter: EventFilter; userdata: pointer) {...}{.
        importc: "SDL_SetEventFilter".}

    proc getEventFilter(filter: var EventFilter; userdata: var pointer): Bool32 {...}{.
        importc: "SDL_GetEventFilter".}

    proc addEventWatch(filter: EventFilter; userdata: pointer) {...}{.
        importc: "SDL_AddEventWatch".}

    proc delEventWatch(filter: EventFilter; userdata: pointer) {...}{.
        importc: "SDL_DelEventWatch".}

    proc filterEvents(filter: EventFilter; userdata: pointer) {...}{.
        importc: "SDL_FilterEvents".}

    proc eventState(kind: EventType; state: cint): uint8 {...}{.importc: "SDL_EventState".}

    proc registerEvents(numevents: cint): uint32 {...}{.importc: "SDL_RegisterEvents".}

    proc setError(fmt: cstring) {...}{.varargs, importc: "SDL_SetError".}

    proc getError(): cstring {...}{.importc: "SDL_GetError".}

    proc clearError() {...}{.importc: "SDL_ClearError".}

    proc getPixelFormatName(format: uint32): cstring {...}{.importc: "SDL_GetPixelFormatName".}

  Get the human readable name of a pixel format

    proc pixelFormatEnumToMasks(format: uint32; bpp: var cint;
                               Rmask, Gmask, Bmask, Amask: var uint32): bool {...}{.
        importc: "SDL_PixelFormatEnumToMasks".}

  Convert one of the enumerated pixel formats to a bpp and RGBA masks. Returns TRUE or FALSE if the conversion wasn't possible.

    proc masksToPixelFormatEnum(bpp: cint; Rmask, Gmask, Bmask, Amask: uint32): uint32 {...}{.
        importc: "SDL_MasksToPixelFormatEnum".}

  Convert a bpp and RGBA masks to an enumerated pixel format. The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.

    proc allocFormat(pixelFormat: uint32): ptr PixelFormat {...}{.importc: "SDL_AllocFormat".}

    proc freeFormat(format: ptr PixelFormat) {...}{.importc: "SDL_FreeFormat".}

  Free an SDL_PixelFormat structure.

    proc allocPalette(numColors: cint): ptr Palette {...}{.importc: "SDL_AllocPalette".}

  Create a palette structure with the specified number of color entries. Returns A new palette, or NULL if there wasn't enough memory. Note: The palette entries are initialized to white.

    proc setPixelFormatPalette(format: ptr PixelFormat; palette: ptr Palette): cint {...}{.
        importc: "SDL_SetPixelFormatPalette".}

  Set the palette for a pixel format structure.

    proc setPaletteColors(palette: ptr Palette; colors: ptr Color; first, numColors: cint): SDL_Return {...}{.
        discardable, importc: "SDL_SetPaletteColors".}

  Set a range of colors in a palette.

    proc freePalette(palette: ptr Palette) {...}{.importc: "SDL_FreePalette".}

  Free a palette created with SDL_AllocPalette().

    proc mapRGB(format: ptr PixelFormat; r, g, b: uint8): uint32 {...}{.importc: "SDL_MapRGB".}

  Maps an RGB triple to an opaque pixel value for a given pixel format.

    proc mapRGBA(format: ptr PixelFormat; r, g, b, a: uint8): uint32 {...}{.importc: "SDL_MapRGBA".}

  Maps an RGBA quadruple to a pixel value for a given pixel format.

    proc getRGB(pixel: uint32; format: ptr PixelFormat; r, g, b: var uint8) {...}{.
        importc: "SDL_GetRGB".}

  Get the RGB components from a pixel of the specified format.

    proc getRGBA(pixel: uint32; format: ptr PixelFormat; r, g, b, a: var uint8) {...}{.
        importc: "SDL_GetRGBA".}

  Get the RGBA components from a pixel of the specified format.

    proc calculateGammaRamp(gamma: cfloat; ramp: ptr uint16) {...}{.
        importc: "SDL_CalculateGammaRamp".}

  Calculate a 256 entry gamma ramp for a gamma value.

    proc setClipboardText(text: cstring): cint {...}{.importc: "SDL_SetClipboardText".}

    proc getClipboardText(): cstring {...}{.importc: "SDL_GetClipboardText".}

    proc hasClipboardText(): Bool32 {...}{.importc: "SDL_HasClipboardText".}

    proc freeClipboardText(text: cstring) {...}{.importc: "SDL_free".}

    proc getNumTouchFingers(id: TouchID): cint {...}{.importc: "SDL_GetNumTouchFingers".}

    proc getTouchFinger(id: TouchID; index: cint): ptr Finger {...}{.
        importc: "SDL_GetTouchFinger".}

    proc getEventState(kind: EventType): uint8 {...}{.inline, raises: [], tags: [].}

    proc createRGBSurface(width, height, depth: int32): SurfacePtr {...}{.inline, raises: [],
        tags: [].}

    proc getSize(window: WindowPtr): Point {...}{.inline, raises: [], tags: [].}

    proc destroyTexture(texture: TexturePtr) {...}{.inline, raises: [], tags: [].}

    proc destroyRenderer(renderer: RendererPtr) {...}{.inline, raises: [], tags: [].}

    proc destroy(window: WindowPtr) {...}{.inline, raises: [], tags: [].}

    proc destroy(cursor: CursorPtr) {...}{.inline, raises: [], tags: [].}

    proc destroy(surface: SurfacePtr) {...}{.inline, raises: [], tags: [].}

    proc destroy(format: ptr PixelFormat) {...}{.inline, raises: [], tags: [].}

    proc destroy(palette: ptr Palette) {...}{.inline, raises: [], tags: [].}

    proc blitSurface(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr; dstrect: ptr Rect): SDL_Return {...}{.
        inline, discardable, raises: [], tags: [].}

    proc blitScaled(src: SurfacePtr; srcrect: ptr Rect; dst: SurfacePtr; dstrect: ptr Rect): SDL_Return {...}{.
        inline, discardable, raises: [], tags: [].}

    proc loadBMP(file: string): SurfacePtr {...}{.inline, raises: [], tags: [].}

    proc saveBMP(surface: SurfacePtr; file: string): SDL_Return {...}{.inline, discardable,
        raises: [], tags: [].}

    proc color(r, g, b, a: range[0 .. 255]): Color {...}{.raises: [], tags: [].}

    proc rect(x, y: cint; w = cint(0); h = cint(0)): Rect {...}{.raises: [], tags: [].}

    proc point[T: SomeNumber](x, y: T): Point

    proc contains(some: Rect; point: Point): bool {...}{.raises: [], tags: [].}

    proc setHint(name: cstring; value: cstring): bool {...}{.importc: "SDL_SetHint".}

    proc setHintWithPriority(name: cstring; value: cstring; priority: cint): bool {...}{.
        importc: "SDL_SetHintWithPriority".}

    proc getHint(name: cstring): cstring {...}{.importc: "SDL_GetHint".}

    proc size(ctx: RWopsPtr): int64 {...}{.inline, raises: [], tags: [].}

    proc seek(ctx: RWopsPtr; offset: int64; whence: cint): int64 {...}{.inline, raises: [], tags: [].}

    proc read(ctx: RWopsPtr; `ptr`: pointer; size, maxnum: csize_t_const): csize_t_const {...}{.
        inline, raises: [], tags: [ReadIOEffect].}

    proc write(ctx: RWopsPtr; `ptr`: pointer; size, num: csize_t_const): csize_t_const {...}{.
        inline, raises: [], tags: [WriteIOEffect].}

    proc close(ctx: RWopsPtr): cint {...}{.inline, raises: [Exception], tags: [WriteIOEffect].}

# Converters

    converter toInt(some: Keymod): cint {...}{.raises: [], tags: [].}

    converter toBool(some: Bool32): bool {...}{.raises: [], tags: [].}

    converter toBool(some: SDL_Return): bool {...}{.raises: [], tags: [].}

    converter toCint(some: TextureAccess): cint {...}{.raises: [], tags: [].}

# Templates

    template KMOD_CTRL(): untyped

    template KMOD_SHIFT(): untyped

    template KMOD_ALT(): untyped

    template KMOD_GUI(): untyped

    template SDL_DEFINE_PIXELFOURCC(A, B, C, D: char): uint32

    template SDL_DEFINE_PIXELFORMAT(`type`, order, layout, bits, bytes: int): uint32

    template SDL_PIXELFLAG(X: uint32): int

    template SDL_PIXELTYPE(X: uint32): int

    template SDL_PIXELORDER(X: uint32): int

    template SDL_PIXELLAYOUT(X: uint32): int

    template SDL_BITSPERPIXEL(X: uint32): int

    template SDL_BYTESPERPIXEL(X: uint32): int

    template SDL_ISPIXELFORMAT_INDEXED(format: uint32): bool

    template SDL_ISPIXELFORMAT_ALPHA(format: uint32): bool

    template SDL_ISPIXELFORMAT_FOURCC(format: uint32): bool

    template SDL_MUSTLOCK(some: SurfacePtr): bool

    template SDL_WINDOWPOS_UNDEFINED_DISPLAY(X: cint): untyped

    template SDL_WINDOWPOS_ISUNDEFINED(X: cint): bool

    template SDL_WINDOWPOS_CENTERED_DISPLAY(X: cint): cint

    template SDL_WINDOWPOS_ISCENTERED(X: cint): bool

    template SDL_BUTTON(x: uint8): uint8