summary refs log tree commit diff stats
path: root/lib/wrappers/sdl
diff options
context:
space:
mode:
authorrumpf_a@web.de <>2010-03-06 15:59:56 +0100
committerrumpf_a@web.de <>2010-03-06 15:59:56 +0100
commitf311acc589b86e341d663f7a06f269d0d355c5f7 (patch)
treeb0e842675bdc5910709a97fa8f4d7e17eb3d0f7b /lib/wrappers/sdl
parent13c69f5540a0527f11357d63ba5a2c15adaa42cb (diff)
downloadNim-f311acc589b86e341d663f7a06f269d0d355c5f7.tar.gz
type alias fixes for SDL
Diffstat (limited to 'lib/wrappers/sdl')
-rwxr-xr-xlib/wrappers/sdl/sdl.nim376
-rwxr-xr-xlib/wrappers/sdl/sdl_gfx.nim452
-rwxr-xr-xlib/wrappers/sdl/sdl_image.nim232
-rwxr-xr-xlib/wrappers/sdl/sdl_mixer.nim484
-rwxr-xr-xlib/wrappers/sdl/sdl_mixer_nosmpeg.nim351
-rwxr-xr-xlib/wrappers/sdl/sdl_net.nim427
-rwxr-xr-xlib/wrappers/sdl/sdl_ttf.nim341
-rwxr-xr-xlib/wrappers/sdl/smpeg.nim335
8 files changed, 2793 insertions, 205 deletions
diff --git a/lib/wrappers/sdl/sdl.nim b/lib/wrappers/sdl/sdl.nim
index b96d1e2d4..1442c797a 100755
--- a/lib/wrappers/sdl/sdl.nim
+++ b/lib/wrappers/sdl/sdl.nim
@@ -85,7 +85,7 @@
 #   May      08 2001 - DL : Added Keyboard  State Array ( See demos for how to
 #                           use )
 #                           PKeyStateArr = ^TKeyStateArr;
-#                           TKeyStateArr = array[0..65000] of UInt8;
+#                           TKeyStateArr = array[0..65000] of byte;
 #                           As most games will need it.
 #
 #   April    02 2001 - DL : Added SDL_getenv.h definitions and tested version
@@ -372,7 +372,7 @@ type
     EVENT_RESERVED7 = 23,     # Reserved for future use..
                               # Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use
     USEREVENT = 24 # This last event is only for bounding internal arrays
-                   # It is the number of bits in the event mask datatype -- UInt32
+                   # It is the number of bits in the event mask datatype -- int32
 
 const 
   NUMEVENTS* = 32
@@ -754,32 +754,22 @@ type
   TBool* = enum 
     sdlFALSE, sdlTRUE
   PUInt8Array* = ptr TUInt8Array
-  PUInt8* = ptr UInt8
-  PPUInt8* = ptr PUInt8
-  UInt8* = int8
-  TUInt8Array* = array[0..high(int) shr 1, UInt8]
+  TUInt8Array* = array[0..high(int) shr 1, byte]
   PUInt16* = ptr UInt16
   UInt16* = int16
-  PSInt8* = ptr SInt8
-  SInt8* = int8
-  PSInt16* = ptr SInt16
-  SInt16* = int16
-  PUInt32* = ptr UInt32
-  UInt32* = int
-  SInt32* = int
-  PInt* = ptr int
-  PShortInt* = ptr int8
+  PUInt32* = ptr int32
+  UInt32* = int32
   PUInt64* = ptr UInt64
   UInt64*{.final.} = object 
-    hi*: UInt32
-    lo*: UInt32
+    hi*: int32
+    lo*: int32
 
   PSInt64* = ptr SInt64
   SInt64*{.final.} = object 
-    hi*: UInt32
-    lo*: UInt32
+    hi*: int32
+    lo*: int32
 
-  TGrabMode* = int            # SDL_error.h types
+  TGrabMode* = int32         # SDL_error.h types
   Terrorcode* = enum 
     ENOMEM, EFREAD, EFWRITE, EFSEEK, LASTERROR
   errorcode* = Terrorcode
@@ -805,9 +795,9 @@ type
     fp*: Pointer
 
   TMem*{.final.} = object 
-    base*: PUInt8
-    here*: PUInt8
-    stop*: PUInt8
+    base*: ptr byte
+    here*: ptr byte
+    stop*: ptr byte
 
   TUnknown*{.final.} = object  # first declare the pointer type
     data1*: Pointer
@@ -839,47 +829,34 @@ type
   
   RWops* = TRWops             # SDL_timer.h types
                               # Function prototype for the timer callback function
-  TTimerCallback* = proc (interval: UInt32): UInt32{.cdecl.} # New timer API, supports multiple timers
-                                                             #   Written by Stephane Peter
-                                                             #   
-                                                             #   <megastep@lokigames.com>
-                                                             # Function prototype for the new timer callback function.
-                                                             #   The callback function is passed the current timer interval and returns
-                                                             #   the next timer interval.  If the returned value is the same as the one
-                                                             #   passed in, the periodic alarm continues, otherwise a new alarm is
-                                                             #   scheduled.  If the callback returns 0, the periodic alarm is cancelled.
-  TNewTimerCallback* = proc (interval: UInt32, param: Pointer): UInt32{.cdecl.} # 
-                                                                                # Definition 
-                                                                                # of 
-                                                                                # the 
-                                                                                # timer 
-                                                                                # ID 
-                                                                                # type
+  TTimerCallback* = proc (interval: int32): int32{.cdecl.}
+  TNewTimerCallback* = proc (interval: int32, param: Pointer): int32{.cdecl.}
+
   PTimerID* = ptr TTimerID
   TTimerID*{.final.} = object 
-    interval*: UInt32
+    interval*: int32
     callback*: TNewTimerCallback
     param*: Pointer
-    last_alarm*: UInt32
+    last_alarm*: int32
     next*: PTimerID
 
-  TAudioSpecCallback* = proc (userdata: Pointer, stream: PUInt8, length: int){.
+  TAudioSpecCallback* = proc (userdata: Pointer, stream: ptr byte, length: int){.
       cdecl.}                 # SDL_audio.h types
                               # The calculated values in this structure are calculated by SDL_OpenAudio()
   PAudioSpec* = ptr TAudioSpec
   TAudioSpec*{.final.} = object  # A structure to hold a set of audio conversion filters and buffers
     freq*: int                # DSP frequency -- samples per second
     format*: UInt16           # Audio data format
-    channels*: UInt8          # Number of channels: 1 mono, 2 stereo
-    silence*: UInt8           # Audio buffer silence value (calculated)
+    channels*: byte          # Number of channels: 1 mono, 2 stereo
+    silence*: byte           # Audio buffer silence value (calculated)
     samples*: UInt16          # Audio buffer size in samples
     padding*: UInt16          # Necessary for some compile environments
-    size*: UInt32 # Audio buffer size in bytes (calculated)
-                  # This function is called when the audio device needs more data.
-                  #      'stream' is a pointer to the audio data buffer
-                  #      'len' is the length of that buffer in bytes.
-                  #      Once the callback returns, the buffer will no longer be valid.
-                  #      Stereo samples are stored in a LRLRLR ordering.
+    size*: int32 # Audio buffer size in bytes (calculated)
+                 # This function is called when the audio device needs more data.
+                 # 'stream' is a pointer to the audio data buffer
+                 # 'len' is the length of that buffer in bytes.
+                 # Once the callback returns, the buffer will no longer be valid.
+                 # Stereo samples are stored in a LRLRLR ordering.
     callback*: TAudioSpecCallback
     userdata*: Pointer
 
@@ -896,7 +873,7 @@ type
     src_format*: UInt16       # Source audio format
     dst_format*: UInt16       # Target audio format
     rate_incr*: float64       # Rate conversion increment
-    buf*: PUInt8              # Buffer to hold entire audio data
+    buf*: ptr byte              # Buffer to hold entire audio data
     length*: int              # Length of original audio buffer
     len_cvt*: int             # Length of converted audio buffer
     len_mult*: int            # buffer must be len*len_mult big
@@ -910,11 +887,11 @@ type
     CD_ERROR, CD_TRAYEMPTY, CD_STOPPED, CD_PLAYING, CD_PAUSED
   PCDTrack* = ptr TCDTrack
   TCDTrack*{.final.} = object  # This structure is only current as of the last call to SDL_CDStatus()
-    id*: UInt8                # Track number
-    theType*: UInt8           # Data or audio track
+    id*: byte                # Track number
+    theType*: byte           # Data or audio track
     unused*: UInt16
-    len*: UInt32              # Length, in frames, of this track
-    offset*: UInt32           # Offset, in frames, from start of disk
+    len*: int32              # Length, in frames, of this track
+    offset*: int32           # Offset, in frames, from start of disk
   
   PCD* = ptr TCD
   TCD*{.final.} = object      #SDL_joystick.h types
@@ -944,24 +921,24 @@ type
 
   PJoystick* = ptr TJoystick
   TJoystick*{.final.} = object  # SDL_verion.h types
-    index*: UInt8             # Device index
+    index*: byte             # Device index
     name*: cstring            # Joystick name - system dependent
     naxes*: int               # Number of axis controls on the joystick
     axes*: PUInt16            # Current axis states
     nhats*: int               # Number of hats on the joystick
-    hats*: PUInt8             # Current hat states
+    hats*: ptr byte             # Current hat states
     nballs*: int              # Number of trackballs on the joystick
     balls*: PBallDelta        # Current ball motion deltas
     nbuttons*: int            # Number of buttons on the joystick
-    buttons*: PUInt8          # Current button states
+    buttons*: ptr byte          # Current button states
     hwdata*: PJoystick_hwdata # Driver dependent information
     ref_count*: int           # Reference count for multiple opens
   
   Pversion* = ptr Tversion
   Tversion*{.final.} = object  # SDL_keyboard.h types
-    major*: UInt8
-    minor*: UInt8
-    patch*: UInt8
+    major*: byte
+    minor*: byte
+    patch*: byte
 
   TKey* = int32
   TMod* = int32
@@ -978,7 +955,7 @@ type
                               #   removed from the queue.
                               #   This function returns the number of events actually stored, or -1
                               #   if there was an error.  This function is thread-safe.
-    scancode*: UInt8          # hardware specific scancode
+    scancode*: byte          # hardware specific scancode
     sym*: TKey                # SDL virtual keysym
     modifier*: TMod           # current key modifiers
     unicode*: UInt16          # translated character
@@ -987,61 +964,61 @@ type
     ADDEVENT, PEEKEVENT, GETEVENT
   TActiveEvent*{.final.} = object  # SDL_ACTIVEEVENT
                                    # Keyboard event structure
-    gain*: UInt8              # Whether given states were gained or lost (1/0)
-    state*: UInt8             # A mask of the focus states
+    gain*: byte              # Whether given states were gained or lost (1/0)
+    state*: byte             # A mask of the focus states
   
   TKeyboardEvent*{.final.} = object  # SDL_KEYDOWN or SDL_KEYUP
                                      # Mouse motion event structure
-    which*: UInt8             # The keyboard device index
-    state*: UInt8             # SDL_PRESSED or SDL_RELEASED
+    which*: byte             # The keyboard device index
+    state*: byte             # SDL_PRESSED or SDL_RELEASED
     keysym*: TKeySym
 
   TMouseMotionEvent*{.final.} = object  # SDL_MOUSEMOTION
                                         # Mouse button event structure
-    which*: UInt8             # The mouse device index
-    state*: UInt8             # The current button state
+    which*: byte             # The mouse device index
+    state*: byte             # The current button state
     x*, y*: UInt16            # The X/Y coordinates of the mouse
-    xrel*: SInt16             # The relative motion in the X direction
-    yrel*: SInt16             # The relative motion in the Y direction
+    xrel*: int16             # The relative motion in the X direction
+    yrel*: int16             # The relative motion in the Y direction
   
   TMouseButtonEvent*{.final.} = object  # SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
                                         # Joystick axis motion event structure
-    which*: UInt8             # The mouse device index
-    button*: UInt8            # The mouse button index
-    state*: UInt8             # SDL_PRESSED or SDL_RELEASED
+    which*: byte             # The mouse device index
+    button*: byte            # The mouse button index
+    state*: byte             # SDL_PRESSED or SDL_RELEASED
     x*: UInt16                # The X coordinates of the mouse at press time
     y*: UInt16                # The Y coordinates of the mouse at press time
   
   TJoyAxisEvent*{.final.} = object  # SDL_JOYAXISMOTION
                                     # Joystick trackball motion event structure
-    which*: UInt8             # The joystick device index
-    axis*: UInt8              # The joystick axis index
-    value*: SInt16            # The axis value (range: -32768 to 32767)
+    which*: byte             # The joystick device index
+    axis*: byte              # The joystick axis index
+    value*: int16            # The axis value (range: -32768 to 32767)
   
   TJoyBallEvent*{.final.} = object  # SDL_JOYAVBALLMOTION
                                     # Joystick hat position change event structure
-    which*: UInt8             # The joystick device index
-    ball*: UInt8              # The joystick trackball index
-    xrel*: SInt16             # The relative motion in the X direction
-    yrel*: SInt16             # The relative motion in the Y direction
+    which*: byte             # The joystick device index
+    ball*: byte              # The joystick trackball index
+    xrel*: int16             # The relative motion in the X direction
+    yrel*: int16             # The relative motion in the Y direction
   
   TJoyHatEvent*{.final.} = object  # SDL_JOYHATMOTION */
                                    # Joystick button event structure
-    which*: UInt8             # The joystick device index */
-    hat*: UInt8               # The joystick hat index */
-    value*: UInt8             # The hat position value:
-                              #                    8   1   2
-                              #                    7   0   3
-                              #                    6   5   4
-                              #                    Note that zero means the POV is centered.
+    which*: byte             # The joystick device index */
+    hat*: byte               # The joystick hat index */
+    value*: byte             # The hat position value:
+                             # 8   1   2
+                             # 7   0   3
+                             # 6   5   4
+                             # Note that zero means the POV is centered.
   
   TJoyButtonEvent*{.final.} = object  # SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
                                       # The "window resized" event
                                       #    When you get this event, you are responsible for setting a new video
                                       #    mode with the new width and height.
-    which*: UInt8             # The joystick device index
-    button*: UInt8            # The joystick button index
-    state*: UInt8             # SDL_PRESSED or SDL_RELEASED
+    which*: byte             # The joystick device index
+    button*: byte            # The joystick button index
+    state*: byte             # SDL_PRESSED or SDL_RELEASED
   
   TResizeEvent*{.final.} = object  # SDL_VIDEORESIZE
                                    # A user-defined event type
@@ -1050,9 +1027,9 @@ type
   
   PUserEvent* = ptr TUserEvent
   TUserEvent*{.final.} = object  # SDL_USEREVENT through SDL_NUMEVENTS-1
-    code*: int                # User defined event code */
-    data1*: Pointer           # User defined data pointer */
-    data2*: Pointer           # User defined data pointer */
+    code*: int                # User defined event code
+    data1*: Pointer           # User defined data pointer
+    data2*: Pointer           # User defined data pointer 
   
 
 when defined(Unix): 
@@ -1178,16 +1155,16 @@ type
   PPSDL_Rect* = ptr PRect
   PRect* = ptr TRect
   TRect*{.final.} = object 
-    x*, y*: SInt16
+    x*, y*: int16
     w*, h*: UInt16
 
   Rect* = TRect
   PColor* = ptr TColor
   TColor*{.final.} = object 
-    r*: UInt8
-    g*: UInt8
-    b*: UInt8
-    unused*: UInt8
+    r*: byte
+    g*: byte
+    b*: byte
+    unused*: byte
 
   PColorArray* = ptr TColorArray
   TColorArray* = array[0..65000, TColor]
@@ -1199,43 +1176,43 @@ type
   PPixelFormat* = ptr TPixelFormat
   TPixelFormat*{.final.} = object  # The structure passed to the low level blit functions
     palette*: PPalette
-    BitsPerPixel*: UInt8
-    BytesPerPixel*: UInt8
-    Rloss*: UInt8
-    Gloss*: UInt8
-    Bloss*: UInt8
-    Aloss*: UInt8
-    Rshift*: UInt8
-    Gshift*: UInt8
-    Bshift*: UInt8
-    Ashift*: UInt8
-    RMask*: UInt32
-    GMask*: UInt32
-    BMask*: UInt32
-    AMask*: UInt32
-    colorkey*: UInt32         # RGB color key information
-    alpha*: UInt8             # Alpha value information (per-surface alpha)
+    BitsPerPixel*: byte
+    BytesPerPixel*: byte
+    Rloss*: byte
+    Gloss*: byte
+    Bloss*: byte
+    Aloss*: byte
+    Rshift*: byte
+    Gshift*: byte
+    Bshift*: byte
+    Ashift*: byte
+    RMask*: int32
+    GMask*: int32
+    BMask*: int32
+    AMask*: int32
+    colorkey*: int32         # RGB color key information
+    alpha*: byte             # Alpha value information (per-surface alpha)
   
   PBlitInfo* = ptr TBlitInfo
   TBlitInfo*{.final.} = object  # typedef for private surface blitting functions
-    s_pixels*: PUInt8
+    s_pixels*: ptr byte
     s_width*: int
     s_height*: int
     s_skip*: int
-    d_pixels*: PUInt8
+    d_pixels*: ptr byte
     d_width*: int
     d_height*: int
     d_skip*: int
     aux_data*: Pointer
     src*: PPixelFormat
-    table*: PUInt8
+    table*: ptr byte
     dst*: PPixelFormat
 
   PSurface* = ptr TSurface
   TBlit* = proc (src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int{.
       cdecl.}
   TSurface*{.final.} = object  # Useful for determining the video hardware capabilities
-    flags*: UInt32            # Read-only
+    flags*: int32            # Read-only
     format*: PPixelFormat     # Read-only
     w*, h*: cint              # Read-only
     pitch*: UInt16            # Read-only
@@ -1244,9 +1221,9 @@ type
     hwdata*: Pointer          #TPrivate_hwdata;  Hardware-specific surface info
                               # clipping information:
     clip_rect*: TRect         # Read-only
-    unused1*: UInt32          # for binary compatibility
+    unused1*: int32           # for binary compatibility
                               # Allow recursive locks
-    locked*: UInt32           # Private
+    locked*: int32            # Private
                               # info for fast blit mapping to other surfaces
     Blitmap*: Pointer         # PSDL_BlitMap; //   Private
                               # format version, bumped at every change to invalidate blit maps
@@ -1255,33 +1232,22 @@ type
 
   PVideoInfo* = ptr TVideoInfo
   TVideoInfo*{.final.} = object  # The YUV hardware video overlay
-    hw_available*: UInt8 # Hardware and WindowManager flags in first 2 bits ( see below )
-                         #hw_available: 1; // Can you create hardware surfaces
-                         #    wm_available: 1; // Can you talk to a window manager?
-                         #    UnusedBits1: 6;
-    blit_hw*: UInt8 # Blit Hardware flags. See below for which bits do what
-                    #UnusedBits2: 1;
-                    #    blit_hw: 1; // Flag:UInt32  Accelerated blits HW --> HW
-                    #    blit_hw_CC: 1; // Flag:UInt32  Accelerated blits with Colorkey
-                    #    blit_hw_A: 1; // Flag:UInt32  Accelerated blits with Alpha
-                    #    blit_sw: 1; // Flag:UInt32  Accelerated blits SW --> HW
-                    #    blit_sw_CC: 1; // Flag:UInt32  Accelerated blits with Colorkey
-                    #    blit_sw_A: 1; // Flag:UInt32  Accelerated blits with Alpha
-                    #    blit_fill: 1; // Flag:UInt32  Accelerated color fill
-    UnusedBits3*: UInt8       # Unused at this point
-    video_mem*: UInt32        # The total amount of video memory (in K)
+    hw_available*: byte 
+    blit_hw*: byte 
+    UnusedBits3*: byte       # Unused at this point
+    video_mem*: int32        # The total amount of video memory (in K)
     vfmt*: PPixelFormat       # Value: The format of the video surface
-    current_w*: SInt32        # Value: The current video mode width
-    current_h*: SInt32        # Value: The current video mode height
+    current_w*: int32        # Value: The current video mode width
+    current_h*: int32        # Value: The current video mode height
   
   POverlay* = ptr TOverlay
   TOverlay*{.final.} = object  # Public enumeration for setting the OpenGL window attributes.
-    format*: UInt32           # Overlay format
+    format*: int32           # Overlay format
     w*, h*: int               # Width and height of overlay
     planes*: int              # Number of planes in the overlay. Usually either 1 or 3
     pitches*: PUInt16         # An array of pitches, one for each plane. Pitch is the length of a row in bytes.
-    pixels*: PPUInt8          # An array of pointers to the data of each plane. The overlay should be locked before these pointers are used.
-    hw_overlay*: UInt32       # This will be set to 1 if the overlay is hardware accelerated.
+    pixels*: ptr ptr byte # An array of pointers to the data of each plane. The overlay should be locked before these pointers are used.
+    hw_overlay*: int32    # This will be set to 1 if the overlay is hardware accelerated.
   
   TGLAttr* = enum 
     GL_RED_SIZE, GL_GREEN_SIZE, GL_BLUE_SIZE, GL_ALPHA_SIZE, GL_BUFFER_SIZE, 
@@ -1292,10 +1258,10 @@ type
   PCursor* = ptr TCursor
   TCursor*{.final.} = object  # SDL_mutex.h types
     area*: TRect              # The area of the mouse cursor
-    hot_x*, hot_y*: SInt16    # The "tip" of the cursor
-    data*: PUInt8             # B/W cursor data
-    mask*: PUInt8             # B/W cursor mask
-    save*: array[1..2, PUInt8] # Place to save cursor area
+    hot_x*, hot_y*: int16    # The "tip" of the cursor
+    data*: ptr byte             # B/W cursor data
+    mask*: ptr byte             # B/W cursor mask
+    save*: array[1..2, ptr byte] # Place to save cursor area
     wm_cursor*: Pointer       # Window-manager cursor
   
 
@@ -1319,14 +1285,14 @@ type                          # This is the system-independent thread info struc
   PThread* = ptr TThread
   TThread*{.final.} = object  # Helper Types
                               # Keyboard  State Array ( See demos for how to use )
-    threadid*: UInt32
+    threadid*: int32
     handle*: TSYS_ThreadHandle
     status*: int
     errbuf*: TError
     data*: Pointer
 
   PKeyStateArr* = ptr TKeyStateArr
-  TKeyStateArr* = array[0..65000, UInt8] # Types required so we don't need to use Windows.pas
+  TKeyStateArr* = array[0..65000, byte] # Types required so we don't need to use Windows.pas
   PInteger* = ptr int
   PByte* = ptr int8
   PWord* = ptr int16
@@ -1343,24 +1309,24 @@ type                          # This is the system-independent thread info struc
                         #  Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
                         #  signal handlers for some commonly ignored fatal signals (like SIGSEGV)
 
-proc Init*(flags: UInt32): int{.cdecl, importc: "SDL_Init", dynlib: LibName.}
+proc Init*(flags: int32): int{.cdecl, importc: "SDL_Init", dynlib: LibName.}
   # This function initializes specific SDL subsystems
-proc InitSubSystem*(flags: UInt32): int{.cdecl, importc: "SDL_InitSubSystem", 
+proc InitSubSystem*(flags: int32): int{.cdecl, importc: "SDL_InitSubSystem", 
     dynlib: LibName.}
   # This function cleans up specific SDL subsystems
-proc QuitSubSystem*(flags: UInt32){.cdecl, importc: "SDL_QuitSubSystem", 
+proc QuitSubSystem*(flags: int32){.cdecl, importc: "SDL_QuitSubSystem", 
                                     dynlib: LibName.}
   # This function returns mask of the specified subsystems which have
   #  been initialized.
   #  If 'flags' is 0, it returns a mask of all initialized subsystems.
-proc WasInit*(flags: UInt32): UInt32{.cdecl, importc: "SDL_WasInit", 
+proc WasInit*(flags: int32): int32{.cdecl, importc: "SDL_WasInit", 
                                       dynlib: LibName.}
   # This function cleans up all initialized subsystems and unloads the
   #  dynamically linked library.  You should call it upon all exit conditions.
 proc Quit*(){.cdecl, importc: "SDL_Quit", dynlib: LibName.}
 when defined(WINDOWS): 
   # This should be called from your WinMain() function, if any
-  proc RegisterApp*(name: cstring, style: UInt32, h_Inst: Pointer): int{.cdecl, 
+  proc RegisterApp*(name: cstring, style: int32, h_Inst: Pointer): int{.cdecl, 
       importc: "SDL_RegisterApp", dynlib: LibName.}
 proc TableSize*(table: cstring): int
   #------------------------------------------------------------------------------
@@ -1398,18 +1364,18 @@ proc RWClose*(context: PRWops): int
   #------------------------------------------------------------------------------
   # Get the number of milliseconds since the SDL library initialization.
   # Note that this value wraps if the program runs for more than ~49 days.
-proc GetTicks*(): UInt32{.cdecl, importc: "SDL_GetTicks", dynlib: LibName.}
+proc GetTicks*(): int32{.cdecl, importc: "SDL_GetTicks", dynlib: LibName.}
   # Wait a specified number of milliseconds before returning
-proc Delay*(msec: UInt32){.cdecl, importc: "SDL_Delay", dynlib: LibName.}
+proc Delay*(msec: int32){.cdecl, importc: "SDL_Delay", dynlib: LibName.}
   # Add a new timer to the pool of timers already running.
   # Returns a timer ID, or NULL when an error occurs.
-proc AddTimer*(interval: UInt32, callback: TNewTimerCallback, param: Pointer): PTimerID{.
+proc AddTimer*(interval: int32, callback: TNewTimerCallback, param: Pointer): PTimerID{.
     cdecl, importc: "SDL_AddTimer", dynlib: LibName.}
   # Remove one of the multiple timers knowing its ID.
   # Returns a boolean value indicating success.
 proc RemoveTimer*(t: PTimerID): TBool{.cdecl, importc: "SDL_RemoveTimer", 
                                        dynlib: LibName.}
-proc SetTimer*(interval: UInt32, callback: TTimerCallback): int{.cdecl, 
+proc SetTimer*(interval: int32, callback: TTimerCallback): int{.cdecl, 
     importc: "SDL_SetTimer", dynlib: LibName.}
   #------------------------------------------------------------------------------
   # audio-routines
@@ -1491,21 +1457,21 @@ proc PauseAudio*(pause_on: int){.cdecl, importc: "SDL_PauseAudio",
   #  This function returns NULL and sets the SDL error message if the
   #  wave file cannot be opened, uses an unknown data format, or is
   #  corrupt.  Currently raw and MS-ADPCM WAVE files are supported.
-proc LoadWAV_RW*(src: PRWops, freesrc: int, spec: PAudioSpec, audio_buf: PUInt8, 
+proc LoadWAV_RW*(src: PRWops, freesrc: int, spec: PAudioSpec, audio_buf: ptr byte, 
                  audiolen: PUInt32): PAudioSpec{.cdecl, 
     importc: "SDL_LoadWAV_RW", dynlib: LibName.}
   # Compatibility convenience function -- loads a WAV from a file
-proc LoadWAV*(filename: cstring, spec: PAudioSpec, audio_buf: PUInt8, 
+proc LoadWAV*(filename: cstring, spec: PAudioSpec, audio_buf: ptr byte, 
               audiolen: PUInt32): PAudioSpec
   # This function frees data previously allocated with SDL_LoadWAV_RW()
-proc FreeWAV*(audio_buf: PUInt8){.cdecl, importc: "SDL_FreeWAV", dynlib: LibName.}
+proc FreeWAV*(audio_buf: ptr byte){.cdecl, importc: "SDL_FreeWAV", dynlib: LibName.}
   # This function takes a source format and rate and a destination format
   #  and rate, and initializes the 'cvt' structure with information needed
   #  by SDL_ConvertAudio() to convert a buffer of audio data from one format
   #  to the other.
   #  This function returns 0, or -1 if there was an error.
-proc BuildAudioCVT*(cvt: PAudioCVT, src_format: UInt16, src_channels: UInt8, 
-                    src_rate: int, dst_format: UInt16, dst_channels: UInt8, 
+proc BuildAudioCVT*(cvt: PAudioCVT, src_format: UInt16, src_channels: byte, 
+                    src_rate: int, dst_format: UInt16, dst_channels: byte, 
                     dst_rate: int): int{.cdecl, importc: "SDL_BuildAudioCVT", 
     dynlib: LibName.}
   # Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
@@ -1522,7 +1488,7 @@ proc ConvertAudio*(cvt: PAudioCVT): int{.cdecl, importc: "SDL_ConvertAudio",
   #  The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
   #  for full audio volume.  Note this does not change hardware volume.
   #  This is provided for convenience -- you can mix your own audio data.
-proc MixAudio*(dst, src: PUInt8, length: UInt32, volume: int){.cdecl, 
+proc MixAudio*(dst, src: ptr byte, length: int32, volume: int){.cdecl, 
     importc: "SDL_MixAudio", dynlib: LibName.}
   # The lock manipulated by these functions protects the callback function.
   #  During a LockAudio/UnlockAudio pair, you can be guaranteed that the
@@ -1649,10 +1615,10 @@ proc JoystickEventState*(state: int): int{.cdecl,
   # Get the current state of an axis control on a joystick
   #  The state is a value ranging from -32768 to 32767.
   #  The axis indices start at index 0.
-proc JoystickGetAxis*(joystick: PJoystick, axis: int): SInt16{.cdecl, 
+proc JoystickGetAxis*(joystick: PJoystick, axis: int): int16{.cdecl, 
     importc: "SDL_JoystickGetAxis", dynlib: LibName.}
   # The hat indices start at index 0.
-proc JoystickGetHat*(joystick: PJoystick, hat: int): UInt8{.cdecl, 
+proc JoystickGetHat*(joystick: PJoystick, hat: int): byte{.cdecl, 
     importc: "SDL_JoystickGetHat", dynlib: LibName.}
   # Get the ball axis change since the last poll
   #  This returns 0, or -1 if you passed it invalid parameters.
@@ -1661,7 +1627,7 @@ proc JoystickGetBall*(joystick: PJoystick, ball: int, dx: var int, dy: var int):
     cdecl, importc: "SDL_JoystickGetBall", dynlib: LibName.}
   # Get the current state of a button on a joystick
   #  The button indices start at index 0.
-proc JoystickGetButton*(joystick: PJoystick, Button: int): UInt8{.cdecl, 
+proc JoystickGetButton*(joystick: PJoystick, Button: int): byte{.cdecl, 
     importc: "SDL_JoystickGetButton", dynlib: LibName.}
   # Close a joystick previously opened with SDL_JoystickOpen()
 proc JoystickClose*(joystick: PJoystick){.cdecl, importc: "SDL_JoystickClose", 
@@ -1685,7 +1651,7 @@ proc PumpEvents*(){.cdecl, importc: "SDL_PumpEvents", dynlib: LibName.}
   #  This function returns the number of events actually stored, or -1
   #  if there was an error.  This function is thread-safe.
 proc PeepEvents*(events: PEvent, numevents: int, action: Teventaction, 
-                 mask: UInt32): int{.cdecl, importc: "SDL_PeepEvents", 
+                 mask: int32): int{.cdecl, importc: "SDL_PeepEvents", 
                                      dynlib: LibName.}
   # Polls for currently pending events, and returns 1 if there are any pending
   #   events, or 0 if there are none available.  If 'event' is not NULL, the next
@@ -1725,7 +1691,7 @@ proc GetEventFilter*(): TEventFilter{.cdecl, importc: "SDL_GetEventFilter",
   #  If 'state' is set to SDL_ENABLE, that event will be processed normally.
   #  If 'state' is set to SDL_QUERY, SDL_EventState() will return the
   #  current processing state of the specified event.
-proc EventState*(theType: UInt8, state: int): UInt8{.cdecl, 
+proc EventState*(theType: byte, state: int): byte{.cdecl, 
     importc: "SDL_EventState", dynlib: LibName.}
   #------------------------------------------------------------------------------
   # Version Routines
@@ -1761,7 +1727,7 @@ proc Linked_Version*(): Pversion{.cdecl, importc: "SDL_Linked_Version",
   #  If you use both sound and video in your application, you need to call
   #  SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
   #  you won't be able to set full-screen display modes.
-proc VideoInit*(driver_name: cstring, flags: UInt32): int{.cdecl, 
+proc VideoInit*(driver_name: cstring, flags: int32): int{.cdecl, 
     importc: "SDL_VideoInit", dynlib: LibName.}
 proc VideoQuit*(){.cdecl, importc: "SDL_VideoQuit", dynlib: LibName.}
   # This function fills the given character buffer with the name of the
@@ -1790,7 +1756,7 @@ proc GetVideoInfo*(): PVideoInfo{.cdecl, importc: "SDL_GetVideoInfo",
   #
   #  The arguments to SDL_VideoModeOK() are the same ones you would pass to
   #  SDL_SetVideoMode()
-proc VideoModeOK*(width, height, bpp: int, flags: UInt32): int{.cdecl, 
+proc VideoModeOK*(width, height, bpp: int, flags: int32): int{.cdecl, 
     importc: "SDL_VideoModeOK", importc: "SDL_VideoModeOK", dynlib: LibName.}
   # Return a pointer to an array of available screen dimensions for the
   #  given format and video flags, sorted largest to smallest.  Returns
@@ -1799,7 +1765,7 @@ proc VideoModeOK*(width, height, bpp: int, flags: UInt32): int{.cdecl,
   #
   #  if 'format' is NULL, the mode list will be for the format given
   #  by SDL_GetVideoInfo( ) - > vfmt
-proc ListModes*(format: PPixelFormat, flags: UInt32): PPSDL_Rect{.cdecl, 
+proc ListModes*(format: PPixelFormat, flags: int32): PPSDL_Rect{.cdecl, 
     importc: "SDL_ListModes", dynlib: LibName.}
   # Set up a video mode with the specified width, height and bits-per-pixel.
   #
@@ -1842,7 +1808,7 @@ proc ListModes*(format: PPixelFormat, flags: UInt32): PPSDL_Rect{.cdecl,
   #  applications that redraw the entire screen on every update.
   #
   #  This function returns the video framebuffer surface, or NULL if it fails.
-proc SetVideoMode*(width, height, bpp: int, flags: UInt32): PSurface{.cdecl, 
+proc SetVideoMode*(width, height, bpp: int, flags: int32): PSurface{.cdecl, 
     importc: "SDL_SetVideoMode", dynlib: LibName.}
   # Makes sure the given list of rectangles is updated on the given screen.
   #  If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
@@ -1850,7 +1816,7 @@ proc SetVideoMode*(width, height, bpp: int, flags: UInt32): PSurface{.cdecl,
   #  These functions should not be called while 'screen' is locked.
 proc UpdateRects*(screen: PSurface, numrects: int, rects: PRect){.cdecl, 
     importc: "SDL_UpdateRects", dynlib: LibName.}
-proc UpdateRect*(screen: PSurface, x, y: SInt32, w, h: UInt32){.cdecl, 
+proc UpdateRect*(screen: PSurface, x, y: int32, w, h: int32){.cdecl, 
     importc: "SDL_UpdateRect", dynlib: LibName.}
   # On hardware that supports double-buffering, this function sets up a flip
   #  and returns.  The hardware will wait for vertical retrace, and then swap
@@ -1923,17 +1889,17 @@ proc SetPalette*(surface: PSurface, flags: int, colors: PColor, firstcolor: int,
                  ncolors: int): int{.cdecl, importc: "SDL_SetPalette", 
                                      dynlib: LibName.}
   # Maps an RGB triple to an opaque pixel value for a given pixel format
-proc MapRGB*(format: PPixelFormat, r: UInt8, g: UInt8, b: UInt8): UInt32{.cdecl, 
+proc MapRGB*(format: PPixelFormat, r: byte, g: byte, b: byte): int32{.cdecl, 
     importc: "SDL_MapRGB", dynlib: LibName.}
   # Maps an RGBA quadruple to a pixel value for a given pixel format
-proc MapRGBA*(format: PPixelFormat, r: UInt8, g: UInt8, b: UInt8, a: UInt8): UInt32{.
+proc MapRGBA*(format: PPixelFormat, r: byte, g: byte, b: byte, a: byte): int32{.
     cdecl, importc: "SDL_MapRGBA", dynlib: LibName.}
   # Maps a pixel value into the RGB components for a given pixel format
-proc GetRGB*(pixel: UInt32, fmt: PPixelFormat, r: PUInt8, g: PUInt8, b: PUInt8){.
+proc GetRGB*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr byte){.
     cdecl, importc: "SDL_GetRGB", dynlib: LibName.}
   # Maps a pixel value into the RGBA components for a given pixel format
-proc GetRGBA*(pixel: UInt32, fmt: PPixelFormat, r: PUInt8, g: PUInt8, b: PUInt8, 
-              a: PUInt8){.cdecl, importc: "SDL_GetRGBA", dynlib: LibName.}
+proc GetRGBA*(pixel: int32, fmt: PPixelFormat, r: ptr byte, g: ptr byte, b: ptr byte, 
+              a: ptr byte){.cdecl, importc: "SDL_GetRGBA", dynlib: LibName.}
   # Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
   #  If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
   #  If the depth is greater than 8 bits, the pixel format is set using the
@@ -1966,13 +1932,13 @@ proc GetRGBA*(pixel: UInt32, fmt: PPixelFormat, r: PUInt8, g: PUInt8, b: PUInt8,
   #  will be set in the flags member of the returned surface.  If for some
   #  reason the surface could not be placed in video memory, it will not have
   #  the SDL_HWSURFACE flag set, and will be created in system memory instead.
-proc AllocSurface*(flags: UInt32, width, height, depth: int, 
-                   RMask, GMask, BMask, AMask: UInt32): PSurface
-proc CreateRGBSurface*(flags: UInt32, width, height, depth: int, 
-                       RMask, GMask, BMask, AMask: UInt32): PSurface{.cdecl, 
+proc AllocSurface*(flags: int32, width, height, depth: int, 
+                   RMask, GMask, BMask, AMask: int32): PSurface
+proc CreateRGBSurface*(flags: int32, width, height, depth: int, 
+                       RMask, GMask, BMask, AMask: int32): PSurface{.cdecl, 
     importc: "SDL_CreateRGBSurface", dynlib: LibName.}
 proc CreateRGBSurfaceFrom*(pixels: Pointer, width, height, depth, pitch: int, 
-                           RMask, GMask, BMask, AMask: UInt32): PSurface{.cdecl, 
+                           RMask, GMask, BMask, AMask: int32): PSurface{.cdecl, 
     importc: "SDL_CreateRGBSurfaceFrom", dynlib: LibName.}
 proc FreeSurface*(surface: PSurface){.cdecl, importc: "SDL_FreeSurface", 
                                       dynlib: LibName.}
@@ -2019,7 +1985,7 @@ proc SaveBMP*(surface: PSurface, filename: cstring): int
   #  and removes RLE acceleration if absent.
   #  If 'flag' is 0, this function clears any current color key.
   #  This function returns 0, or -1 if there was an error.
-proc SetColorKey*(surface: PSurface, flag, key: UInt32): int{.cdecl, 
+proc SetColorKey*(surface: PSurface, flag, key: int32): int{.cdecl, 
     importc: "SDL_SetColorKey", dynlib: LibName.}
   # This function sets the alpha value for the entire surface, as opposed to
   #  using the alpha component of each pixel. This value measures the range
@@ -2032,7 +1998,7 @@ proc SetColorKey*(surface: PSurface, flag, key: UInt32): int{.cdecl,
   #  If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
   #  OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
   #  surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
-proc SetAlpha*(surface: PSurface, flag: UInt32, alpha: UInt8): int{.cdecl, 
+proc SetAlpha*(surface: PSurface, flag: int32, alpha: byte): int{.cdecl, 
     importc: "SDL_SetAlpha", dynlib: LibName.}
   # Sets the clipping rectangle for the destination surface in a blit.
   #
@@ -2061,7 +2027,7 @@ proc GetClipRect*(surface: PSurface, rect: PRect){.cdecl,
   #  surface.
   #
   #  This function is used internally by SDL_DisplayFormat().
-proc ConvertSurface*(src: PSurface, fmt: PPixelFormat, flags: UInt32): PSurface{.
+proc ConvertSurface*(src: PSurface, fmt: PPixelFormat, flags: int32): PSurface{.
     cdecl, importc: "SDL_ConvertSurface", dynlib: LibName.}
   #
   #  This performs a fast blit from the source surface to the destination
@@ -2148,7 +2114,7 @@ proc LowerBlit*(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): i
   #  The color should be a pixel of the format used by the surface, and
   #  can be generated by the SDL_MapRGB() function.
   #  This function returns 0 on success, or -1 on error.
-proc FillRect*(dst: PSurface, dstrect: PRect, color: UInt32): int{.cdecl, 
+proc FillRect*(dst: PSurface, dstrect: PRect, color: int32): int{.cdecl, 
     importc: "SDL_FillRect", dynlib: LibName.}
   # This function takes a surface and copies it to a new surface of the
   #  pixel format and colors of the video framebuffer, suitable for fast
@@ -2180,7 +2146,7 @@ proc DisplayFormatAlpha*(surface: PSurface): PSurface{.cdecl,
   #  Calling the returned surface an overlay is something of a misnomer because
   #  the contents of the display surface underneath the area where the overlay
   #  is shown is undefined - it may be overwritten with the converted YUV data.
-proc CreateYUVOverlay*(width: int, height: int, format: UInt32, 
+proc CreateYUVOverlay*(width: int, height: int, format: int32, 
                        display: PSurface): POverlay{.cdecl, 
     importc: "SDL_CreateYUVOverlay", dynlib: LibName.}
   # Lock an overlay for direct access, and unlock it when you are done
@@ -2246,7 +2212,7 @@ proc WM_SetCaption*(title: cstring, icon: cstring){.cdecl,
   #  This function must be called before the first call to SDL_SetVideoMode().
   #  It takes an icon surface, and a mask in MSB format.
   #  If 'mask' is NULL, the entire icon surface will be used as the icon.
-proc WM_SetIcon*(icon: PSurface, mask: UInt8){.cdecl, importc: "SDL_WM_SetIcon", 
+proc WM_SetIcon*(icon: PSurface, mask: byte){.cdecl, importc: "SDL_WM_SetIcon", 
     dynlib: LibName.}
   # This function iconifies the window, and returns 1 if it succeeded.
   #  If the function succeeds, it generates an SDL_APPACTIVE loss event.
@@ -2280,13 +2246,13 @@ proc WM_GrabInput*(mode: TGrabMode): TGrabMode{.cdecl,
   #  The current button state is returned as a button bitmask, which can
   #  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   #  current mouse cursor position.  You can pass NULL for either x or y.
-proc GetMouseState*(x: var int, y: var int): UInt8{.cdecl, 
+proc GetMouseState*(x: var int, y: var int): byte{.cdecl, 
     importc: "SDL_GetMouseState", dynlib: LibName.}
   # Retrieve the current state of the mouse.
   #  The current button state is returned as a button bitmask, which can
   #  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
   #  mouse deltas since the last call to SDL_GetRelativeMouseState().
-proc GetRelativeMouseState*(x: var int, y: var int): UInt8{.cdecl, 
+proc GetRelativeMouseState*(x: var int, y: var int): byte{.cdecl, 
     importc: "SDL_GetRelativeMouseState", dynlib: LibName.}
   # Set the position of the mouse cursor (generates a mouse motion event)
 proc WarpMouse*(x, y: UInt16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName.}
@@ -2301,7 +2267,7 @@ proc WarpMouse*(x, y: UInt16){.cdecl, importc: "SDL_WarpMouse", dynlib: LibName.
   #   1     0       Inverted color if possible, black if not.
   #
   #  Cursors created with this function must be freed with SDL_FreeCursor().
-proc CreateCursor*(data, mask: PUInt8, w, h, hot_x, hot_y: int): PCursor{.cdecl, 
+proc CreateCursor*(data, mask: ptr byte, w, h, hot_x, hot_y: int): PCursor{.cdecl, 
     importc: "SDL_CreateCursor", dynlib: LibName.}
   # Set the currently active cursor to the specified one.
   #  If the cursor is currently visible, the change will be immediately
@@ -2341,9 +2307,9 @@ proc GetKeyRepeat*(delay: PInteger, interval: PInteger){.cdecl,
   #  Returns an array of keystates, indexed by the SDLK_* syms.
   #  Used:
   #
-  #  UInt8 *keystate = SDL_GetKeyState(NULL);
+  #  byte *keystate = SDL_GetKeyState(NULL);
   #  if ( keystate[SDLK_RETURN] ) ... <RETURN> is pressed
-proc GetKeyState*(numkeys: PInt): PUInt8{.cdecl, importc: "SDL_GetKeyState", 
+proc GetKeyState*(numkeys: pointer): ptr byte{.cdecl, importc: "SDL_GetKeyState", 
     dynlib: LibName.}
   # Get the current key modifier state
 proc GetModState*(): TMod{.cdecl, importc: "SDL_GetModState", dynlib: LibName.}
@@ -2361,7 +2327,7 @@ proc GetKeyName*(key: TKey): cstring{.cdecl, importc: "SDL_GetKeyName",
   #  bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
   #  SDL_APPACTIVE.  If SDL_APPACTIVE is set, then the user is able to
   #  see your application, otherwise it has been iconified or disabled.
-proc GetAppState*(): UInt8{.cdecl, importc: "SDL_GetAppState", dynlib: LibName.}
+proc GetAppState*(): byte{.cdecl, importc: "SDL_GetAppState", dynlib: LibName.}
   # Mutex functions
   # Create a mutex, initialized unlocked
 proc CreateMutex*(): PMutex{.cdecl, importc: "SDL_CreateMutex", dynlib: LibName.}
@@ -2378,7 +2344,7 @@ proc DestroyMutex*(mutex: Pmutex){.cdecl, importc: "SDL_DestroyMutex",
   # Semaphore functions
   # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   # Create a semaphore, initialized with value, returns NULL on failure.
-proc CreateSemaphore*(initial_value: UInt32): PSem{.cdecl, 
+proc CreateSemaphore*(initial_value: int32): PSem{.cdecl, 
     importc: "SDL_CreateSemaphore", dynlib: LibName.}
   # Destroy a semaphore
 proc DestroySemaphore*(sem: Psem){.cdecl, importc: "SDL_DestroySemaphore", 
@@ -2396,13 +2362,13 @@ proc SemTryWait*(sem: Psem): int{.cdecl, importc: "SDL_SemTryWait",
   #   the allotted time, and -1 on error.
   #   On some platforms this function is implemented by looping with a delay
   #   of 1 ms, and so should be avoided if possible.
-proc SemWaitTimeout*(sem: Psem, ms: UInt32): int{.cdecl, 
+proc SemWaitTimeout*(sem: Psem, ms: int32): int{.cdecl, 
     importc: "SDL_SemWaitTimeout", dynlib: LibName.}
   # Atomically increases the semaphore's count (not blocking), returns 0,
   #   or -1 on error.
 proc SemPost*(sem: Psem): int{.cdecl, importc: "SDL_SemPost", dynlib: LibName.}
   # Returns the current count of the semaphore
-proc SemValue*(sem: Psem): UInt32{.cdecl, importc: "SDL_SemValue", 
+proc SemValue*(sem: Psem): int32{.cdecl, importc: "SDL_SemValue", 
                                    dynlib: LibName.}
   # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   # Condition variable functions
@@ -2430,19 +2396,19 @@ proc CondWait*(cond: Pcond, mut: Pmutex): int{.cdecl, importc: "SDL_CondWait",
   #  signaled in the allotted time, and -1 on error.
   #  On some platforms this function is implemented by looping with a delay
   #  of 1 ms, and so should be avoided if possible.
-proc CondWaitTimeout*(cond: Pcond, mut: Pmutex, ms: UInt32): int{.cdecl, 
+proc CondWaitTimeout*(cond: Pcond, mut: Pmutex, ms: int32): int{.cdecl, 
     importc: "SDL_CondWaitTimeout", dynlib: LibName.}
   # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   # Condition variable functions
   # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   # Create a thread
-proc CreateThread*(fn: PInt, data: Pointer): PThread{.cdecl, 
+proc CreateThread*(fn, data: Pointer): PThread{.cdecl, 
     importc: "SDL_CreateThread", dynlib: LibName.}
   # Get the 32-bit thread identifier for the current thread
-proc ThreadID*(): UInt32{.cdecl, importc: "SDL_ThreadID", dynlib: LibName.}
+proc ThreadID*(): int32{.cdecl, importc: "SDL_ThreadID", dynlib: LibName.}
   # Get the 32-bit thread identifier for the specified thread,
   #  equivalent to SDL_ThreadID() if the specified thread is NULL.
-proc GetThreadID*(thread: PThread): UInt32{.cdecl, importc: "SDL_GetThreadID", 
+proc GetThreadID*(thread: PThread): int32{.cdecl, importc: "SDL_GetThreadID", 
     dynlib: LibName.}
   # Wait for a thread to finish.
   #  The return code for the thread function is placed in the area
@@ -2481,7 +2447,7 @@ proc LoadFunction*(handle: Pointer, name: cstring): Pointer{.cdecl,
 proc UnloadObject*(handle: Pointer){.cdecl, importc: "SDL_UnloadObject", 
                                      dynlib: LibName.}
   #------------------------------------------------------------------------------
-proc Swap32*(D: Uint32): Uint32
+proc Swap32*(D: int32): int32
   # Bitwise Checking functions
 proc IsBitOn*(value: int, bit: int8): bool
 proc TurnBitOn*(value: int, bit: int8): int
@@ -2509,7 +2475,7 @@ proc RWWrite(context: PRWops, theptr: Pointer, size: int, n: int): int =
 proc RWClose(context: PRWops): int = 
   Result = context.closeFile(context)
 
-proc LoadWAV(filename: cstring, spec: PAudioSpec, audio_buf: PUInt8, 
+proc LoadWAV(filename: cstring, spec: PAudioSpec, audio_buf: ptr byte, 
              audiolen: PUInt32): PAudioSpec = 
   Result = LoadWAV_RW(RWFromFile(filename, "rb"), 1, spec, audio_buf, audiolen)
 
@@ -2551,8 +2517,8 @@ proc SaveBMP(surface: PSurface, filename: cstring): int =
 proc BlitSurface(src: PSurface, srcrect: PRect, dst: PSurface, dstrect: PRect): int = 
   Result = UpperBlit(src, srcrect, dst, dstrect)
 
-proc AllocSurface(flags: UInt32, width, height, depth: int, 
-                  RMask, GMask, BMask, AMask: UInt32): PSurface = 
+proc AllocSurface(flags: int32, width, height, depth: int, 
+                  RMask, GMask, BMask, AMask: int32): PSurface = 
   Result = CreateRGBSurface(flags, width, height, depth, RMask, GMask, BMask, 
                             AMask)
 
@@ -2569,7 +2535,7 @@ proc UnlockMutex(mutex: Pmutex): int =
 proc BUTTON(Button: int): int = 
   Result = PRESSED shl (Button - 1)
 
-proc Swap32(D: Uint32): Uint32 = 
+proc Swap32(D: int32): int32 = 
   Result = ((D shl 24) or ((D shl 8) and 0x00FF0000) or
       ((D shr 8) and 0x0000FF00) or (D shr 24))
 
diff --git a/lib/wrappers/sdl/sdl_gfx.nim b/lib/wrappers/sdl/sdl_gfx.nim
new file mode 100755
index 000000000..cf36c4989
--- /dev/null
+++ b/lib/wrappers/sdl/sdl_gfx.nim
@@ -0,0 +1,452 @@
+#
+#  $Id: sdl_gfx.pas,v 1.3 2007/05/29 21:31:04 savage Exp $
+#
+#
+#
+#  $Log: sdl_gfx.pas,v $
+#  Revision 1.3  2007/05/29 21:31:04  savage
+#  Changes as suggested by Almindor for 64bit compatibility.
+#
+#  Revision 1.2  2007/05/20 20:30:18  savage
+#  Initial Changes to Handle 64 Bits
+#
+#  Revision 1.1  2005/01/03 19:08:32  savage
+#  Header for the SDL_Gfx library.
+#
+#
+#
+#
+
+import 
+  sdl
+
+when defined(windows): 
+  const 
+    gfxLibName = "SDL_gfx.dll"
+elif defined(macosx): 
+  const 
+    gfxLibName = "libSDL_gfx.dylib"
+else: 
+  const 
+    gfxLibName = "libSDL_gfx.so"
+const                         # Some rates in Hz
+  FPS_UPPER_LIMIT* = 200
+  FPS_LOWER_LIMIT* = 1
+  FPS_DEFAULT* = 30           # ---- Defines
+  SMOOTHING_OFF* = 0
+  SMOOTHING_ON* = 1
+
+type 
+  PFPSmanager* = ptr TFPSmanager
+  TFPSmanager*{.final.} = object  # ---- Structures
+    framecount*: Uint32
+    rateticks*: float32
+    lastticks*: Uint32
+    rate*: Uint32
+
+  PColorRGBA* = ptr TColorRGBA
+  TColorRGBA*{.final.} = object 
+    r*: byte
+    g*: byte
+    b*: byte
+    a*: byte
+
+  PColorY* = ptr TColorY
+  TColorY*{.final.} = object  #
+                              #
+                              # SDL_framerate: framerate manager
+                              #
+                              # LGPL (c) A. Schiffler
+                              #
+                              #
+    y*: byte
+
+
+proc initFramerate*(manager: PFPSmanager){.cdecl, importc: "SDL_initFramerate", 
+    dynlib: gfxLibName.}
+proc setFramerate*(manager: PFPSmanager, rate: cint): cint{.cdecl, 
+    importc: "SDL_setFramerate", dynlib: gfxLibName.}
+proc getFramerate*(manager: PFPSmanager): cint{.cdecl, 
+    importc: "SDL_getFramerate", dynlib: gfxLibName.}
+proc framerateDelay*(manager: PFPSmanager){.cdecl, 
+    importc: "SDL_framerateDelay", dynlib: gfxLibName.}
+  #
+  #
+  # SDL_gfxPrimitives: graphics primitives for SDL
+  #
+  # LGPL (c) A. Schiffler
+  #
+  #
+  # Note: all ___Color routines expect the color to be in format 0xRRGGBBAA 
+  # Pixel 
+proc pixelColor*(dst: PSurface, x: int16, y: int16, color: Uint32): cint{.
+    cdecl, importc: "pixelColor", dynlib: gfxLibName.}
+proc pixelRGBA*(dst: PSurface, x: int16, y: int16, r: byte, g: byte, 
+                b: byte, a: byte): cint{.cdecl, importc: "pixelRGBA", 
+    dynlib: gfxLibName.}
+  # Horizontal line 
+proc hlineColor*(dst: PSurface, x1: int16, x2: int16, y: int16, color: Uint32): cint{.
+    cdecl, importc: "hlineColor", dynlib: gfxLibName.}
+proc hlineRGBA*(dst: PSurface, x1: int16, x2: int16, y: int16, r: byte, 
+                g: byte, b: byte, a: byte): cint{.cdecl, importc: "hlineRGBA", 
+    dynlib: gfxLibName.}
+  # Vertical line 
+proc vlineColor*(dst: PSurface, x: int16, y1: int16, y2: int16, color: Uint32): cint{.
+    cdecl, importc: "vlineColor", dynlib: gfxLibName.}
+proc vlineRGBA*(dst: PSurface, x: int16, y1: int16, y2: int16, r: byte, 
+                g: byte, b: byte, a: byte): cint{.cdecl, importc: "vlineRGBA", 
+    dynlib: gfxLibName.}
+  # Rectangle 
+proc rectangleColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, 
+                     y2: int16, color: Uint32): cint{.cdecl, 
+    importc: "rectangleColor", dynlib: gfxLibName.}
+proc rectangleRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, 
+                    y2: int16, r: byte, g: byte, b: byte, a: byte): cint{.
+    cdecl, importc: "rectangleRGBA", dynlib: gfxLibName.}
+  # Filled rectangle (Box) 
+proc boxColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+               color: Uint32): cint{.cdecl, importc: "boxColor", 
+                                    dynlib: gfxLibName.}
+proc boxRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+              r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "boxRGBA", dynlib: gfxLibName.}
+  # Line 
+proc lineColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+                color: Uint32): cint{.cdecl, importc: "lineColor", 
+                                     dynlib: gfxLibName.}
+proc lineRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+               r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "lineRGBA", dynlib: gfxLibName.}
+  # AA Line 
+proc aalineColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+                  color: Uint32): cint{.cdecl, importc: "aalineColor", 
+                                       dynlib: gfxLibName.}
+proc aalineRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+                 r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "aalineRGBA", dynlib: gfxLibName.}
+  # Circle 
+proc circleColor*(dst: PSurface, x: int16, y: int16, r: int16, color: Uint32): cint{.
+    cdecl, importc: "circleColor", dynlib: gfxLibName.}
+proc circleRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, r: byte, 
+                 g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "circleRGBA", dynlib: gfxLibName.}
+  # AA Circle 
+proc aacircleColor*(dst: PSurface, x: int16, y: int16, r: int16, 
+                    color: Uint32): cint{.cdecl, importc: "aacircleColor", 
+    dynlib: gfxLibName.}
+proc aacircleRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, r: byte, 
+                   g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "aacircleRGBA", dynlib: gfxLibName.}
+  # Filled Circle 
+proc filledCircleColor*(dst: PSurface, x: int16, y: int16, r: int16, 
+                        color: Uint32): cint{.cdecl, 
+    importc: "filledCircleColor", dynlib: gfxLibName.}
+proc filledCircleRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, 
+                       r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "filledCircleRGBA", dynlib: gfxLibName.}
+  # Ellipse 
+proc ellipseColor*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, 
+                   color: Uint32): cint{.cdecl, importc: "ellipseColor", 
+                                        dynlib: gfxLibName.}
+proc ellipseRGBA*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, 
+                  r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "ellipseRGBA", dynlib: gfxLibName.}
+  # AA Ellipse 
+proc aaellipseColor*(dst: PSurface, xc: int16, yc: int16, rx: int16, 
+                     ry: int16, color: Uint32): cint{.cdecl, 
+    importc: "aaellipseColor", dynlib: gfxLibName.}
+proc aaellipseRGBA*(dst: PSurface, x: int16, y: int16, rx: int16, ry: int16, 
+                    r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "aaellipseRGBA", dynlib: gfxLibName.}
+  # Filled Ellipse 
+proc filledEllipseColor*(dst: PSurface, x: int16, y: int16, rx: int16, 
+                         ry: int16, color: Uint32): cint{.cdecl, 
+    importc: "filledEllipseColor", dynlib: gfxLibName.}
+proc filledEllipseRGBA*(dst: PSurface, x: int16, y: int16, rx: int16, 
+                        ry: int16, r: byte, g: byte, b: byte, a: byte): cint{.
+    cdecl, importc: "filledEllipseRGBA", dynlib: gfxLibName.}
+  # Pie
+proc pieColor*(dst: PSurface, x: int16, y: int16, rad: int16, start: int16, 
+               finish: int16, color: Uint32): cint{.cdecl, importc: "pieColor", 
+    dynlib: gfxLibName.}
+proc pieRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, start: int16, 
+              finish: int16, r: byte, g: byte, b: byte, a: byte): cint{.
+    cdecl, importc: "pieRGBA", dynlib: gfxLibName.}
+  # Filled Pie
+proc filledPieColor*(dst: PSurface, x: int16, y: int16, rad: int16, 
+                     start: int16, finish: int16, color: Uint32): cint{.cdecl, 
+    importc: "filledPieColor", dynlib: gfxLibName.}
+proc filledPieRGBA*(dst: PSurface, x: int16, y: int16, rad: int16, 
+                    start: int16, finish: int16, r: byte, g: byte, b: byte, 
+                    a: byte): cint{.cdecl, importc: "filledPieRGBA", 
+                                    dynlib: gfxLibName.}
+  # Trigon
+proc trigonColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+                  x3: int16, y3: int16, color: Uint32): cint{.cdecl, 
+    importc: "trigonColor", dynlib: gfxLibName.}
+proc trigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, y2: int16, 
+                 x3: int16, y3: int16, r: byte, g: byte, b: byte, a: byte): cint{.
+    cdecl, importc: "trigonRGBA", dynlib: gfxLibName.}
+  # AA-Trigon
+proc aatrigonColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, 
+                    y2: int16, x3: int16, y3: int16, color: Uint32): cint{.
+    cdecl, importc: "aatrigonColor", dynlib: gfxLibName.}
+proc aatrigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, 
+                   y2: int16, x3: int16, y3: int16, r: byte, g: byte, 
+                   b: byte, a: byte): cint{.cdecl, importc: "aatrigonRGBA", 
+    dynlib: gfxLibName.}
+  # Filled Trigon
+proc filledTrigonColor*(dst: PSurface, x1: int16, y1: int16, x2: int16, 
+                        y2: int16, x3: int16, y3: int16, color: Uint32): cint{.
+    cdecl, importc: "filledTrigonColor", dynlib: gfxLibName.}
+proc filledTrigonRGBA*(dst: PSurface, x1: int16, y1: int16, x2: int16, 
+                       y2: int16, x3: int16, y3: int16, r: byte, g: byte, 
+                       b: byte, a: byte): cint{.cdecl, 
+    importc: "filledTrigonRGBA", dynlib: gfxLibName.}
+  # Polygon
+proc polygonColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, 
+                   color: Uint32): cint{.cdecl, importc: "polygonColor", 
+                                        dynlib: gfxLibName.}
+proc polygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, r: byte, 
+                  g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "polygonRGBA", dynlib: gfxLibName.}
+  # AA-Polygon
+proc aapolygonColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, 
+                     color: Uint32): cint{.cdecl, importc: "aapolygonColor", 
+    dynlib: gfxLibName.}
+proc aapolygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, r: byte, 
+                    g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "aapolygonRGBA", dynlib: gfxLibName.}
+  # Filled Polygon
+proc filledPolygonColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, 
+                         color: Uint32): cint{.cdecl, 
+    importc: "filledPolygonColor", dynlib: gfxLibName.}
+proc filledPolygonRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, 
+                        r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "filledPolygonRGBA", dynlib: gfxLibName.}
+  # Bezier
+  # s = number of steps
+proc bezierColor*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, s: cint, 
+                  color: Uint32): cint{.cdecl, importc: "bezierColor", 
+                                       dynlib: gfxLibName.}
+proc bezierRGBA*(dst: PSurface, vx: ptr int16, vy: ptr int16, n: cint, s: cint, 
+                 r: byte, g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "bezierRGBA", dynlib: gfxLibName.}
+  # Characters/Strings
+proc characterColor*(dst: PSurface, x: int16, y: int16, c: char, color: Uint32): cint{.
+    cdecl, importc: "characterColor", dynlib: gfxLibName.}
+proc characterRGBA*(dst: PSurface, x: int16, y: int16, c: char, r: byte, 
+                    g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "characterRGBA", dynlib: gfxLibName.}
+proc stringColor*(dst: PSurface, x: int16, y: int16, c: cstring, color: Uint32): cint{.
+    cdecl, importc: "stringColor", dynlib: gfxLibName.}
+proc stringRGBA*(dst: PSurface, x: int16, y: int16, c: cstring, r: byte, 
+                 g: byte, b: byte, a: byte): cint{.cdecl, 
+    importc: "stringRGBA", dynlib: gfxLibName.}
+proc gfxPrimitivesSetFont*(fontdata: Pointer, cw: cint, ch: cint){.cdecl, 
+    importc: "gfxPrimitivesSetFont", dynlib: gfxLibName.}
+  #
+  #
+  # SDL_imageFilter - bytes-image "filter" routines
+  # (uses inline x86 MMX optimizations if available)
+  #
+  # LGPL (c) A. Schiffler
+  #
+  #
+  # Comments:                                                                           
+  #  1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary. 
+  #  2.) Data that is not within an 8 byte boundary is processed using the C routine.   
+  #  3.) Convolution routines do not have C routines at this time.                      
+  # Detect MMX capability in CPU
+proc imageFilterMMXdetect*(): cint{.cdecl, importc: "SDL_imageFilterMMXdetect", 
+                                   dynlib: gfxLibName.}
+  # Force use of MMX off (or turn possible use back on)
+proc imageFilterMMXoff*(){.cdecl, importc: "SDL_imageFilterMMXoff", 
+                           dynlib: gfxLibName.}
+proc imageFilterMMXon*(){.cdecl, importc: "SDL_imageFilterMMXon", 
+                          dynlib: gfxLibName.}
+  #
+  # All routines return:
+  #   0   OK
+  #  -1   Error (internal error, parameter error)
+  #
+  #  SDL_imageFilterAdd: D = saturation255(S1 + S2)
+proc imageFilterAdd*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterAdd", dynlib: gfxLibName.}
+  #  SDL_imageFilterMean: D = S1/2 + S2/2
+proc imageFilterMean*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterMean", dynlib: gfxLibName.}
+  #  SDL_imageFilterSub: D = saturation0(S1 - S2)
+proc imageFilterSub*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterSub", dynlib: gfxLibName.}
+  #  SDL_imageFilterAbsDiff: D = | S1 - S2 |
+proc imageFilterAbsDiff*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterAbsDiff", dynlib: gfxLibName.}
+  #  SDL_imageFilterMult: D = saturation(S1 * S2)
+proc imageFilterMult*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterMult", dynlib: gfxLibName.}
+  #  SDL_imageFilterMultNor: D = S1 * S2   (non-MMX)
+proc imageFilterMultNor*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterMultNor", dynlib: gfxLibName.}
+  #  SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
+proc imageFilterMultDivby2*(Src1: cstring, Src2: cstring, Dest: cstring, 
+                            len: cint): cint{.cdecl, 
+    importc: "SDL_imageFilterMultDivby2", dynlib: gfxLibName.}
+  #  SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
+proc imageFilterMultDivby4*(Src1: cstring, Src2: cstring, Dest: cstring, 
+                            len: cint): cint{.cdecl, 
+    importc: "SDL_imageFilterMultDivby4", dynlib: gfxLibName.}
+  #  SDL_imageFilterBitAnd: D = S1 & S2
+proc imageFilterBitAnd*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterBitAnd", dynlib: gfxLibName.}
+  #  SDL_imageFilterBitOr: D = S1 | S2
+proc imageFilterBitOr*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterBitOr", dynlib: gfxLibName.}
+  #  SDL_imageFilterDiv: D = S1 / S2   (non-MMX)
+proc imageFilterDiv*(Src1: cstring, Src2: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterDiv", dynlib: gfxLibName.}
+  #  SDL_imageFilterBitNegation: D = !S
+proc imageFilterBitNegation*(Src1: cstring, Dest: cstring, len: cint): cint{.
+    cdecl, importc: "SDL_imageFilterBitNegation", dynlib: gfxLibName.}
+  #  SDL_imageFilterAddByte: D = saturation255(S + C)
+proc imageFilterAddByte*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{.
+    cdecl, importc: "SDL_imageFilterAddByte", dynlib: gfxLibName.}
+  #  SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
+proc imageFilterAddUint*(Src1: cstring, Dest: cstring, len: cint, C: cint): cint{.
+    cdecl, importc: "SDL_imageFilterAddUint", dynlib: gfxLibName.}
+  #  SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
+proc imageFilterAddByteToHalf*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{.
+    cdecl, importc: "SDL_imageFilterAddByteToHalf", dynlib: gfxLibName.}
+  #  SDL_imageFilterSubByte: D = saturation0(S - C)
+proc imageFilterSubByte*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{.
+    cdecl, importc: "SDL_imageFilterSubByte", dynlib: gfxLibName.}
+  #  SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
+proc imageFilterSubUint*(Src1: cstring, Dest: cstring, len: cint, C: cint): cint{.
+    cdecl, importc: "SDL_imageFilterSubUint", dynlib: gfxLibName.}
+  #  SDL_imageFilterShiftRight: D = saturation0(S >> N)
+proc imageFilterShiftRight*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{.
+    cdecl, importc: "SDL_imageFilterShiftRight", dynlib: gfxLibName.}
+  #  SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
+proc imageFilterShiftRightUint*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{.
+    cdecl, importc: "SDL_imageFilterShiftRightUint", dynlib: gfxLibName.}
+  #  SDL_imageFilterMultByByte: D = saturation255(S * C)
+proc imageFilterMultByByte*(Src1: cstring, Dest: cstring, len: cint, C: char): cint{.
+    cdecl, importc: "SDL_imageFilterMultByByte", dynlib: gfxLibName.}
+  #  SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
+proc imageFilterShiftRightAndMultByByte*(Src1: cstring, Dest: cstring, len: cint, 
+    N: char, C: char): cint{.cdecl, 
+                            importc: "SDL_imageFilterShiftRightAndMultByByte", 
+                            dynlib: gfxLibName.}
+  #  SDL_imageFilterShiftLeftByte: D = (S << N)
+proc imageFilterShiftLeftByte*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{.
+    cdecl, importc: "SDL_imageFilterShiftLeftByte", dynlib: gfxLibName.}
+  #  SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
+proc imageFilterShiftLeftUint*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{.
+    cdecl, importc: "SDL_imageFilterShiftLeftUint", dynlib: gfxLibName.}
+  #  SDL_imageFilterShiftLeft: D = saturation255(S << N)
+proc imageFilterShiftLeft*(Src1: cstring, Dest: cstring, len: cint, N: char): cint{.
+    cdecl, importc: "SDL_imageFilterShiftLeft", dynlib: gfxLibName.}
+  #  SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
+proc imageFilterBinarizeUsingThreshold*(Src1: cstring, Dest: cstring, len: cint, 
+                                        T: char): cint{.cdecl, 
+    importc: "SDL_imageFilterBinarizeUsingThreshold", dynlib: gfxLibName.}
+  #  SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
+proc imageFilterClipToRange*(Src1: cstring, Dest: cstring, len: cint, Tmin: int8, 
+                             Tmax: int8): cint{.cdecl, 
+    importc: "SDL_imageFilterClipToRange", dynlib: gfxLibName.}
+  #  SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
+proc imageFilterNormalizeLinear*(Src1: cstring, Dest: cstring, len: cint, 
+                                 Cmin: cint, Cmax: cint, Nmin: cint, Nmax: cint): cint{.
+    cdecl, importc: "SDL_imageFilterNormalizeLinear", dynlib: gfxLibName.}
+  # !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!! 
+  #  SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel3x3Divide*(Src: cstring, Dest: cstring, rows: cint, 
+    columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel3x3Divide", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel5x5Divide*(Src: cstring, Dest: cstring, rows: cint, 
+    columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel5x5Divide", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel7x7Divide*(Src: cstring, Dest: cstring, rows: cint, 
+    columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel7x7Divide", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel9x9Divide*(Src: cstring, Dest: cstring, rows: cint, 
+    columns: cint, Kernel: pointer, Divisor: int8): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel9x9Divide", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel3x3ShiftRight*(Src: cstring, Dest: cstring, 
+    rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel3x3ShiftRight", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel5x5ShiftRight*(Src: cstring, Dest: cstring, 
+    rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel5x5ShiftRight", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel7x7ShiftRight*(Src: cstring, Dest: cstring, 
+    rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel7x7ShiftRight", dynlib: gfxLibName.}
+  #  SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
+proc imageFilterConvolveKernel9x9ShiftRight*(Src: cstring, Dest: cstring, 
+    rows: cint, columns: cint, Kernel: pointer, NRightShift: char): cint{.cdecl, 
+    importc: "SDL_imageFilterConvolveKernel9x9ShiftRight", dynlib: gfxLibName.}
+  #  SDL_imageFilterSobelX: Dij = saturation255( ... )
+proc imageFilterSobelX*(Src: cstring, Dest: cstring, rows: cint, columns: cint): cint{.
+    cdecl, importc: "SDL_imageFilterSobelX", dynlib: gfxLibName.}
+  #  SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
+proc imageFilterSobelXShiftRight*(Src: cstring, Dest: cstring, rows: cint, 
+                                  columns: cint, NRightShift: char): cint{.cdecl, 
+    importc: "SDL_imageFilterSobelXShiftRight", dynlib: gfxLibName.}
+  # Align/restore stack to 32 byte boundary -- Functionality untested! --
+proc imageFilterAlignStack*(){.cdecl, importc: "SDL_imageFilterAlignStack", 
+                               dynlib: gfxLibName.}
+proc imageFilterRestoreStack*(){.cdecl, importc: "SDL_imageFilterRestoreStack", 
+                                 dynlib: gfxLibName.}
+  #
+  #
+  # SDL_rotozoom - rotozoomer
+  #
+  # LGPL (c) A. Schiffler
+  #
+  #
+  # 
+  # 
+  # rotozoomSurface()
+  #
+  # Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
+  # 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
+  # then the destination 32bit surface is anti-aliased. If the surface is not 8bit
+  # or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
+  #
+  #
+proc rotozoomSurface*(src: PSurface, angle: float64, zoom: float64, smooth: cint): PSurface{.
+    cdecl, importc: "rotozoomSurface", dynlib: gfxLibName.}
+proc rotozoomSurfaceXY*(src: PSurface, angle: float64, zoomx: float64, 
+                        zoomy: float64, smooth: cint): PSurface{.cdecl, 
+    importc: "rotozoomSurfaceXY", dynlib: gfxLibName.}
+  # Returns the size of the target surface for a rotozoomSurface() call 
+proc rotozoomSurfaceSize*(width: cint, height: cint, angle: float64, 
+                          zoom: float64, dstwidth: var cint, dstheight: var cint){.
+    cdecl, importc: "rotozoomSurfaceSize", dynlib: gfxLibName.}
+proc rotozoomSurfaceSizeXY*(width: cint, height: cint, angle: float64, 
+                            zoomx: float64, zoomy: float64, dstwidth: var cint, 
+                            dstheight: var cint){.cdecl, 
+    importc: "rotozoomSurfaceSizeXY", dynlib: gfxLibName.}
+  #
+  #
+  # zoomSurface()
+  #
+  # Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
+  # 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
+  # then the destination 32bit surface is anti-aliased. If the surface is not 8bit
+  # or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
+  #
+  #
+proc zoomSurface*(src: PSurface, zoomx: float64, zoomy: float64, smooth: cint): PSurface{.
+    cdecl, importc: "zoomSurface", dynlib: gfxLibName.}
+  # Returns the size of the target surface for a zoomSurface() call 
+proc zoomSurfaceSize*(width: cint, height: cint, zoomx: float64, zoomy: float64, 
+                      dstwidth: var cint, dstheight: var cint){.cdecl, 
+    importc: "zoomSurfaceSize", dynlib: gfxLibName.}
+# implementation
diff --git a/lib/wrappers/sdl/sdl_image.nim b/lib/wrappers/sdl/sdl_image.nim
new file mode 100755
index 000000000..cc770a07f
--- /dev/null
+++ b/lib/wrappers/sdl/sdl_image.nim
@@ -0,0 +1,232 @@
+#
+#  $Id: sdl_image.pas,v 1.14 2007/05/29 21:31:13 savage Exp $
+#  
+#
+#******************************************************************************
+#                                                                              
+#       Borland Delphi SDL_Image - An example image loading library for use    
+#                                  with SDL                                    
+#       Conversion of the Simple DirectMedia Layer Image Headers               
+#                                                                              
+# Portions created by Sam Lantinga <slouken@devolution.com> are                
+# Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga                     
+# 5635-34 Springhouse Dr.                                                      
+# Pleasanton, CA 94588 (USA)                                                   
+#                                                                              
+# All Rights Reserved.                                                         
+#                                                                              
+# The original files are : SDL_image.h                                         
+#                                                                              
+# The initial developer of this Pascal code was :                              
+# Matthias Thoma <ma.thoma@gmx.de>                                             
+#                                                                              
+# Portions created by Matthias Thoma are                                       
+# Copyright (C) 2000 - 2001 Matthias Thoma.                                    
+#                                                                              
+#                                                                              
+# Contributor(s)                                                               
+# --------------                                                               
+# Dominique Louis <Dominique@SavageSoftware.com.au>                            
+#                                                                              
+# Obtained through:                                                            
+# Joint Endeavour of Delphi Innovators ( Project JEDI )                        
+#                                                                              
+# You may retrieve the latest version of this file at the Project              
+# JEDI home page, located at http://delphi-jedi.org                            
+#                                                                              
+# The contents of this file are used with permission, subject to               
+# the Mozilla Public License Version 1.1 (the "License"); you may              
+# not use this file except in compliance with the License. You may             
+# obtain a copy of the License at                                              
+# http://www.mozilla.org/MPL/MPL-1.1.html                                      
+#                                                                              
+# Software distributed under the License is distributed on an                  
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or               
+# implied. See the License for the specific language governing                 
+# rights and limitations under the License.                                    
+#                                                                              
+# Description                                                                  
+# -----------                                                                  
+#   A simple library to load images of various formats as SDL surfaces         
+#                                                                              
+# Requires                                                                     
+# --------                                                                     
+#   SDL.pas in your search path.                                               
+#                                                                              
+# Programming Notes                                                            
+# -----------------                                                            
+#   See the Aliens Demo on how to make use of this libaray                     
+#                                                                              
+# Revision History                                                             
+# ----------------                                                             
+#   April    02 2001 - MT : Initial Translation                                
+#                                                                              
+#   May      08 2001 - DL : Added ExternalSym derectives and copyright header  
+#                                                                              
+#   April   03 2003 - DL : Added jedi-sdl.inc include file to support more     
+#                          Pascal compilers. Initial support is now included   
+#                          for GnuPascal, VirtualPascal, TMT and obviously     
+#                          continue support for Delphi Kylix and FreePascal.   
+#                                                                              
+#   April   08 2003 - MK : Aka Mr Kroket - Added Better FPC support            
+#                                                                              
+#   April   24 2003 - DL : under instruction from Alexey Barkovoy, I have added
+#                          better TMT Pascal support and under instruction     
+#                          from Prof. Abimbola Olowofoyeku (The African Chief),
+#                          I have added better Gnu Pascal support              
+#                                                                              
+#   April   30 2003 - DL : under instruction from David Mears AKA              
+#                          Jason Siletto, I have added FPC Linux support.      
+#                          This was compiled with fpc 1.1, so remember to set  
+#                          include file path. ie. -Fi/usr/share/fpcsrc/rtl/*   
+#                                                                              
+#
+#  $Log: sdl_image.pas,v $
+#  Revision 1.14  2007/05/29 21:31:13  savage
+#  Changes as suggested by Almindor for 64bit compatibility.
+#
+#  Revision 1.13  2007/05/20 20:30:54  savage
+#  Initial Changes to Handle 64 Bits
+#
+#  Revision 1.12  2006/12/02 00:14:40  savage
+#  Updated to latest version
+#
+#  Revision 1.11  2005/04/10 18:22:59  savage
+#  Changes as suggested by Michalis, thanks.
+#
+#  Revision 1.10  2005/04/10 11:48:33  savage
+#  Changes as suggested by Michalis, thanks.
+#
+#  Revision 1.9  2005/01/05 01:47:07  savage
+#  Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
+#
+#  Revision 1.8  2005/01/04 23:14:44  savage
+#  Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
+#
+#  Revision 1.7  2005/01/01 02:03:12  savage
+#  Updated to v1.2.4
+#
+#  Revision 1.6  2004/08/14 22:54:30  savage
+#  Updated so that Library name defines are correctly defined for MacOS X.
+#
+#  Revision 1.5  2004/05/10 14:10:04  savage
+#  Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
+#
+#  Revision 1.4  2004/04/13 09:32:08  savage
+#  Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
+#
+#  Revision 1.3  2004/04/01 20:53:23  savage
+#  Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
+#
+#  Revision 1.2  2004/03/30 20:23:28  savage
+#  Tidied up use of UNIX compiler directive.
+#
+#  Revision 1.1  2004/02/14 23:35:42  savage
+#  version 1 of sdl_image, sdl_mixer and smpeg.
+#
+#
+#
+#******************************************************************************
+
+import 
+  sdl
+
+when defined(windows): 
+  const 
+    ImageLibName = "SDL_Image.dll"
+elif defined(macosx): 
+  const 
+    ImageLibName = "libSDL_image-1.2.0.dylib"
+else: 
+  const 
+    ImageLibName = "libSDL_image.so"
+const 
+  IMAGE_MAJOR_VERSION* = 1'i8
+  IMAGE_MINOR_VERSION* = 2'i8
+  IMAGE_PATCHLEVEL* = 5'i8
+
+# This macro can be used to fill a version structure with the compile-time
+#  version of the SDL_image library. 
+
+proc IMAGE_VERSION*(X: var TVersion)
+  # This function gets the version of the dynamically linked SDL_image library.
+  #   it should NOT be used to fill a version structure, instead you should
+  #   use the SDL_IMAGE_VERSION() macro.
+  # 
+proc IMG_Linked_Version*(): Pversion{.importc: "IMG_Linked_Version", 
+                                      dynlib: ImageLibName.}
+  # Load an image from an SDL data source.
+  #   The 'type' may be one of: "BMP", "GIF", "PNG", etc.
+  #
+  #   If the image format supports a transparent pixel, SDL will set the
+  #   colorkey for the surface.  You can enable RLE acceleration on the
+  #   surface afterwards by calling:
+  #        SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey);
+  #
+proc IMG_LoadTyped_RW*(src: PRWops, freesrc: cint, theType: cstring): PSurface{.
+    cdecl, importc: "IMG_LoadTyped_RW", dynlib: ImageLibName.}
+  # Convenience functions 
+proc IMG_Load*(theFile: cstring): PSurface{.cdecl, importc: "IMG_Load", 
+    dynlib: ImageLibName.}
+proc IMG_Load_RW*(src: PRWops, freesrc: cint): PSurface{.cdecl, 
+    importc: "IMG_Load_RW", dynlib: ImageLibName.}
+  # Invert the alpha of a surface for use with OpenGL
+  #  This function is now a no-op, and only provided for backwards compatibility. 
+proc IMG_InvertAlpha*(theOn: cint): cint{.cdecl, importc: "IMG_InvertAlpha", 
+                                        dynlib: ImageLibName.}
+  # Functions to detect a file type, given a seekable source 
+proc IMG_isBMP*(src: PRWops): cint{.cdecl, importc: "IMG_isBMP", 
+                                   dynlib: ImageLibName.}
+proc IMG_isGIF*(src: PRWops): cint{.cdecl, importc: "IMG_isGIF", 
+                                   dynlib: ImageLibName.}
+proc IMG_isJPG*(src: PRWops): cint{.cdecl, importc: "IMG_isJPG", 
+                                   dynlib: ImageLibName.}
+proc IMG_isLBM*(src: PRWops): cint{.cdecl, importc: "IMG_isLBM", 
+                                   dynlib: ImageLibName.}
+proc IMG_isPCX*(src: PRWops): cint{.cdecl, importc: "IMG_isPCX", 
+                                   dynlib: ImageLibName.}
+proc IMG_isPNG*(src: PRWops): cint{.cdecl, importc: "IMG_isPNG", 
+                                   dynlib: ImageLibName.}
+proc IMG_isPNM*(src: PRWops): cint{.cdecl, importc: "IMG_isPNM", 
+                                   dynlib: ImageLibName.}
+proc IMG_isTIF*(src: PRWops): cint{.cdecl, importc: "IMG_isTIF", 
+                                   dynlib: ImageLibName.}
+proc IMG_isXCF*(src: PRWops): cint{.cdecl, importc: "IMG_isXCF", 
+                                   dynlib: ImageLibName.}
+proc IMG_isXPM*(src: PRWops): cint{.cdecl, importc: "IMG_isXPM", 
+                                   dynlib: ImageLibName.}
+proc IMG_isXV*(src: PRWops): cint{.cdecl, importc: "IMG_isXV", 
+                                  dynlib: ImageLibName.}
+  # Individual loading functions 
+proc IMG_LoadBMP_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadBMP_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadGIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadGIF_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadJPG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadJPG_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadLBM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadLBM_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadPCX_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPCX_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadPNM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNM_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadPNG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNG_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadTGA_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTGA_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadTIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTIF_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadXCF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXCF_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadXPM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXPM_RW", 
+    dynlib: ImageLibName.}
+proc IMG_LoadXV_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXV_RW", 
+    dynlib: ImageLibName.}
+proc IMG_ReadXPMFromArray*(xpm: cstringArray): PSurface{.cdecl, 
+    importc: "IMG_ReadXPMFromArray", dynlib: ImageLibName.}
+
+proc IMAGE_VERSION(X: var TVersion) = 
+  X.major = IMAGE_MAJOR_VERSION
+  X.minor = IMAGE_MINOR_VERSION
+  X.patch = IMAGE_PATCHLEVEL
+
diff --git a/lib/wrappers/sdl/sdl_mixer.nim b/lib/wrappers/sdl/sdl_mixer.nim
new file mode 100755
index 000000000..09abe182f
--- /dev/null
+++ b/lib/wrappers/sdl/sdl_mixer.nim
@@ -0,0 +1,484 @@
+#******************************************************************************
+#
+#  $Id: sdl_mixer.pas,v 1.18 2007/05/29 21:31:44 savage Exp $
+#
+#
+#
+#       Borland Delphi SDL_Mixer - Simple DirectMedia Layer Mixer Library
+#       Conversion of the Simple DirectMedia Layer Headers
+#
+# Portions created by Sam Lantinga <slouken@devolution.com> are
+# Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
+# 5635-34 Springhouse Dr.
+# Pleasanton, CA 94588 (USA)
+#
+# All Rights Reserved.
+#
+# The original files are : SDL_mixer.h
+#                          music_cmd.h
+#                          wavestream.h
+#                          timidity.h
+#                          playmidi.h
+#                          music_ogg.h
+#                          mikmod.h
+#
+# The initial developer of this Pascal code was :
+# Dominqiue Louis <Dominique@SavageSoftware.com.au>
+#
+# Portions created by Dominqiue Louis are
+# Copyright (C) 2000 - 2001 Dominqiue Louis.
+#
+#
+# Contributor(s)
+# --------------
+# Matthias Thoma <ma.thoma@gmx.de>
+#
+# Obtained through:
+# Joint Endeavour of Delphi Innovators ( Project JEDI )
+#
+# You may retrieve the latest version of this file at the Project
+# JEDI home page, located at http://delphi-jedi.org
+#
+# The contents of this file are used with permission, subject to
+# the Mozilla Public License Version 1.1 (the "License"); you may
+# not use this file except in compliance with the License. You may
+# obtain a copy of the License at
+# http://www.mozilla.org/MPL/MPL-1.1.html
+#
+# Software distributed under the License is distributed on an
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# rights and limitations under the License.
+#
+# Description
+# -----------
+#
+#
+#
+#
+#
+#
+#
+# Requires
+# --------
+#   SDL.pas & SMPEG.pas somewhere within your search path.
+#
+# Programming Notes
+# -----------------
+#   See the Aliens Demo to see how this library is used
+#
+# Revision History
+# ----------------
+#   April    02 2001 - DL : Initial Translation
+#
+#  February  02 2002 - DL : Update to version 1.2.1
+#
+#   April   03 2003 - DL : Added jedi-sdl.inc include file to support more
+#                          Pascal compilers. Initial support is now included
+#                          for GnuPascal, VirtualPascal, TMT and obviously
+#                          continue support for Delphi Kylix and FreePascal.
+#
+#   April   24 2003 - DL : under instruction from Alexey Barkovoy, I have added
+#                          better TMT Pascal support and under instruction
+#                          from Prof. Abimbola Olowofoyeku (The African Chief),
+#                          I have added better Gnu Pascal support
+#
+#   April   30 2003 - DL : under instruction from David Mears AKA
+#                          Jason Siletto, I have added FPC Linux support.
+#                          This was compiled with fpc 1.1, so remember to set
+#                          include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
+#
+#
+#  $Log: sdl_mixer.pas,v $
+#  Revision 1.18  2007/05/29 21:31:44  savage
+#  Changes as suggested by Almindor for 64bit compatibility.
+#
+#  Revision 1.17  2007/05/20 20:31:17  savage
+#  Initial Changes to Handle 64 Bits
+#
+#  Revision 1.16  2006/12/02 00:16:17  savage
+#  Updated to latest version
+#
+#  Revision 1.15  2005/04/10 11:48:33  savage
+#  Changes as suggested by Michalis, thanks.
+#
+#  Revision 1.14  2005/02/24 20:20:07  savage
+#  Changed definition of MusicType and added GetMusicType function
+#
+#  Revision 1.13  2005/01/05 01:47:09  savage
+#  Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
+#
+#  Revision 1.12  2005/01/04 23:14:56  savage
+#  Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
+#
+#  Revision 1.11  2005/01/01 02:05:19  savage
+#  Updated to v1.2.6
+#
+#  Revision 1.10  2004/09/12 21:45:17  savage
+#  Robert Reed spotted that Mix_SetMusicPosition was missing from the conversion, so this has now been added.
+#
+#  Revision 1.9  2004/08/27 21:48:24  savage
+#  IFDEFed out Smpeg support on MacOS X
+#
+#  Revision 1.8  2004/08/14 22:54:30  savage
+#  Updated so that Library name defines are correctly defined for MacOS X.
+#
+#  Revision 1.7  2004/05/10 14:10:04  savage
+#  Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
+#
+#  Revision 1.6  2004/04/13 09:32:08  savage
+#  Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
+#
+#  Revision 1.5  2004/04/01 20:53:23  savage
+#  Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
+#
+#  Revision 1.4  2004/03/31 22:20:02  savage
+#  Windows unit not used in this file, so it was removed to keep the code tidy.
+#
+#  Revision 1.3  2004/03/31 10:05:08  savage
+#  Better defines for Endianess under FreePascal and Borland compilers.
+#
+#  Revision 1.2  2004/03/30 20:23:28  savage
+#  Tidied up use of UNIX compiler directive.
+#
+#  Revision 1.1  2004/02/14 23:35:42  savage
+#  version 1 of sdl_image, sdl_mixer and smpeg.
+#
+#
+#
+#******************************************************************************
+
+import 
+  sdl, smpeg
+
+when defined(windows): 
+  const 
+    MixerLibName = "SDL_mixer.dll"
+elif defined(macosx): 
+  const 
+    MixerLibName = "libSDL_mixer-1.2.0.dylib"
+else: 
+  const 
+    MixerLibName = "libSDL_mixer.so"
+const 
+  MAJOR_VERSION* = 1'i8
+  MINOR_VERSION* = 2'i8
+  PATCHLEVEL* = 7'i8    # Backwards compatibility
+  
+  CHANNELS* = 8           # Good default values for a PC soundcard
+  DEFAULT_FREQUENCY* = 22050
+
+when defined(IA32): 
+  const 
+    DEFAULT_FORMAT* = AUDIO_S16LSB
+else: 
+  const 
+    DEFAULT_FORMAT* = AUDIO_S16MSB
+const 
+  DEFAULT_CHANNELS* = 2
+  MAX_VOLUME* = 128       # Volume of a chunk
+  PATH_MAX* = 255             # mikmod.h constants
+                              #*
+                              #  * Library version
+                              #  *
+  LIBMIKMOD_VERSION_MAJOR* = 3
+  LIBMIKMOD_VERSION_MINOR* = 1
+  LIBMIKMOD_REVISION* = 8
+  LIBMIKMOD_VERSION* = ((LIBMIKMOD_VERSION_MAJOR shl 16) or
+      (LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
+
+type                          #music_cmd.h types
+  PMusicCMD* = ptr TMusicCMD
+  TMusicCMD*{.final.} = object  #wavestream.h types
+    filename*: array[0..PATH_MAX - 1, char]
+    cmd*: array[0..PATH_MAX - 1, char]
+    pid*: TSYS_ThreadHandle
+
+  PWAVStream* = ptr TWAVStream
+  TWAVStream*{.final.} = object  #playmidi.h types
+    wavefp*: Pointer
+    start*: int32
+    stop*: int32
+    cvt*: TAudioCVT
+
+  PMidiEvent* = ptr TMidiEvent
+  TMidiEvent*{.final.} = object 
+    time*: int32
+    channel*: byte
+    typ*: byte
+    a*: byte
+    b*: byte
+
+  PMidiSong* = ptr TMidiSong
+  TMidiSong*{.final.} = object  #music_ogg.h types
+    samples*: int32
+    events*: PMidiEvent
+
+  POGG_Music* = ptr TOGG_Music
+  TOGG_Music*{.final.} = object  # mikmod.h types
+                                 #*
+                                 #  * Error codes
+                                 #  *
+    playing*: int32
+    volume*: int32              #vf: OggVorbis_File;
+    section*: int32
+    cvt*: TAudioCVT
+    len_available*: int32
+    snd_available*: pointer
+
+  TErrorEnum* = enum 
+    MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING, 
+    MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE, 
+    MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER, 
+    MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM, 
+    MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE, 
+    MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO, 
+    MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW, 
+    MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT, 
+    MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS, 
+    MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED, 
+    MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC, 
+    MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE, 
+    MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT, 
+    MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT, 
+    MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD, 
+    MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY, 
+    MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE, 
+    MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT, 
+    MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
+  PMODULE* = ptr TMODULE
+  TMODULE*{.final.} = object 
+  PUNIMOD* = ptr TUNIMOD
+  TUNIMOD* = TMODULE          #SDL_mixer.h types
+                              # The internal format for an audio chunk
+  PChunk* = ptr TChunk
+  TChunk*{.final.} = object 
+    allocated*: cint
+    abuf*: pointer
+    alen*: Uint32
+    volume*: byte            # Per-sample volume, 0-128
+  
+  TFading* = enum 
+    MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
+  TMusicType* = enum 
+    MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3
+  PMusic* = ptr TMusic
+  TMusic*{.final.} = object  # The internal format for a music chunk interpreted via mikmod
+    mixtype*: TMusicType      # other fields are not aviable
+                              #    data : TMusicUnion;
+                              #    fading : TMix_Fading;
+                              #    fade_volume : integer;
+                              #    fade_step : integer;
+                              #    fade_steps : integer;
+                              #    error : integer;
+  
+  TMixFunction* = proc (udata, stream: pointer, length: cint): Pointer{.
+      cdecl.} # This macro can be used to fill a version structure with the compile-time
+              #  version of the SDL_mixer library.
+
+proc VERSION*(X: var sdl.TVersion)
+  # This function gets the version of the dynamically linked SDL_mixer library.
+  #     It should NOT be used to fill a version structure, instead you should use the
+  #     SDL_MIXER_VERSION() macro.
+proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version", 
+                                      dynlib: MixerLibName.}
+  # Open the mixer with a certain audio format
+proc OpenAudio*(frequency: cint, format: Uint16, channels: cint, 
+                    chunksize: cint): cint{.cdecl, importc: "Mix_OpenAudio", 
+    dynlib: MixerLibName.}
+  # Dynamically change the number of channels managed by the mixer.
+  #   If decreasing the number of channels, the upper channels are
+  #   stopped.
+  #   This function returns the new number of allocated channels.
+  #
+proc AllocateChannels*(numchannels: cint): cint{.cdecl, 
+    importc: "Mix_AllocateChannels", dynlib: MixerLibName.}
+  # Find out what the actual audio device parameters are.
+  #   This function returns 1 if the audio has been opened, 0 otherwise.
+  #
+proc QuerySpec*(frequency: var cint, format: var Uint16, channels: var cint): cint{.
+    cdecl, importc: "Mix_QuerySpec", dynlib: MixerLibName.}
+  # Load a wave file or a music (.mod .s3m .it .xm) file
+proc LoadWAV_RW*(src: PRWops, freesrc: cint): PChunk{.cdecl, 
+    importc: "Mix_LoadWAV_RW", dynlib: MixerLibName.}
+proc LoadWAV*(filename: cstring): PChunk
+proc LoadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS", 
+    dynlib: MixerLibName.}
+  # Load a wave file of the mixer format from a memory buffer
+proc QuickLoad_WAV*(mem: pointer): PChunk{.cdecl, 
+    importc: "Mix_QuickLoad_WAV", dynlib: MixerLibName.}
+  # Free an audio chunk previously loaded
+proc FreeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk", 
+                                        dynlib: MixerLibName.}
+proc FreeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic", 
+                                        dynlib: MixerLibName.}
+  # Find out the music format of a mixer music, or the currently playing
+  #   music, if 'music' is NULL.
+proc GetMusicType*(music: PMusic): TMusicType{.cdecl, 
+    importc: "Mix_GetMusicType", dynlib: MixerLibName.}
+  # Set a function that is called after all mixing is performed.
+  #   This can be used to provide real-time visual display of the audio stream
+  #   or add a custom mixer filter for the stream data.
+  #
+proc SetPostMix*(mix_func: TMixFunction, arg: Pointer){.cdecl, 
+    importc: "Mix_SetPostMix", dynlib: MixerLibName.}
+  # Add your own music player or additional mixer function.
+  #   If 'mix_func' is NULL, the default music player is re-enabled.
+  #
+proc HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl, 
+    importc: "Mix_HookMusic", dynlib: MixerLibName.}
+  # Add your own callback when the music has finished playing.
+  #
+proc HookMusicFinished*(music_finished: Pointer){.cdecl, 
+    importc: "Mix_HookMusicFinished", dynlib: MixerLibName.}
+  # Get a pointer to the user data for the current music hook
+proc GetMusicHookData*(): Pointer{.cdecl, importc: "Mix_GetMusicHookData", 
+                                       dynlib: MixerLibName.}
+  #* Add your own callback when a channel has finished playing. NULL
+  # * to disable callback.*
+type 
+  TChannel_finished* = proc (channel: cint){.cdecl.}
+
+proc ChannelFinished*(channel_finished: TChannel_finished){.cdecl, 
+    importc: "Mix_ChannelFinished", dynlib: MixerLibName.}
+const 
+  CHANNEL_POST* = - 2     
+
+type 
+  TEffectFunc* = proc (chan: cint, stream: Pointer, length: cint, 
+                       udata: Pointer): Pointer{.cdecl.}     
+  TEffectDone* = proc (chan: cint, udata: Pointer): Pointer{.cdecl.} 
+proc RegisterEffect*(chan: cint, f: TEffectFunc, d: TEffectDone, 
+                         arg: Pointer): cint{.cdecl, 
+    importc: "Mix_RegisterEffect", dynlib: MixerLibName.}
+
+proc UnregisterEffect*(channel: cint, f: TEffectFunc): cint{.cdecl, 
+    importc: "Mix_UnregisterEffect", dynlib: MixerLibName.}
+
+proc UnregisterAllEffects*(channel: cint): cint{.cdecl, 
+    importc: "Mix_UnregisterAllEffects", dynlib: MixerLibName.}
+const 
+  EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED"
+  
+proc SetPanning*(channel: cint, left: byte, right: byte): cint{.cdecl, 
+    importc: "Mix_SetPanning", dynlib: MixerLibName.}
+
+proc SetPosition*(channel: cint, angle: int16, distance: byte): cint{.cdecl, 
+    importc: "Mix_SetPosition", dynlib: MixerLibName.}
+
+proc SetDistance*(channel: cint, distance: byte): cint{.cdecl, 
+    importc: "Mix_SetDistance", dynlib: MixerLibName.}
+
+proc SetReverseStereo*(channel: cint, flip: cint): cint{.cdecl, 
+    importc: "Mix_SetReverseStereo", dynlib: MixerLibName.}
+
+proc ReserveChannels*(num: cint): cint{.cdecl, importc: "Mix_ReserveChannels", 
+    dynlib: MixerLibName.}
+
+proc GroupChannel*(which: cint, tag: cint): cint{.cdecl, 
+    importc: "Mix_GroupChannel", dynlib: MixerLibName.}
+proc GroupChannels*(`from`: cint, `to`: cint, tag: cint): cint{.cdecl, 
+    importc: "Mix_GroupChannels", dynlib: MixerLibName.}
+proc GroupAvailable*(tag: cint): cint{.cdecl, importc: "Mix_GroupAvailable", 
+    dynlib: MixerLibName.}
+proc GroupCount*(tag: cint): cint{.cdecl, importc: "Mix_GroupCount", 
+                                     dynlib: MixerLibName.}
+proc GroupOldest*(tag: cint): cint{.cdecl, importc: "Mix_GroupOldest", 
+                                      dynlib: MixerLibName.}
+proc GroupNewer*(tag: cint): cint{.cdecl, importc: "Mix_GroupNewer", 
+                                     dynlib: MixerLibName.}
+proc PlayChannelTimed*(channel: cint, chunk: PChunk, loops: cint, 
+                           ticks: cint): cint{.cdecl, 
+    importc: "Mix_PlayChannelTimed", dynlib: MixerLibName.}
+proc PlayChannel*(channel: cint, chunk: PChunk, loops: cint): cint
+proc PlayMusic*(music: PMusic, loops: cint): cint{.cdecl, 
+    importc: "Mix_PlayMusic", dynlib: MixerLibName.}
+proc FadeInMusic*(music: PMusic, loops: cint, ms: cint): cint{.cdecl, 
+    importc: "Mix_FadeInMusic", dynlib: MixerLibName.}
+proc FadeInChannelTimed*(channel: cint, chunk: PChunk, loops: cint, 
+                             ms: cint, ticks: cint): cint{.cdecl, 
+    importc: "Mix_FadeInChannelTimed", dynlib: MixerLibName.}
+proc FadeInChannel*(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint
+
+proc Volume*(channel: cint, volume: cint): cint{.cdecl, importc: "Mix_Volume", 
+    dynlib: MixerLibName.}
+proc VolumeChunk*(chunk: PChunk, volume: cint): cint{.cdecl, 
+    importc: "Mix_VolumeChunk", dynlib: MixerLibName.}
+proc VolumeMusic*(volume: cint): cint{.cdecl, importc: "Mix_VolumeMusic", 
+    dynlib: MixerLibName.}
+
+proc HaltChannel*(channel: cint): cint{.cdecl, importc: "Mix_HaltChannel", 
+    dynlib: MixerLibName.}
+proc HaltGroup*(tag: cint): cint{.cdecl, importc: "Mix_HaltGroup", 
+                                    dynlib: MixerLibName.}
+proc HaltMusic*(): cint{.cdecl, importc: "Mix_HaltMusic", 
+                            dynlib: MixerLibName.}
+  # Change the expiration delay for a particular channel.
+  #   The sample will stop playing after the 'ticks' milliseconds have elapsed,
+  #   or remove the expiration if 'ticks' is -1
+  #
+proc ExpireChannel*(channel: cint, ticks: cint): cint{.cdecl, 
+    importc: "Mix_ExpireChannel", dynlib: MixerLibName.}
+  # Halt a channel, fading it out progressively till it's silent
+  #   The ms parameter indicates the number of milliseconds the fading
+  #   will take.
+  #
+proc FadeOutChannel*(which: cint, ms: cint): cint{.cdecl, 
+    importc: "Mix_FadeOutChannel", dynlib: MixerLibName.}
+proc FadeOutGroup*(tag: cint, ms: cint): cint{.cdecl, 
+    importc: "Mix_FadeOutGroup", dynlib: MixerLibName.}
+proc FadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic", 
+                                      dynlib: MixerLibName.}
+  # Query the fading status of a channel
+proc FadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic", 
+                                      dynlib: MixerLibName.}
+proc FadingChannel*(which: cint): TFading{.cdecl, 
+    importc: "Mix_FadingChannel", dynlib: MixerLibName.}
+
+proc Pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.}
+proc Resume*(channel: cint){.cdecl, importc: "Mix_Resume", 
+                                dynlib: MixerLibName.}
+proc Paused*(channel: cint): cint{.cdecl, importc: "Mix_Paused", 
+                                     dynlib: MixerLibName.}
+
+proc PauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.}
+proc ResumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.}
+proc RewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.}
+proc PausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", 
+                              dynlib: MixerLibName.}
+
+proc SetMusicPosition*(position: float64): cint{.cdecl, 
+    importc: "Mix_SetMusicPosition", dynlib: MixerLibName.}
+
+proc Playing*(channel: cint): cint{.cdecl, importc: "Mix_Playing", 
+                                      dynlib: MixerLibName.}
+proc PlayingMusic*(): cint{.cdecl, importc: "Mix_PlayingMusic", 
+                               dynlib: MixerLibName.}
+
+proc SetMusicCMD*(command: cstring): cint{.cdecl, importc: "Mix_SetMusicCMD", 
+    dynlib: MixerLibName.}
+
+proc SetSynchroValue*(value: cint): cint{.cdecl, 
+    importc: "Mix_SetSynchroValue", dynlib: MixerLibName.}
+proc GetSynchroValue*(): cint{.cdecl, importc: "Mix_GetSynchroValue", 
+                                  dynlib: MixerLibName.}
+
+proc GetChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk", 
+    dynlib: MixerLibName.}
+
+proc CloseAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.}
+
+proc VERSION(X: var sdl.Tversion) = 
+  X.major = MAJOR_VERSION
+  X.minor = MINOR_VERSION
+  X.patch = PATCHLEVEL
+
+proc LoadWAV(filename: cstring): PChunk = 
+  result = LoadWAV_RW(RWFromFile(filename, "rb"), 1)
+
+proc PlayChannel(channel: cint, chunk: PChunk, loops: cint): cint = 
+  result = PlayChannelTimed(channel, chunk, loops, - 1)
+
+proc FadeInChannel(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint = 
+  result = FadeInChannelTimed(channel, chunk, loops, ms, - 1)
+
diff --git a/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim
new file mode 100755
index 000000000..885e9845b
--- /dev/null
+++ b/lib/wrappers/sdl/sdl_mixer_nosmpeg.nim
@@ -0,0 +1,351 @@
+#******************************************************************************
+# Copy of SDL_Mixer without smpeg dependency and mp3 support                    
+#******************************************************************************
+
+import 
+  sdl
+
+when defined(windows): 
+  const 
+    MixerLibName = "SDL_mixer.dll"
+elif defined(macosx): 
+  const 
+    MixerLibName = "libSDL_mixer-1.2.0.dylib"
+else: 
+  const 
+    MixerLibName = "libSDL_mixer.so"
+const 
+  MAJOR_VERSION* = 1'i8
+  MINOR_VERSION* = 2'i8
+  PATCHLEVEL* = 7'i8    # Backwards compatibility
+   
+  CHANNELS* = 8           # Good default values for a PC soundcard 
+  DEFAULT_FREQUENCY* = 22050
+
+when defined(IA32): 
+  const 
+    DEFAULT_FORMAT* = AUDIO_S16LSB
+else: 
+  const 
+    DEFAULT_FORMAT* = AUDIO_S16MSB
+const 
+  DEFAULT_CHANNELS* = 2
+  MAX_VOLUME* = 128       # Volume of a chunk 
+  PATH_MAX* = 255
+  
+  LIBMIKMOD_VERSION_MAJOR* = 3
+  LIBMIKMOD_VERSION_MINOR* = 1
+  LIBMIKMOD_REVISION* = 8
+  LIBMIKMOD_VERSION* = ((LIBMIKMOD_VERSION_MAJOR shl 16) or
+      (LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
+
+type                          #music_cmd.h types
+  PMusicCMD* = ptr TMusicCMD
+  TMusicCMD*{.final.} = object  #wavestream.h types
+    filename*: array[0..PATH_MAX - 1, char]
+    cmd*: array[0..PATH_MAX - 1, char]
+    pid*: TSYS_ThreadHandle
+
+  PWAVStream* = ptr TWAVStream
+  TWAVStream*{.final.} = object  #playmidi.h types
+    wavefp*: Pointer
+    start*: int32
+    stop*: int32
+    cvt*: TAudioCVT
+
+  PMidiEvent* = ptr TMidiEvent
+  TMidiEvent*{.final.} = object 
+    time*: int32
+    channel*: byte
+    typ*: byte
+    a*: byte
+    b*: byte
+
+  PMidiSong* = ptr TMidiSong
+  TMidiSong*{.final.} = object  #music_ogg.h types
+    samples*: int32
+    events*: PMidiEvent
+
+  POGG_Music* = ptr TOGG_Music
+  TOGG_Music*{.final.} = object  # mikmod.h types
+                                 #*
+                                 #  * Error codes
+                                 #  *
+    playing*: cint
+    volume*: cint              #vf: OggVorbis_File;
+    section*: cint
+    cvt*: TAudioCVT
+    len_available*: cint
+    snd_available*: pointer
+
+  TErrorEnum* = enum 
+    MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING, 
+    MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE, 
+    MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER, 
+    MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM, 
+    MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE, 
+    MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO, 
+    MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW, 
+    MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT, 
+    MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS, 
+    MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED, 
+    MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC, 
+    MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE, 
+    MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT, 
+    MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT, 
+    MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD, 
+    MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY, 
+    MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE, 
+    MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT, 
+    MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
+  PMODULE* = ptr TMODULE
+  TMODULE*{.final.} = object 
+  PUNIMOD* = ptr TUNIMOD
+  TUNIMOD* = TMODULE          #SDL_mixer.h types
+                              # The internal format for an audio chunk 
+  PChunk* = ptr TChunk
+  TChunk*{.final.} = object 
+    allocated*: cint
+    abuf*: pointer
+    alen*: Uint32
+    volume*: byte            # Per-sample volume, 0-128 
+  
+  TFading* = enum 
+    MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
+  TMusicType* = enum 
+    MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG
+  PMusic* = ptr TMusic
+  TMusic*{.final.} = object 
+    typ*: TMusicType
+
+  TMixFunction* = proc (udata, stream: pointer, length: cint): Pointer{.
+      cdecl.} # This macro can be used to fill a version structure with the compile-time
+              #  version of the SDL_mixer library. 
+
+proc VERSION*(X: var sdl.TVersion)
+  # This function gets the version of the dynamically linked SDL_mixer library.
+  #     It should NOT be used to fill a version structure, instead you should use the
+  #     SDL_MIXER_VERSION() macro. 
+proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version", 
+                                      dynlib: MixerLibName.}
+  # Open the mixer with a certain audio format 
+proc OpenAudio*(frequency: cint, format: Uint16, channels: cint, 
+                    chunksize: cint): cint{.cdecl, importc: "Mix_OpenAudio", 
+    dynlib: MixerLibName.}
+  # Dynamically change the number of channels managed by the mixer.
+  #   If decreasing the number of channels, the upper channels are
+  #   stopped.
+  #   This function returns the new number of allocated channels.
+  # 
+proc AllocateChannels*(numchannels: cint): cint{.cdecl, 
+    importc: "Mix_AllocateChannels", dynlib: MixerLibName.}
+  # Find out what the actual audio device parameters are.
+  #   This function returns 1 if the audio has been opened, 0 otherwise.
+  # 
+proc QuerySpec*(frequency: var cint, format: var Uint16, channels: var cint): cint{.
+    cdecl, importc: "Mix_QuerySpec", dynlib: MixerLibName.}
+  # Load a wave file or a music (.mod .s3m .it .xm) file 
+proc LoadWAV_RW*(src: PRWops, freesrc: cint): PChunk{.cdecl, 
+    importc: "Mix_LoadWAV_RW", dynlib: MixerLibName.}
+proc LoadWAV*(filename: cstring): PChunk
+proc LoadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS", 
+    dynlib: MixerLibName.}
+  # Load a wave file of the mixer format from a memory buffer 
+proc QuickLoad_WAV*(mem: pointer): PChunk{.cdecl, 
+    importc: "Mix_QuickLoad_WAV", dynlib: MixerLibName.}
+  # Free an audio chunk previously loaded 
+proc FreeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk", 
+                                        dynlib: MixerLibName.}
+proc FreeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic", 
+                                        dynlib: MixerLibName.}
+  # Find out the music format of a mixer music, or the currently playing
+  #   music, if 'music' is NULL.
+proc GetMusicType*(music: PMusic): TMusicType{.cdecl, 
+    importc: "Mix_GetMusicType", dynlib: MixerLibName.}
+  # Set a function that is called after all mixing is performed.
+  #   This can be used to provide real-time visual display of the audio stream
+  #   or add a custom mixer filter for the stream data.
+  #
+proc SetPostMix*(mixfunc: TMixFunction, arg: Pointer){.cdecl, 
+    importc: "Mix_SetPostMix", dynlib: MixerLibName.}
+  # Add your own music player or additional mixer function.
+  #   If 'mix_func' is NULL, the default music player is re-enabled.
+  # 
+proc HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl, 
+    importc: "Mix_HookMusic", dynlib: MixerLibName.}
+  # Add your own callback when the music has finished playing.
+  # 
+proc HookMusicFinished*(music_finished: Pointer){.cdecl, 
+    importc: "Mix_HookMusicFinished", dynlib: MixerLibName.}
+  # Get a pointer to the user data for the current music hook 
+proc GetMusicHookData*(): Pointer{.cdecl, importc: "Mix_GetMusicHookData", 
+                                       dynlib: MixerLibName.}
+  #* Add your own callback when a channel has finished playing. NULL
+  # * to disable callback.*
+type 
+  TChannel_finished* = proc (channel: cint){.cdecl.}
+
+proc ChannelFinished*(channel_finished: TChannel_finished){.cdecl, 
+    importc: "Mix_ChannelFinished", dynlib: MixerLibName.}
+const 
+  CHANNEL_POST* = - 2 
+  
+type 
+  TEffectFunc* = proc (chan: cint, stream: Pointer, length: cint, 
+                           udata: Pointer): Pointer{.cdecl.} 
+  TEffectDone* = proc (chan: cint, udata: Pointer): Pointer{.cdecl.} 
+
+proc RegisterEffect*(chan: cint, f: TEffectFunc, d: TEffectDone, 
+                         arg: Pointer): cint{.cdecl, 
+    importc: "Mix_RegisterEffect", dynlib: MixerLibName.}
+
+proc UnregisterEffect*(channel: cint, f: TEffectFunc): cint{.cdecl, 
+    importc: "Mix_UnregisterEffect", dynlib: MixerLibName.}
+
+proc UnregisterAllEffects*(channel: cint): cint{.cdecl, 
+    importc: "Mix_UnregisterAllEffects", dynlib: MixerLibName.}
+
+const 
+  EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED"  
+  
+proc SetPanning*(channel: cint, left: byte, right: byte): cint{.cdecl, 
+    importc: "Mix_SetPanning", dynlib: MixerLibName.}
+   
+proc SetPosition*(channel: cint, angle: int16, distance: byte): cint{.cdecl, 
+    importc: "Mix_SetPosition", dynlib: MixerLibName.}
+   
+proc SetDistance*(channel: cint, distance: byte): cint{.cdecl, 
+    importc: "Mix_SetDistance", dynlib: MixerLibName.}
+
+proc SetReverseStereo*(channel: cint, flip: cint): cint{.cdecl, 
+    importc: "Mix_SetReverseStereo", dynlib: MixerLibName.}
+
+proc ReserveChannels*(num: cint): cint{.cdecl, importc: "Mix_ReserveChannels", 
+    dynlib: MixerLibName.}
+
+proc GroupChannel*(which: cint, tag: cint): cint{.cdecl, 
+    importc: "Mix_GroupChannel", dynlib: MixerLibName.}
+  # Assign several consecutive channels to a group 
+proc GroupChannels*(`from`: cint, `to`: cint, tag: cint): cint{.cdecl, 
+    importc: "Mix_GroupChannels", dynlib: MixerLibName.}
+  # Finds the first available channel in a group of channels 
+proc GroupAvailable*(tag: cint): cint{.cdecl, importc: "Mix_GroupAvailable", 
+    dynlib: MixerLibName.}
+  # Returns the number of channels in a group. This is also a subtle
+  #   way to get the total number of channels when 'tag' is -1
+  # 
+proc GroupCount*(tag: cint): cint{.cdecl, importc: "Mix_GroupCount", 
+                                     dynlib: MixerLibName.}
+  # Finds the "oldest" sample playing in a group of channels 
+proc GroupOldest*(tag: cint): cint{.cdecl, importc: "Mix_GroupOldest", 
+                                      dynlib: MixerLibName.}
+  # Finds the "most recent" (i.e. last) sample playing in a group of channels 
+proc GroupNewer*(tag: cint): cint{.cdecl, importc: "Mix_GroupNewer", 
+                                     dynlib: MixerLibName.}
+  # The same as above, but the sound is played at most 'ticks' milliseconds 
+proc PlayChannelTimed*(channel: cint, chunk: PChunk, loops: cint, 
+                           ticks: cint): cint{.cdecl, 
+    importc: "Mix_PlayChannelTimed", dynlib: MixerLibName.}
+
+proc PlayChannel*(channel: cint, chunk: PChunk, loops: cint): cint
+proc PlayMusic*(music: PMusic, loops: cint): cint{.cdecl, 
+    importc: "Mix_PlayMusic", dynlib: MixerLibName.}
+  # Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions 
+proc FadeInMusic*(music: PMusic, loops: cint, ms: cint): cint{.cdecl, 
+    importc: "Mix_FadeInMusic", dynlib: MixerLibName.}
+proc FadeInChannelTimed*(channel: cint, chunk: PChunk, loops: cint, 
+                             ms: cint, ticks: cint): cint{.cdecl, 
+    importc: "Mix_FadeInChannelTimed", dynlib: MixerLibName.}
+proc FadeInChannel*(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint
+  # Set the volume in the range of 0-128 of a specific channel or chunk.
+  #   If the specified channel is -1, set volume for all channels.
+  #   Returns the original volume.
+  #   If the specified volume is -1, just return the current volume.
+  #
+proc Volume*(channel: cint, volume: cint): cint{.cdecl, importc: "Mix_Volume", 
+    dynlib: MixerLibName.}
+proc VolumeChunk*(chunk: PChunk, volume: cint): cint{.cdecl, 
+    importc: "Mix_VolumeChunk", dynlib: MixerLibName.}
+proc VolumeMusic*(volume: cint): cint{.cdecl, importc: "Mix_VolumeMusic", 
+    dynlib: MixerLibName.}
+  # Halt playing of a particular channel 
+proc HaltChannel*(channel: cint): cint{.cdecl, importc: "Mix_HaltChannel", 
+    dynlib: MixerLibName.}
+proc HaltGroup*(tag: cint): cint{.cdecl, importc: "Mix_HaltGroup", 
+                                    dynlib: MixerLibName.}
+proc HaltMusic*(): cint{.cdecl, importc: "Mix_HaltMusic", 
+                            dynlib: MixerLibName.}
+
+proc ExpireChannel*(channel: cint, ticks: cint): cint{.cdecl, 
+    importc: "Mix_ExpireChannel", dynlib: MixerLibName.}
+
+proc FadeOutChannel*(which: cint, ms: cint): cint{.cdecl, 
+    importc: "Mix_FadeOutChannel", dynlib: MixerLibName.}
+proc FadeOutGroup*(tag: cint, ms: cint): cint{.cdecl, 
+    importc: "Mix_FadeOutGroup", dynlib: MixerLibName.}
+proc FadeOutMusic*(ms: cint): cint{.cdecl, importc: "Mix_FadeOutMusic", 
+                                      dynlib: MixerLibName.}
+  # Query the fading status of a channel 
+proc FadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic", 
+                                      dynlib: MixerLibName.}
+proc FadingChannel*(which: cint): TFading{.cdecl, 
+    importc: "Mix_FadingChannel", dynlib: MixerLibName.}
+  # Pause/Resume a particular channel 
+proc Pause*(channel: cint){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.}
+proc Resume*(channel: cint){.cdecl, importc: "Mix_Resume", 
+                                dynlib: MixerLibName.}
+proc Paused*(channel: cint): cint{.cdecl, importc: "Mix_Paused", 
+                                     dynlib: MixerLibName.}
+  # Pause/Resume the music stream 
+proc PauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.}
+proc ResumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.}
+proc RewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.}
+proc PausedMusic*(): cint{.cdecl, importc: "Mix_PausedMusic", 
+                              dynlib: MixerLibName.}
+  # Set the current position in the music stream.
+  #  This returns 0 if successful, or -1 if it failed or isn't implemented.
+  #  This function is only implemented for MOD music formats (set pattern
+  #  order number) and for OGG music (set position in seconds), at the
+  #  moment.
+  #
+proc SetMusicPosition*(position: float64): cint{.cdecl, 
+    importc: "Mix_SetMusicPosition", dynlib: MixerLibName.}
+  # Check the status of a specific channel.
+  #   If the specified channel is -1, check all channels.
+  #
+proc Playing*(channel: cint): cint{.cdecl, importc: "Mix_Playing", 
+                                      dynlib: MixerLibName.}
+proc PlayingMusic*(): cint{.cdecl, importc: "Mix_PlayingMusic", 
+                               dynlib: MixerLibName.}
+  # Stop music and set external music playback command 
+proc SetMusicCMD*(command: cstring): cint{.cdecl, importc: "Mix_SetMusicCMD", 
+    dynlib: MixerLibName.}
+  # Synchro value is set by MikMod from modules while playing 
+proc SetSynchroValue*(value: cint): cint{.cdecl, 
+    importc: "Mix_SetSynchroValue", dynlib: MixerLibName.}
+proc GetSynchroValue*(): cint{.cdecl, importc: "Mix_GetSynchroValue", 
+                                  dynlib: MixerLibName.}
+  #
+  #  Get the Mix_Chunk currently associated with a mixer channel
+  #    Returns nil if it's an invalid channel, or there's no chunk associated.
+  #
+proc GetChunk*(channel: cint): PChunk{.cdecl, importc: "Mix_GetChunk", 
+    dynlib: MixerLibName.}
+  # Close the mixer, halting all playing audio 
+proc CloseAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.}
+  # We'll use SDL for reporting errors 
+
+proc VERSION(X: var Tversion) = 
+  X.major = MAJOR_VERSION
+  X.minor = MINOR_VERSION
+  X.patch = PATCHLEVEL
+
+proc LoadWAV(filename: cstring): PChunk = 
+  result = LoadWAV_RW(RWFromFile(filename, "rb"), 1)
+
+proc PlayChannel(channel: cint, chunk: PChunk, loops: cint): cint = 
+  result = PlayChannelTimed(channel, chunk, loops, - 1)
+
+proc FadeInChannel(channel: cint, chunk: PChunk, loops: cint, ms: cint): cint = 
+  result = FadeInChannelTimed(channel, chunk, loops, ms, - 1)
+
diff --git a/lib/wrappers/sdl/sdl_net.nim b/lib/wrappers/sdl/sdl_net.nim
new file mode 100755
index 000000000..bfd4f0a28
--- /dev/null
+++ b/lib/wrappers/sdl/sdl_net.nim
@@ -0,0 +1,427 @@
+#******************************************************************************
+#
+#  $Id: sdl_net.pas,v 1.7 2005/01/01 02:14:21 savage Exp $
+#
+#
+#                                                                              
+#       Borland Delphi SDL_Net - A x-platform network library for use with SDL.
+#       Conversion of the Simple DirectMedia Layer Network Headers             
+#                                                                              
+# Portions created by Sam Lantinga <slouken@devolution.com> are                
+# Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga                     
+# 5635-34 Springhouse Dr.                                                      
+# Pleasanton, CA 94588 (USA)                                                   
+#                                                                              
+# All Rights Reserved.                                                         
+#                                                                              
+# The original files are : SDL_net.h                                           
+#                                                                              
+# The initial developer of this Pascal code was :                              
+# Dominqiue Louis <Dominique@SavageSoftware.com.au>                            
+#                                                                              
+# Portions created by Dominqiue Louis are                                      
+# Copyright (C) 2000 - 2001 Dominqiue Louis.                                   
+#                                                                              
+#                                                                              
+# Contributor(s)                                                               
+# --------------                                                               
+# Matthias Thoma <ma.thoma@gmx.de>                                             
+#                                                                              
+# Obtained through:                                                            
+# Joint Endeavour of Delphi Innovators ( Project JEDI )                        
+#                                                                              
+# You may retrieve the latest version of this file at the Project              
+# JEDI home page, located at http://delphi-jedi.org                            
+#                                                                              
+# The contents of this file are used with permission, subject to               
+# the Mozilla Public License Version 1.1 (the "License"); you may              
+# not use this file except in compliance with the License. You may             
+# obtain a copy of the License at                                              
+# http://www.mozilla.org/MPL/MPL-1.1.html                                      
+#                                                                              
+# Software distributed under the License is distributed on an                  
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or               
+# implied. See the License for the specific language governing                 
+# rights and limitations under the License.                                    
+#                                                                              
+# Description                                                                  
+# -----------                                                                  
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+# Requires                                                                     
+# --------                                                                     
+#   SDL.pas somehere in your search path                                       
+#                                                                              
+# Programming Notes                                                            
+# -----------------                                                            
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+# Revision History                                                             
+# ----------------                                                             
+#   April   09 2001 - DL : Initial Translation                                 
+#                                                                              
+#   April   03 2003 - DL : Added jedi-sdl.inc include file to support more     
+#                          Pascal compilers. Initial support is now included   
+#                          for GnuPascal, VirtualPascal, TMT and obviously     
+#                          continue support for Delphi Kylix and FreePascal.   
+#                                                                              
+#   April   24 2003 - DL : under instruction from Alexey Barkovoy, I have added
+#                          better TMT Pascal support and under instruction     
+#                          from Prof. Abimbola Olowofoyeku (The African Chief),
+#                          I have added better Gnu Pascal support              
+#                                                                              
+#   April   30 2003 - DL : under instruction from David Mears AKA              
+#                          Jason Siletto, I have added FPC Linux support.      
+#                          This was compiled with fpc 1.1, so remember to set  
+#                          include file path. ie. -Fi/usr/share/fpcsrc/rtl/*   
+#                                                                              
+#
+#  $Log: sdl_net.pas,v $
+#  Revision 1.7  2005/01/01 02:14:21  savage
+#  Updated to v1.2.5
+#
+#  Revision 1.6  2004/08/14 22:54:30  savage
+#  Updated so that Library name defines are correctly defined for MacOS X.
+#
+#  Revision 1.5  2004/05/10 14:10:04  savage
+#  Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
+#
+#  Revision 1.4  2004/04/13 09:32:08  savage
+#  Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
+#
+#  Revision 1.3  2004/04/01 20:53:23  savage
+#  Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
+#
+#  Revision 1.2  2004/03/30 20:23:28  savage
+#  Tidied up use of UNIX compiler directive.
+#
+#  Revision 1.1  2004/02/16 22:16:40  savage
+#  v1.0 changes
+#
+#
+#
+#******************************************************************************
+
+import 
+  sdl
+
+when defined(windows): 
+  const 
+    NetLibName = "SDL_net.dll"
+elif defined(macosx): 
+  const 
+    NetLibName = "libSDL_net.dylib"
+else: 
+  const 
+    NetLibName = "libSDL_net.so"
+const                         #* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *
+  MAJOR_VERSION* = 1'i8
+  MINOR_VERSION* = 2'i8
+  PATCHLEVEL* = 5'i8     # SDL_Net.h constants
+                         #* Resolve a host name and port to an IP address in network form.
+                         #   If the function succeeds, it will return 0.
+                         #   If the host couldn't be resolved, the host portion of the returned
+                         #   address will be INADDR_NONE, and the function will return -1.
+                         #   If 'host' is NULL, the resolved host will be set to INADDR_ANY.
+                         # *
+  INADDR_ANY* = 0x00000000
+  INADDR_NONE* = 0xFFFFFFFF #***********************************************************************
+                            #* UDP network API                                                     *
+                            #***********************************************************************
+                            #* The maximum channels on a a UDP socket *
+  MAX_UDPCHANNELS* = 32   #* The maximum addresses bound to a single UDP socket channel *
+  MAX_UDPADDRESSES* = 4
+
+type  # SDL_net.h types
+      #***********************************************************************
+      #* IPv4 hostname resolution API                                        *
+      #***********************************************************************
+  PIPAddress* = ptr TIPAddress
+  TIPAddress*{.final.} = object  #* TCP network API                                                     
+    host*: Uint32             # 32-bit IPv4 host address */
+    port*: Uint16             # 16-bit protocol port */
+  
+  PTCPSocket* = ptr TTCPSocket
+  TTCPSocket*{.final.} = object  # UDP network API
+    ready*: int
+    channel*: int
+    remoteAddress*: TIPaddress
+    localAddress*: TIPaddress
+    sflag*: int
+
+  PUDP_Channel* = ptr TUDP_Channel
+  TUDP_Channel*{.final.} = object 
+    numbound*: int
+    address*: array[0..MAX_UDPADDRESSES - 1, TIPAddress]
+
+  PUDPSocket* = ptr TUDPSocket
+  TUDPSocket*{.final.} = object 
+    ready*: int
+    channel*: int
+    address*: TIPAddress
+    binding*: array[0..MAX_UDPCHANNELS - 1, TUDP_Channel]
+
+  PUDPpacket* = ptr TUDPpacket
+  PPUDPpacket* = ptr PUDPpacket
+  TUDPpacket*{.final.} = object  #***********************************************************************
+                                 #* Hooks for checking sockets for available data                       *
+                                 #***********************************************************************
+    channel*: int             #* The src/dst channel of the packet *
+    data*: pointer            #* The packet data *
+    length*: int              #* The length of the packet data *
+    maxlen*: int              #* The size of the data buffer *
+    status*: int              #* packet status after sending *
+    address*: TIPAddress      #* The source/dest address of an incoming/outgoing packet *
+  
+  PSocket* = ptr TSocket
+  TSocket*{.final.} = object 
+    ready*: int
+    channel*: int
+
+  PSocketSet* = ptr TSocketSet
+  TSocketSet*{.final.} = object  # Any network socket can be safely cast to this socket type *
+    numsockets*: int
+    maxsockets*: int
+    sockets*: PSocket
+
+  PGenericSocket* = ptr TGenericSocket
+  TGenericSocket*{.final.} = object 
+    ready*: int
+
+
+proc VERSION*(X: var Tversion)
+  #* Initialize/Cleanup the network API
+  #   SDL must be initialized before calls to functions in this library,
+  #   because this library uses utility functions from the SDL library.
+  #*
+proc Init*(): int{.cdecl, importc: "SDLNet_Init", dynlib: NetLibName.}
+proc Quit*(){.cdecl, importc: "SDLNet_Quit", dynlib: NetLibName.}
+  #* Resolve a host name and port to an IP address in network form.
+  #   If the function succeeds, it will return 0.
+  #   If the host couldn't be resolved, the host portion of the returned
+  #   address will be INADDR_NONE, and the function will return -1.
+  #   If 'host' is NULL, the resolved host will be set to INADDR_ANY.
+  # *
+proc ResolveHost*(address: var TIPaddress, host: cstring, port: Uint16): int{.
+    cdecl, importc: "SDLNet_ResolveHost", dynlib: NetLibName.}
+  #* Resolve an ip address to a host name in canonical form.
+  #   If the ip couldn't be resolved, this function returns NULL,
+  #   otherwise a pointer to a static buffer containing the hostname
+  #   is returned.  Note that this function is not thread-safe.
+  #*
+proc ResolveIP*(ip: var TIPaddress): cstring{.cdecl, 
+    importc: "SDLNet_ResolveIP", dynlib: NetLibName.}
+  #***********************************************************************
+  #* TCP network API                                                     *
+  #***********************************************************************
+  #* Open a TCP network socket
+  #   If ip.host is INADDR_NONE, this creates a local server socket on the
+  #   given port, otherwise a TCP connection to the remote host and port is
+  #   attempted.  The address passed in should already be swapped to network
+  #   byte order (addresses returned from SDLNet_ResolveHost() are already
+  #   in the correct form).
+  #   The newly created socket is returned, or NULL if there was an error.
+  #*
+proc TCP_Open*(ip: var TIPaddress): PTCPSocket{.cdecl, 
+    importc: "SDLNet_TCP_Open", dynlib: NetLibName.}
+  #* Accept an incoming connection on the given server socket.
+  #   The newly created socket is returned, or NULL if there was an error.
+  #*
+proc TCP_Accept*(server: PTCPsocket): PTCPSocket{.cdecl, 
+    importc: "SDLNet_TCP_Accept", dynlib: NetLibName.}
+  #* Get the IP address of the remote system associated with the socket.
+  #   If the socket is a server socket, this function returns NULL.
+  #*
+proc TCP_GetPeerAddress*(sock: PTCPsocket): PIPAddress{.cdecl, 
+    importc: "SDLNet_TCP_GetPeerAddress", dynlib: NetLibName.}
+  #* Send 'len' bytes of 'data' over the non-server socket 'sock'
+  #   This function returns the actual amount of data sent.  If the return value
+  #   is less than the amount of data sent, then either the remote connection was
+  #   closed, or an unknown socket error occurred.
+  #*
+proc TCP_Send*(sock: PTCPsocket, data: Pointer, length: int): int{.cdecl, 
+    importc: "SDLNet_TCP_Send", dynlib: NetLibName.}
+  #* Receive up to 'maxlen' bytes of data over the non-server socket 'sock',
+  #   and store them in the buffer pointed to by 'data'.
+  #   This function returns the actual amount of data received.  If the return
+  #   value is less than or equal to zero, then either the remote connection was
+  #   closed, or an unknown socket error occurred.
+  #*
+proc TCP_Recv*(sock: PTCPsocket, data: Pointer, maxlen: int): int{.cdecl, 
+    importc: "SDLNet_TCP_Recv", dynlib: NetLibName.}
+  #* Close a TCP network socket *
+proc TCP_Close*(sock: PTCPsocket){.cdecl, importc: "SDLNet_TCP_Close", 
+                                       dynlib: NetLibName.}
+  #***********************************************************************
+  #* UDP network API                                                     *
+  #***********************************************************************
+  #* Allocate/resize/free a single UDP packet 'size' bytes long.
+  #   The new packet is returned, or NULL if the function ran out of memory.
+  # *
+proc AllocPacket*(size: int): PUDPpacket{.cdecl, 
+    importc: "SDLNet_AllocPacket", dynlib: NetLibName.}
+proc ResizePacket*(packet: PUDPpacket, newsize: int): int{.cdecl, 
+    importc: "SDLNet_ResizePacket", dynlib: NetLibName.}
+proc FreePacket*(packet: PUDPpacket){.cdecl, importc: "SDLNet_FreePacket", 
+    dynlib: NetLibName.}
+  #* Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets,
+  #   each 'size' bytes long.
+  #   A pointer to the first packet in the array is returned, or NULL if the
+  #   function ran out of memory.
+  # *
+proc AllocPacketV*(howmany: int, size: int): PUDPpacket{.cdecl, 
+    importc: "SDLNet_AllocPacketV", dynlib: NetLibName.}
+proc FreePacketV*(packetV: PUDPpacket){.cdecl, 
+    importc: "SDLNet_FreePacketV", dynlib: NetLibName.}
+  #* Open a UDP network socket
+  #   If 'port' is non-zero, the UDP socket is bound to a local port.
+  #   This allows other systems to send to this socket via a known port.
+  #*
+proc UDP_Open*(port: Uint16): PUDPsocket{.cdecl, importc: "SDLNet_UDP_Open", 
+    dynlib: NetLibName.}
+  #* Bind the address 'address' to the requested channel on the UDP socket.
+  #   If the channel is -1, then the first unbound channel will be bound with
+  #   the given address as it's primary address.
+  #   If the channel is already bound, this new address will be added to the
+  #   list of valid source addresses for packets arriving on the channel.
+  #   If the channel is not already bound, then the address becomes the primary
+  #   address, to which all outbound packets on the channel are sent.
+  #   This function returns the channel which was bound, or -1 on error.
+  #*
+proc UDP_Bind*(sock: PUDPsocket, channel: int, address: var TIPaddress): int{.
+    cdecl, importc: "SDLNet_UDP_Bind", dynlib: NetLibName.}
+  #* Unbind all addresses from the given channel *
+proc UDP_Unbind*(sock: PUDPsocket, channel: int){.cdecl, 
+    importc: "SDLNet_UDP_Unbind", dynlib: NetLibName.}
+  #* Get the primary IP address of the remote system associated with the
+  #   socket and channel.  If the channel is -1, then the primary IP port
+  #   of the UDP socket is returned -- this is only meaningful for sockets
+  #   opened with a specific port.
+  #   If the channel is not bound and not -1, this function returns NULL.
+  # *
+proc UDP_GetPeerAddress*(sock: PUDPsocket, channel: int): PIPAddress{.cdecl, 
+    importc: "SDLNet_UDP_GetPeerAddress", dynlib: NetLibName.}
+  #* Send a vector of packets to the the channels specified within the packet.
+  #   If the channel specified in the packet is -1, the packet will be sent to
+  #   the address in the 'src' member of the packet.
+  #   Each packet will be updated with the status of the packet after it has
+  #   been sent, -1 if the packet send failed.
+  #   This function returns the number of packets sent.
+  #*
+proc UDP_SendV*(sock: PUDPsocket, packets: PPUDPpacket, npackets: int): int{.
+    cdecl, importc: "SDLNet_UDP_SendV", dynlib: NetLibName.}
+  #* Send a single packet to the specified channel.
+  #   If the channel specified in the packet is -1, the packet will be sent to
+  #   the address in the 'src' member of the packet.
+  #   The packet will be updated with the status of the packet after it has
+  #   been sent.
+  #   This function returns 1 if the packet was sent, or 0 on error.
+  #*
+proc UDP_Send*(sock: PUDPsocket, channel: int, packet: PUDPpacket): int{.
+    cdecl, importc: "SDLNet_UDP_Send", dynlib: NetLibName.}
+  #* Receive a vector of pending packets from the UDP socket.
+  #   The returned packets contain the source address and the channel they arrived
+  #   on.  If they did not arrive on a bound channel, the the channel will be set
+  #   to -1.
+  #   The channels are checked in highest to lowest order, so if an address is
+  #   bound to multiple channels, the highest channel with the source address
+  #   bound will be returned.
+  #   This function returns the number of packets read from the network, or -1
+  #   on error.  This function does not block, so can return 0 packets pending.
+  #*
+proc UDP_RecvV*(sock: PUDPsocket, packets: PPUDPpacket): int{.cdecl, 
+    importc: "SDLNet_UDP_RecvV", dynlib: NetLibName.}
+  #* Receive a single packet from the UDP socket.
+  #   The returned packet contains the source address and the channel it arrived
+  #   on.  If it did not arrive on a bound channel, the the channel will be set
+  #   to -1.
+  #   The channels are checked in highest to lowest order, so if an address is
+  #   bound to multiple channels, the highest channel with the source address
+  #   bound will be returned.
+  #   This function returns the number of packets read from the network, or -1
+  #   on error.  This function does not block, so can return 0 packets pending.
+  #*
+proc UDP_Recv*(sock: PUDPsocket, packet: PUDPpacket): int{.cdecl, 
+    importc: "SDLNet_UDP_Recv", dynlib: NetLibName.}
+  #* Close a UDP network socket *
+proc UDP_Close*(sock: PUDPsocket){.cdecl, importc: "SDLNet_UDP_Close", 
+                                       dynlib: NetLibName.}
+  #***********************************************************************
+  #* Hooks for checking sockets for available data                       *
+  #***********************************************************************
+  #* Allocate a socket set for use with SDLNet_CheckSockets()
+  #   This returns a socket set for up to 'maxsockets' sockets, or NULL if
+  #   the function ran out of memory.
+  # *
+proc AllocSocketSet*(maxsockets: int): PSocketSet{.cdecl, 
+    importc: "SDLNet_AllocSocketSet", dynlib: NetLibName.}
+  #* Add a socket to a set of sockets to be checked for available data *
+proc AddSocket*(theSet: PSocketSet, sock: PGenericSocket): int{.
+    cdecl, importc: "SDLNet_AddSocket", dynlib: NetLibName.}
+proc TCP_AddSocket*(theSet: PSocketSet, sock: PTCPSocket): int
+proc UDP_AddSocket*(theSet: PSocketSet, sock: PUDPSocket): int
+  #* Remove a socket from a set of sockets to be checked for available data *
+proc DelSocket*(theSet: PSocketSet, sock: PGenericSocket): int{.
+    cdecl, importc: "SDLNet_DelSocket", dynlib: NetLibName.}
+proc TCP_DelSocket*(theSet: PSocketSet, sock: PTCPSocket): int
+  # SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
+proc UDP_DelSocket*(theSet: PSocketSet, sock: PUDPSocket): int
+  #SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
+  #* This function checks to see if data is available for reading on the
+  #   given set of sockets.  If 'timeout' is 0, it performs a quick poll,
+  #   otherwise the function returns when either data is available for
+  #   reading, or the timeout in milliseconds has elapsed, which ever occurs
+  #   first.  This function returns the number of sockets ready for reading,
+  #   or -1 if there was an error with the select() system call.
+  #*
+proc CheckSockets*(theSet: PSocketSet, timeout: int32): int{.cdecl, 
+    importc: "SDLNet_CheckSockets", dynlib: NetLibName.}
+  #* After calling SDLNet_CheckSockets(), you can use this function on a
+  #   socket that was in the socket set, to find out if data is available
+  #   for reading.
+  #*
+proc SocketReady*(sock: PGenericSocket): bool
+  #* Free a set of sockets allocated by SDL_NetAllocSocketSet() *
+proc FreeSocketSet*(theSet: PSocketSet){.cdecl, 
+    importc: "SDLNet_FreeSocketSet", dynlib: NetLibName.}
+  #***********************************************************************
+  #* Platform-independent data conversion functions                      *
+  #***********************************************************************
+  #* Write a 16/32 bit value to network packet buffer *
+proc Write16*(value: Uint16, area: Pointer){.cdecl, 
+    importc: "SDLNet_Write16", dynlib: NetLibName.}
+proc Write32*(value: Uint32, area: Pointer){.cdecl, 
+    importc: "SDLNet_Write32", dynlib: NetLibName.}
+  #* Read a 16/32 bit value from network packet buffer *
+proc Read16*(area: Pointer): Uint16{.cdecl, importc: "SDLNet_Read16", 
+    dynlib: NetLibName.}
+proc Read32*(area: Pointer): Uint32{.cdecl, importc: "SDLNet_Read32", 
+    dynlib: NetLibName.}
+
+proc VERSION(X: var Tversion) = 
+  X.major = MAJOR_VERSION
+  X.minor = MINOR_VERSION
+  X.patch = PATCHLEVEL
+
+proc TCP_AddSocket(theSet: PSocketSet, sock: PTCPSocket): int = 
+  result = AddSocket(theSet, cast[PGenericSocket](sock))
+
+proc UDP_AddSocket(theSet: PSocketSet, sock: PUDPSocket): int = 
+  result = AddSocket(theSet, cast[PGenericSocket](sock))
+
+proc TCP_DelSocket(theSet: PSocketSet, sock: PTCPSocket): int = 
+  result = DelSocket(theSet, cast[PGenericSocket](sock))
+
+proc UDP_DelSocket(theSet: PSocketSet, sock: PUDPSocket): int = 
+  result = DelSocket(theSet, cast[PGenericSocket](sock))
+
+proc SocketReady(sock: PGenericSocket): bool = 
+  result = ((sock != nil) and (sock.ready == 1))
+
diff --git a/lib/wrappers/sdl/sdl_ttf.nim b/lib/wrappers/sdl/sdl_ttf.nim
new file mode 100755
index 000000000..796a20f54
--- /dev/null
+++ b/lib/wrappers/sdl/sdl_ttf.nim
@@ -0,0 +1,341 @@
+#
+#  $Id: sdl_ttf.pas,v 1.18 2007/06/01 11:16:33 savage Exp $
+#
+#
+#******************************************************************************
+#                                                                              
+#          JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer          
+#       Conversion of the Simple DirectMedia Layer Headers                     
+#                                                                              
+# Portions created by Sam Lantinga <slouken@devolution.com> are                
+# Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga                     
+# 5635-34 Springhouse Dr.                                                      
+# Pleasanton, CA 94588 (USA)                                                   
+#                                                                              
+# All Rights Reserved.                                                         
+#                                                                              
+# The original files are : SDL_ttf.h                                           
+#                                                                              
+# The initial developer of this Pascal code was :                              
+# Dominqiue Louis <Dominique@SavageSoftware.com.au>                            
+#                                                                              
+# Portions created by Dominqiue Louis are                                      
+# Copyright (C) 2000 - 2001 Dominqiue Louis.                                   
+#                                                                              
+#                                                                              
+# Contributor(s)                                                               
+# --------------                                                               
+# Tom Jones <tigertomjones@gmx.de>  His Project inspired this conversion       
+#                                                                              
+# Obtained through:                                                            
+# Joint Endeavour of Delphi Innovators ( Project JEDI )                        
+#                                                                              
+# You may retrieve the latest version of this file at the Project              
+# JEDI home page, located at http://delphi-jedi.org                            
+#                                                                              
+# The contents of this file are used with permission, subject to               
+# the Mozilla Public License Version 1.1 (the "License"); you may              
+# not use this file except in compliance with the License. You may             
+# obtain a copy of the License at                                              
+# http://www.mozilla.org/MPL/MPL-1.1.html                                      
+#                                                                              
+# Software distributed under the License is distributed on an                  
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or               
+# implied. See the License for the specific language governing                 
+# rights and limitations under the License.                                    
+#                                                                              
+# Description                                                                  
+# -----------                                                                  
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+# Requires                                                                     
+# --------                                                                     
+#   The SDL Runtime libraris on Win32  : SDL.dll on Linux : libSDL.so          
+#   They are available from...                                                 
+#   http://www.libsdl.org .                                                    
+#                                                                              
+# Programming Notes                                                            
+# -----------------                                                            
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+# Revision History                                                             
+# ----------------                                                             
+#   December 08 2002 - DL : Fixed definition of TTF_RenderUnicode_Solid        
+#                                                                              
+#   April   03 2003 - DL : Added jedi-sdl.inc include file to support more     
+#                          Pascal compilers. Initial support is now included   
+#                          for GnuPascal, VirtualPascal, TMT and obviously     
+#                          continue support for Delphi Kylix and FreePascal.   
+#                                                                              
+#   April   24 2003 - DL : under instruction from Alexey Barkovoy, I have added
+#                          better TMT Pascal support and under instruction     
+#                          from Prof. Abimbola Olowofoyeku (The African Chief),
+#                          I have added better Gnu Pascal support              
+#                                                                              
+#   April   30 2003 - DL : under instruction from David Mears AKA              
+#                          Jason Siletto, I have added FPC Linux support.      
+#                          This was compiled with fpc 1.1, so remember to set  
+#                          include file path. ie. -Fi/usr/share/fpcsrc/rtl/*   
+#                                                                              
+#
+#  $Log: sdl_ttf.pas,v $
+#  Revision 1.18  2007/06/01 11:16:33  savage
+#  Added IFDEF UNIX for Workaround.
+#
+#  Revision 1.17  2007/06/01 08:38:21  savage
+#  Added TTF_RenderText_Solid workaround as suggested by Michalis Kamburelis
+#
+#  Revision 1.16  2007/05/29 21:32:14  savage
+#  Changes as suggested by Almindor for 64bit compatibility.
+#
+#  Revision 1.15  2007/05/20 20:32:45  savage
+#  Initial Changes to Handle 64 Bits
+#
+#  Revision 1.14  2006/12/02 00:19:01  savage
+#  Updated to latest version
+#
+#  Revision 1.13  2005/04/10 11:48:33  savage
+#  Changes as suggested by Michalis, thanks.
+#
+#  Revision 1.12  2005/01/05 01:47:14  savage
+#  Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
+#
+#  Revision 1.11  2005/01/04 23:14:57  savage
+#  Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
+#
+#  Revision 1.10  2005/01/02 19:07:32  savage
+#  Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis )
+#
+#  Revision 1.9  2005/01/01 02:15:20  savage
+#  Updated to v2.0.7
+#
+#  Revision 1.8  2004/10/07 21:02:32  savage
+#  Fix for FPC
+#
+#  Revision 1.7  2004/09/30 22:39:50  savage
+#  Added a true type font class which contains a wrap text function.
+#  Changed the sdl_ttf.pas header to reflect the future of jedi-sdl.
+#
+#  Revision 1.6  2004/08/14 22:54:30  savage
+#  Updated so that Library name defines are correctly defined for MacOS X.
+#
+#  Revision 1.5  2004/05/10 14:10:04  savage
+#  Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
+#
+#  Revision 1.4  2004/04/13 09:32:08  savage
+#  Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
+#
+#  Revision 1.3  2004/04/01 20:53:24  savage
+#  Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
+#
+#  Revision 1.2  2004/03/30 20:23:28  savage
+#  Tidied up use of UNIX compiler directive.
+#
+#  Revision 1.1  2004/02/16 22:16:40  savage
+#  v1.0 changes
+#
+#  
+#
+#******************************************************************************
+#
+#  Define this to workaround a known bug in some freetype versions.
+#  The error manifests as TTF_RenderGlyph_Solid returning nil (error)
+#  and error message (in SDL_Error) is
+#  "Failed loading DPMSDisable: /usr/lib/libX11.so.6: undefined symbol: DPMSDisable"
+#  See [http://lists.libsdl.org/pipermail/sdl-libsdl.org/2007-March/060459.html]
+#
+
+import 
+  sdl
+
+when defined(windows): 
+  const 
+    ttfLibName = "SDL_ttf.dll"
+elif defined(macosx): 
+  const 
+    ttfLibName = "libSDL_ttf-2.0.0.dylib"
+else: 
+  const 
+    ttfLibName = "libSDL_ttf.so"
+const 
+  MAJOR_VERSION* = 2'i8
+  MINOR_VERSION* = 0'i8
+  PATCHLEVEL* = 8'i8      # Backwards compatibility
+
+  STYLE_NORMAL* = 0x00000000
+  STYLE_BOLD* = 0x00000001
+  STYLE_ITALIC* = 0x00000002
+  STYLE_UNDERLINE* = 0x00000004 # ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark)
+  UNICODE_BOM_NATIVE* = 0x0000FEFF
+  UNICODE_BOM_SWAPPED* = 0x0000FFFE
+
+type 
+  PFont* = ptr Tfont
+  TFont*{.final.} = object  # This macro can be used to fill a version structure with the compile-time
+                                #  version of the SDL_ttf library. 
+
+
+proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "TTF_Linked_Version", 
+                                      dynlib: ttfLibName.}
+  # This function tells the library whether UNICODE text is generally
+  #   byteswapped.  A UNICODE BOM character in a string will override
+  #   this setting for the remainder of that string.
+  #
+proc ByteSwappedUNICODE*(swapped: cint){.cdecl, 
+    importc: "TTF_ByteSwappedUNICODE", dynlib: ttfLibName.}
+  #returns 0 on succes, -1 if error occurs
+proc Init*(): cint{.cdecl, importc: "TTF_Init", dynlib: ttfLibName.}
+  #
+  # Open a font file and create a font of the specified point size.
+  # Some .fon fonts will have several sizes embedded in the file, so the
+  # point size becomes the index of choosing which size.  If the value
+  # is too high, the last indexed size will be the default.
+  #
+proc OpenFont*(filename: cstring, ptsize: cint): PFont{.cdecl, 
+    importc: "TTF_OpenFont", dynlib: ttfLibName.}
+proc OpenFontIndex*(filename: cstring, ptsize: cint, index: int32): PFont{.
+    cdecl, importc: "TTF_OpenFontIndex", dynlib: ttfLibName.}
+proc OpenFontRW*(src: PRWops, freesrc: cint, ptsize: cint): PFont{.cdecl, 
+    importc: "TTF_OpenFontRW", dynlib: ttfLibName.}
+proc OpenFontIndexRW*(src: PRWops, freesrc: cint, ptsize: cint, index: int32): PFont{.
+    cdecl, importc: "TTF_OpenFontIndexRW", dynlib: ttfLibName.}
+proc GetFontStyle*(font: PFont): cint{.cdecl, 
+    importc: "TTF_GetFontStyle", dynlib: ttfLibName.}
+proc SetFontStyle*(font: PFont, style: cint){.cdecl, 
+    importc: "TTF_SetFontStyle", dynlib: ttfLibName.}
+  # Get the total height of the font - usually equal to point size 
+proc FontHeight*(font: PFont): cint{.cdecl, importc: "TTF_FontHeight", 
+    dynlib: ttfLibName.}
+  # Get the offset from the baseline to the top of the font
+  #   This is a positive value, relative to the baseline.
+  #
+proc FontAscent*(font: PFont): cint{.cdecl, importc: "TTF_FontAscent", 
+    dynlib: ttfLibName.}
+  # Get the offset from the baseline to the bottom of the font
+  #   This is a negative value, relative to the baseline.
+  #
+proc FontDescent*(font: PFont): cint{.cdecl, importc: "TTF_FontDescent", 
+    dynlib: ttfLibName.}
+  # Get the recommended spacing between lines of text for this font 
+proc FontLineSkip*(font: PFont): cint{.cdecl, 
+    importc: "TTF_FontLineSkip", dynlib: ttfLibName.}
+  # Get the number of faces of the font 
+proc FontFaces*(font: PFont): int32{.cdecl, importc: "TTF_FontFaces", 
+    dynlib: ttfLibName.}
+  # Get the font face attributes, if any 
+proc FontFaceIsFixedWidth*(font: PFont): cint{.cdecl, 
+    importc: "TTF_FontFaceIsFixedWidth", dynlib: ttfLibName.}
+proc FontFaceFamilyName*(font: PFont): cstring{.cdecl, 
+    importc: "TTF_FontFaceFamilyName", dynlib: ttfLibName.}
+proc FontFaceStyleName*(font: PFont): cstring{.cdecl, 
+    importc: "TTF_FontFaceStyleName", dynlib: ttfLibName.}
+  # Get the metrics (dimensions) of a glyph 
+proc GlyphMetrics*(font: PFont, ch: Uint16, minx: var cint, 
+                       maxx: var cint, miny: var cint, maxy: var cint, 
+                       advance: var cint): cint{.cdecl, 
+    importc: "TTF_GlyphMetrics", dynlib: ttfLibName.}
+  # Get the dimensions of a rendered string of text 
+proc SizeText*(font: PFont, text: cstring, w: var cint, y: var cint): cint{.
+    cdecl, importc: "TTF_SizeText", dynlib: ttfLibName.}
+proc SizeUTF8*(font: PFont, text: cstring, w: var cint, y: var cint): cint{.
+    cdecl, importc: "TTF_SizeUTF8", dynlib: ttfLibName.}
+proc SizeUNICODE*(font: PFont, text: PUint16, w: var cint, y: var cint): cint{.
+    cdecl, importc: "TTF_SizeUNICODE", dynlib: ttfLibName.}
+  # Create an 8-bit palettized surface and render the given text at
+  #   fast quality with the given font and color.  The 0 pixel is the
+  #   colorkey, giving a transparent background, and the 1 pixel is set
+  #   to the text color.
+  #   This function returns the new surface, or NULL if there was an error.
+  #
+proc RenderUTF8_Solid*(font: PFont, text: cstring, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderUTF8_Solid", dynlib: ttfLibName.}
+proc RenderUNICODE_Solid*(font: PFont, text: PUint16, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderUNICODE_Solid", dynlib: ttfLibName.}
+  #
+  #Create an 8-bit palettized surface and render the given glyph at
+  #   fast quality with the given font and color.  The 0 pixel is the
+  #   colorkey, giving a transparent background, and the 1 pixel is set
+  #   to the text color.  The glyph is rendered without any padding or
+  #   centering in the X direction, and aligned normally in the Y direction.
+  #   This function returns the new surface, or NULL if there was an error.
+  #
+proc RenderGlyph_Solid*(font: PFont, ch: Uint16, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderGlyph_Solid", dynlib: ttfLibName.}
+  # Create an 8-bit palettized surface and render the given text at
+  #   high quality with the given font and colors.  The 0 pixel is background,
+  #   while other pixels have varying degrees of the foreground color.
+  #   This function returns the new surface, or NULL if there was an error.
+  #
+proc RenderText_Shaded*(font: PFont, text: cstring, fg: TColor, 
+                            bg: TColor): PSurface{.cdecl, 
+    importc: "TTF_RenderText_Shaded", dynlib: ttfLibName.}
+proc RenderUTF8_Shaded*(font: PFont, text: cstring, fg: TColor, 
+                            bg: TColor): PSurface{.cdecl, 
+    importc: "TTF_RenderUTF8_Shaded", dynlib: ttfLibName.}
+proc RenderUNICODE_Shaded*(font: PFont, text: PUint16, fg: TColor, 
+                               bg: TColor): PSurface{.cdecl, 
+    importc: "TTF_RenderUNICODE_Shaded", dynlib: ttfLibName.}
+  # Create an 8-bit palettized surface and render the given glyph at
+  #   high quality with the given font and colors.  The 0 pixel is background,
+  #   while other pixels have varying degrees of the foreground color.
+  #   The glyph is rendered without any padding or centering in the X
+  #   direction, and aligned normally in the Y direction.
+  #   This function returns the new surface, or NULL if there was an error.
+  #
+proc RenderGlyph_Shaded*(font: PFont, ch: Uint16, fg: TColor, bg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderGlyph_Shaded", dynlib: ttfLibName.}
+  # Create a 32-bit ARGB surface and render the given text at high quality,
+  #   using alpha blending to dither the font with the given color.
+  #   This function returns the new surface, or NULL if there was an error.
+  #
+proc RenderText_Blended*(font: PFont, text: cstring, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderText_Blended", dynlib: ttfLibName.}
+proc RenderUTF8_Blended*(font: PFont, text: cstring, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderUTF8_Blended", dynlib: ttfLibName.}
+proc RenderUNICODE_Blended*(font: PFont, text: PUint16, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderUNICODE_Blended", dynlib: ttfLibName.}
+  # Create a 32-bit ARGB surface and render the given glyph at high quality,
+  #   using alpha blending to dither the font with the given color.
+  #   The glyph is rendered without any padding or centering in the X
+  #   direction, and aligned normally in the Y direction.
+  #   This function returns the new surface, or NULL if there was an error.
+  #
+proc RenderGlyph_Blended*(font: PFont, ch: Uint16, fg: TColor): PSurface{.
+    cdecl, importc: "TTF_RenderGlyph_Blended", dynlib: ttfLibName.}
+  # For compatibility with previous versions, here are the old functions 
+  ##define TTF_RenderText(font, text, fg, bg)
+  #	TTF_RenderText_Shaded(font, text, fg, bg)
+  ##define TTF_RenderUTF8(font, text, fg, bg)	
+  #	TTF_RenderUTF8_Shaded(font, text, fg, bg)
+  ##define TTF_RenderUNICODE(font, text, fg, bg)	
+  #	TTF_RenderUNICODE_Shaded(font, text, fg, bg)
+  # Close an opened font file 
+proc CloseFont*(font: PFont){.cdecl, importc: "TTF_CloseFont", 
+                                      dynlib: ttfLibName.}
+  #De-initialize TTF engine
+proc Quit*(){.cdecl, importc: "TTF_Quit", dynlib: ttfLibName.}
+  # Check if the TTF engine is initialized
+proc WasInit*(): cint{.cdecl, importc: "TTF_WasInit", dynlib: ttfLibName.}
+
+
+proc VERSION*(X: var sdl.Tversion) = 
+  X.major = MAJOR_VERSION
+  X.minor = MINOR_VERSION
+  X.patch = PATCHLEVEL
+
+
+when not (defined(Workaround_RenderText_Solid)): 
+  proc RenderText_Solid*(font: PFont, text: cstring, fg: TColor): PSurface{.
+      cdecl, importc: "TTF_RenderText_Solid", dynlib: ttfLibName.}
+else: 
+  proc RenderText_Solid(font: PFont, text: cstring, fg: TColor): PSurface = 
+    var Black: TColor         # initialized to zero
+    result = RenderText_Shaded(font, text, fg, Black)
+
diff --git a/lib/wrappers/sdl/smpeg.nim b/lib/wrappers/sdl/smpeg.nim
new file mode 100755
index 000000000..a836379ac
--- /dev/null
+++ b/lib/wrappers/sdl/smpeg.nim
@@ -0,0 +1,335 @@
+#******************************************************************************
+#
+#  $Id: smpeg.pas,v 1.7 2004/08/14 22:54:30 savage Exp $
+#  
+#
+#                                                                              
+#       Borland Delphi SMPEG - SDL MPEG Player Library                         
+#       Conversion of the SMPEG - SDL MPEG Player Library                      
+#                                                                              
+# Portions created by Sam Lantinga <slouken@devolution.com> are                
+# Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga                     
+# 5635-34 Springhouse Dr.                                                      
+# Pleasanton, CA 94588 (USA)                                                   
+#                                                                              
+# All Rights Reserved.                                                         
+#                                                                              
+# The original files are : smpeg.h                                             
+#                                                                              
+# The initial developer of this Pascal code was :                              
+# Matthias Thoma <ma.thoma@gmx.de>                                             
+#                                                                              
+# Portions created by Matthias Thoma are                                       
+# Copyright (C) 2000 - 2001 Matthias Thoma.                                    
+#                                                                              
+#                                                                              
+# Contributor(s)                                                               
+# --------------                                                               
+# Tom Jones <tigertomjones@gmx.de>  His Project inspired this conversion       
+# Matthias Thoma <ma.thoma@gmx.de>                                             
+#                                                                              
+# Obtained through:                                                            
+# Joint Endeavour of Delphi Innovators ( Project JEDI )                        
+#                                                                              
+# You may retrieve the latest version of this file at the Project              
+# JEDI home page, located at http://delphi-jedi.org                            
+#                                                                              
+# The contents of this file are used with permission, subject to               
+# the Mozilla Public License Version 1.1 (the "License"); you may              
+# not use this file except in compliance with the License. You may             
+# obtain a copy of the License at                                              
+# http://www.mozilla.org/MPL/MPL-1.1.html                                      
+#                                                                              
+# Software distributed under the License is distributed on an                  
+# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or               
+# implied. See the License for the specific language governing                 
+# rights and limitations under the License.                                    
+#                                                                              
+# Description                                                                  
+# -----------                                                                  
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+# Requires                                                                     
+# --------                                                                     
+#   The SDL Runtime libraris on Win32  : SDL.dll on Linux : libSDL-1.2.so.0    
+#   They are available from...                                                 
+#   http://www.libsdl.org .                                                    
+#                                                                              
+# Programming Notes                                                            
+# -----------------                                                            
+#                                                                              
+#                                                                              
+#                                                                              
+#                                                                              
+# Revision History                                                             
+# ----------------                                                             
+#   May      08 2001 - MT : Initial conversion                                 
+#                                                                              
+#   October  12 2001 - DA : Various changes as suggested by David Acklam       
+#                                                                              
+#   April   03 2003 - DL : Added jedi-sdl.inc include file to support more     
+#                          Pascal compilers. Initial support is now included   
+#                          for GnuPascal, VirtualPascal, TMT and obviously     
+#                          continue support for Delphi Kylix and FreePascal.   
+#                                                                              
+#   April   08 2003 - MK : Aka Mr Kroket - Added Better FPC support            
+#                          Fixed all invalid calls to DLL.                     
+#                          Changed constant names to:                          
+#                          const                                               
+#                          STATUS_SMPEG_ERROR = -1;                            
+#                          STATUS_SMPEG_STOPPED = 0;                           
+#                          STATUS_SMPEG_PLAYING = 1;                           
+#                          because SMPEG_ERROR is a function (_SMPEG_error     
+#                          isn't correct), and cannot be two elements with the 
+#                          same name                                           
+#                                                                              
+#   April   24 2003 - DL : under instruction from Alexey Barkovoy, I have added
+#                          better TMT Pascal support and under instruction     
+#                          from Prof. Abimbola Olowofoyeku (The African Chief),
+#                          I have added better Gnu Pascal support              
+#                                                                              
+#   April   30 2003 - DL : under instruction from David Mears AKA              
+#                          Jason Siletto, I have added FPC Linux support.      
+#                          This was compiled with fpc 1.1, so remember to set  
+#                          include file path. ie. -Fi/usr/share/fpcsrc/rtl/*   
+#                                                                              
+#
+#  $Log: smpeg.pas,v $
+#  Revision 1.7  2004/08/14 22:54:30  savage
+#  Updated so that Library name defines are correctly defined for MacOS X.
+#
+#  Revision 1.6  2004/05/10 14:10:04  savage
+#  Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
+#
+#  Revision 1.5  2004/04/13 09:32:08  savage
+#  Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
+#
+#  Revision 1.4  2004/04/02 10:40:55  savage
+#  Changed Linux Shared Object name so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
+#
+#  Revision 1.3  2004/03/31 22:20:02  savage
+#  Windows unit not used in this file, so it was removed to keep the code tidy.
+#
+#  Revision 1.2  2004/03/30 20:23:28  savage
+#  Tidied up use of UNIX compiler directive.
+#
+#  Revision 1.1  2004/02/14 23:35:42  savage
+#  version 1 of sdl_image, sdl_mixer and smpeg.
+#
+#  
+#
+#******************************************************************************
+
+import 
+  sdl
+
+when defined(windows): 
+  const 
+    SmpegLibName = "smpeg.dll"
+elif defined(macosx): 
+  const 
+    SmpegLibName = "libsmpeg.dylib"
+else: 
+  const 
+    SmpegLibName = "libsmpeg.so"
+const 
+  FILTER_INFO_MB_ERROR* = 1
+  FILTER_INFO_PIXEL_ERROR* = 2 # Filter info from SMPEG 
+
+type 
+  TFilterInfo*{.final.} = object 
+    yuv_mb_square_error*: PUint16
+    yuv_pixel_square_error*: PUint16
+
+  PFilterInfo* = ptr TFilterInfo # MPEG filter definition 
+  PFilter* = ptr TFilter # Callback functions for the filter 
+  TFilterCallback* = proc (dest, source: POverlay, region: PRect, 
+                                 filter_info: PFilterInfo, data: Pointer): Pointer{.
+      cdecl.}
+  TFilterDestroy* = proc (Filter: PFilter): Pointer{.cdecl.} # The filter definition itself 
+  TFilter*{.final.} = object  # The null filter (default). It simply copies the source rectangle to the video overlay. 
+    flags*: Uint32
+    data*: Pointer
+    callback*: TFilterCallback
+    destroy*: TFilterDestroy
+
+
+proc filter_null*(): PFilter{.cdecl, importc: "SMPEGfilter_null", 
+    dynlib: SmpegLibName.}
+  # The bilinear filter. A basic low-pass filter that will produce a smoother image. 
+proc filter_bilinear*(): PFilter{.cdecl, 
+    importc: "SMPEGfilter_bilinear", dynlib: SmpegLibName.}
+  # The deblocking filter. It filters block borders and non-intra coded blocks to reduce blockiness 
+proc filter_deblocking*(): PFilter{.cdecl, 
+    importc: "SMPEGfilter_deblocking", dynlib: SmpegLibName.}
+  #------------------------------------------------------------------------------
+  # SMPEG.h
+  #------------------------------------------------------------------------------
+const 
+  MAJOR_VERSION* = 0'i8
+  MINOR_VERSION* = 4'i8
+  PATCHLEVEL* = 2'i8
+
+type 
+  TVersion*{.final.} = object 
+    major*: byte
+    minor*: byte
+    patch*: byte
+
+  Pversion* = ptr Tversion # This is the actual SMPEG object
+  TSMPEG*{.final.} = object 
+  PSMPEG* = ptr TSMPEG        # Used to get information about the SMPEG object 
+  TInfo*{.final.} = object 
+    has_audio*: int32
+    has_video*: int32
+    width*: int32
+    height*: int32
+    current_frame*: int32
+    current_fps*: float64
+    audio_string*: array[0..79, char]
+    audio_current_frame*: int32
+    current_offset*: UInt32
+    total_size*: UInt32
+    current_time*: float64
+    total_time*: float64
+
+  PInfo* = ptr TInfo # Possible MPEG status codes 
+
+const 
+  STATUS_ERROR* = - 1
+  STATUS_STOPPED* = 0
+  STATUS_PLAYING* = 1
+
+type 
+  Tstatus* = int32
+  Pstatus* = ptr int32     # Matches the declaration of SDL_UpdateRect() 
+  TDisplayCallback* = proc (dst: PSurface, x, y: int, w, h: int): Pointer{.
+      cdecl.} # Create a new SMPEG object from an MPEG file.
+              #  On return, if 'info' is not NULL, it will be filled with information
+              #  about the MPEG object.
+              #  This function returns a new SMPEG object.  Use error() to find out
+              #  whether or not there was a problem building the MPEG stream.
+              #  The sdl_audio parameter indicates if SMPEG should initialize the SDL audio
+              #  subsystem. If not, you will have to use the playaudio() function below
+              #  to extract the decoded data. 
+
+proc SMPEG_new*(theFile: cstring, info: PInfo, audio: int): PSMPEG{.cdecl, 
+    importc: "SMPEG_new", dynlib: SmpegLibName.}
+  # The same as above for a file descriptor 
+proc new_descr*(theFile: int, info: PInfo, audio: int): PSMPEG{.
+    cdecl, importc: "SMPEG_new_descr", dynlib: SmpegLibName.}
+  #  The same as above but for a raw chunk of data.  SMPEG makes a copy of the
+  #   data, so the application is free to delete after a successful call to this
+  #   function. 
+proc new_data*(data: Pointer, size: int, info: PInfo, audio: int): PSMPEG{.
+    cdecl, importc: "SMPEG_new_data", dynlib: SmpegLibName.}
+  # Get current information about an SMPEG object 
+proc getinfo*(mpeg: PSMPEG, info: PInfo){.cdecl, 
+    importc: "SMPEG_getinfo", dynlib: SmpegLibName.}
+  #procedure getinfo(mpeg: PSMPEG; info: Pointer);
+  #cdecl; external  SmpegLibName;
+  # Enable or disable audio playback in MPEG stream 
+proc enableaudio*(mpeg: PSMPEG, enable: int){.cdecl, 
+    importc: "SMPEG_enableaudio", dynlib: SmpegLibName.}
+  # Enable or disable video playback in MPEG stream 
+proc enablevideo*(mpeg: PSMPEG, enable: int){.cdecl, 
+    importc: "SMPEG_enablevideo", dynlib: SmpegLibName.}
+  # Delete an SMPEG object 
+proc delete*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_delete", 
+                                  dynlib: SmpegLibName.}
+  # Get the current status of an SMPEG object 
+proc status*(mpeg: PSMPEG): Tstatus{.cdecl, importc: "SMPEG_status", 
+    dynlib: SmpegLibName.}
+  # status
+  # Set the audio volume of an MPEG stream, in the range 0-100 
+proc setvolume*(mpeg: PSMPEG, volume: int){.cdecl, 
+    importc: "SMPEG_setvolume", dynlib: SmpegLibName.}
+  # Set the destination surface for MPEG video playback
+  #  'surfLock' is a mutex used to synchronize access to 'dst', and can be NULL.
+  #  'callback' is a function called when an area of 'dst' needs to be updated.
+  #  If 'callback' is NULL, the default function (SDL_UpdateRect) will be used. 
+proc setdisplay*(mpeg: PSMPEG, dst: PSurface, surfLock: Pmutex, 
+                       callback: TDisplayCallback){.cdecl, 
+    importc: "SMPEG_setdisplay", dynlib: SmpegLibName.}
+  # Set or clear looping play on an SMPEG object 
+proc loop*(mpeg: PSMPEG, repeat: int){.cdecl, importc: "SMPEG_loop", 
+    dynlib: SmpegLibName.}
+  # Scale pixel display on an SMPEG object 
+proc scaleXY*(mpeg: PSMPEG, width, height: int){.cdecl, 
+    importc: "SMPEG_scaleXY", dynlib: SmpegLibName.}
+proc scale*(mpeg: PSMPEG, scale: int){.cdecl, importc: "SMPEG_scale", 
+    dynlib: SmpegLibName.}
+proc Double*(mpeg: PSMPEG, doubleit: bool)
+  # Move the video display area within the destination surface 
+proc move*(mpeg: PSMPEG, x, y: int){.cdecl, importc: "SMPEG_move", 
+    dynlib: SmpegLibName.}
+  # Set the region of the video to be shown 
+proc setdisplayregion*(mpeg: PSMPEG, x, y, w, h: int){.cdecl, 
+    importc: "SMPEG_setdisplayregion", dynlib: SmpegLibName.}
+  # Play an SMPEG object 
+proc play*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_play", 
+                                dynlib: SmpegLibName.}
+  # Pause/Resume playback of an SMPEG object
+proc pause*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_pause", 
+                                 dynlib: SmpegLibName.}
+  # Stop playback of an SMPEG object 
+proc stop*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_stop", 
+                                dynlib: SmpegLibName.}
+  # Rewind the play position of an SMPEG object to the beginning of the MPEG 
+proc rewind*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_rewind", 
+                                  dynlib: SmpegLibName.}
+  # Seek 'bytes' bytes in the MPEG stream 
+proc seek*(mpeg: PSMPEG, bytes: int){.cdecl, importc: "SMPEG_seek", 
+    dynlib: SmpegLibName.}
+  # Skip 'seconds' seconds in the MPEG stream 
+proc skip*(mpeg: PSMPEG, seconds: float32){.cdecl, importc: "SMPEG_skip", 
+    dynlib: SmpegLibName.}
+  # Render a particular frame in the MPEG video
+  #   API CHANGE: This function no longer takes a target surface and position.
+  #               Use setdisplay() and move() to set this information. 
+proc renderFrame*(mpeg: PSMPEG, framenum: int){.cdecl, 
+    importc: "SMPEG_renderFrame", dynlib: SmpegLibName.}
+  # Render the last frame of an MPEG video 
+proc renderFinal*(mpeg: PSMPEG, dst: PSurface, x, y: int){.cdecl, 
+    importc: "SMPEG_renderFinal", dynlib: SmpegLibName.}
+  # Set video filter 
+proc filter*(mpeg: PSMPEG, filter: PFilter): PFilter{.cdecl, 
+    importc: "SMPEG_filter", dynlib: SmpegLibName.}
+  # Return NULL if there is no error in the MPEG stream, or an error message
+  #   if there was a fatal error in the MPEG stream for the SMPEG object. 
+proc error*(mpeg: PSMPEG): cstring{.cdecl, importc: "SMPEG_error", 
+    dynlib: SmpegLibName.}
+  # Exported callback function for audio playback.
+  #   The function takes a buffer and the amount of data to fill, and returns
+  #   the amount of data in bytes that was actually written.  This will be the
+  #   amount requested unless the MPEG audio has finished.
+  #
+proc playAudio*(mpeg: PSMPEG, stream: pointer, length: int): int{.cdecl, 
+    importc: "SMPEG_playAudio", dynlib: SmpegLibName.}
+  # Wrapper for playAudio() that can be passed to SDL and SDL_mixer 
+proc playAudioSDL*(mpeg: Pointer, stream: pointer, length: int){.cdecl, 
+    importc: "SMPEG_playAudioSDL", dynlib: SmpegLibName.}
+  # Get the best SDL audio spec for the audio stream 
+proc wantedSpec*(mpeg: PSMPEG, wanted: PAudioSpec): int{.cdecl, 
+    importc: "SMPEG_wantedSpec", dynlib: SmpegLibName.}
+  # Inform SMPEG of the actual SDL audio spec used for sound playback 
+proc actualSpec*(mpeg: PSMPEG, spec: PAudioSpec){.cdecl, 
+    importc: "SMPEG_actualSpec", dynlib: SmpegLibName.}
+  # This macro can be used to fill a version structure with the compile-time
+  #  version of the SDL library. 
+proc GETVERSION*(X: var Tversion)
+# implementation
+
+proc double(mpeg: PSMPEG, doubleit: bool) = 
+  if doubleit: scale(mpeg, 2)
+  else: scale(mpeg, 1)
+  
+proc GETVERSION(X: var Tversion) = 
+  X.major = MAJOR_VERSION
+  X.minor = MINOR_VERSION
+  X.patch = PATCHLEVEL