hedgewars/SDLh.pas
changeset 5004 2efa6a414518
parent 4976 088d40d8aba2
child 5018 cede79695460
equal deleted inserted replaced
5002:a9c44a8ffec8 5004:2efa6a414518
    91 
    91 
    92 /////////////////////////////////////////////////////////////////
    92 /////////////////////////////////////////////////////////////////
    93 /////////////////////  CONSTANT DEFINITIONS /////////////////////
    93 /////////////////////  CONSTANT DEFINITIONS /////////////////////
    94 /////////////////////////////////////////////////////////////////
    94 /////////////////////////////////////////////////////////////////
    95 
    95 
    96     SDL_SWSURFACE     = $00000000;
       
    97     SDL_HWSURFACE     = $00000001;
       
    98     SDL_SRCALPHA      = $00010000;
       
    99 
       
   100     SDL_INIT_TIMER    = $00000001;
    96     SDL_INIT_TIMER    = $00000001;
   101     SDL_INIT_AUDIO    = $00000010;
    97     SDL_INIT_AUDIO    = $00000010;
   102     SDL_INIT_VIDEO    = $00000020;
    98     SDL_INIT_VIDEO    = $00000020;
   103     SDL_INIT_JOYSTICK = $00000200;
    99     SDL_INIT_JOYSTICK = $00000200;
   104 {$IFDEF SDL13}
   100 {$IFDEF SDL13}
   112 
   108 
   113     SDL_APPINPUTFOCUS    = 2;
   109     SDL_APPINPUTFOCUS    = 2;
   114     SDL_BUTTON_WHEELUP   = 4;
   110     SDL_BUTTON_WHEELUP   = 4;
   115     SDL_BUTTON_WHEELDOWN = 5;
   111     SDL_BUTTON_WHEELDOWN = 5;
   116 
   112 
   117 
   113 {$IFDEF SDL13}
   118 {*begin SDL_Event binding*}
   114     // SDL_Event types
   119 
   115     SDL_FIRSTEVENT      = 0;
   120 {$IFDEF SDL13}
   116     SDL_QUITEV          = $100;
   121     SDL_FIRSTEVENT = 0;
   117     SDL_WINDOWEVENT     = $200;
   122     SDL_QUITEV = $100;
   118     SDL_SYSWMEVENT      = $201;
   123     SDL_WINDOWEVENT = $200;
   119     SDL_KEYDOWN         = $300;
   124     SDL_SYSWMEVENT = $201;
   120     SDL_KEYUP           = $301;
   125     SDL_KEYDOWN = $300;
   121     SDL_TEXTEDITING     = $302;
   126     SDL_KEYUP = $301;
   122     SDL_TEXTINPUT       = $303;
   127     SDL_TEXTEDITING = $302;
   123     SDL_MOUSEMOTION     = $400;
   128     SDL_TEXTINPUT = $303;
       
   129     SDL_MOUSEMOTION  = $400;
       
   130     SDL_MOUSEBUTTONDOWN = $401;
   124     SDL_MOUSEBUTTONDOWN = $401;
   131     SDL_MOUSEBUTTONUP = $402;
   125     SDL_MOUSEBUTTONUP   = $402;
   132     SDL_MOUSEWHEEL = $403;
   126     SDL_MOUSEWHEEL      = $403;
   133     SDL_PROXIMITYIN = $500;
   127     SDL_PROXIMITYIN     = $500;
   134     SDL_PROXIMITYOUT = $501;
   128     SDL_PROXIMITYOUT    = $501;
   135     SDL_JOYAXISMOTION = $600;
   129     SDL_JOYAXISMOTION   = $600;
   136     SDL_JOYBALLMOTION = $601;
   130     SDL_JOYBALLMOTION   = $601;
   137     SDL_JOYHATMOTION = $602;
   131     SDL_JOYHATMOTION    = $602;
   138     SDL_JOYBUTTONDOWN = $603;
   132     SDL_JOYBUTTONDOWN   = $603;
   139     SDL_JOYBUTTONUP = $604;
   133     SDL_JOYBUTTONUP     = $604;
   140     SDL_USEREVENT = $8000;
   134     SDL_USEREVENT       = $8000;
   141     SDL_LASTEVENT = $FFFF;
   135     SDL_LASTEVENT       = $FFFF;
   142 {$ELSE}
   136 
   143     SDL_NOEVENT = 0;
   137     // SDL_Surface flags
   144     SDL_ACTIVEEVENT = 1;
   138     SDL_SWSURFACE   = $00000000;  //*< Not used */
   145     SDL_KEYDOWN = 2;
   139     SDL_PREALLOC    = $00000001;  //*< Surface uses preallocated memory */
   146     SDL_KEYUP = 3;
   140     SDL_RLEACCEL    = $00000002;  //*< Surface is RLE encoded */
   147     SDL_MOUSEMOTION  = 4;
   141     SDL_DONTFREE    = $00000004;  //*< Surface is referenced internally */
   148     SDL_MOUSEBUTTONDOWN = 5;
   142     SDL_SRCALPHA    = $00010000;
   149     SDL_MOUSEBUTTONUP   = 6;
   143     SDL_SRCCOLORKEY = $00020000;
   150     SDL_JOYAXISMOTION = 7;
   144     SDL_ANYFORMAT   = $00100000;
   151     SDL_JOYBALLMOTION = 8;
       
   152     SDL_JOYHATMOTION = 9;
       
   153     SDL_JOYBUTTONDOWN = 10;
       
   154     SDL_JOYBUTTONUP = 11;
       
   155     SDL_QUITEV = 12;
       
   156     SDL_VIDEORESIZE = 16; // TODO: outdated? no longer in SDL 1.3?
       
   157 {$ENDIF}
       
   158 {*end SDL_Event binding*}
       
   159 
       
   160 {$IFDEF SDL13}
       
   161     SDL_ASYNCBLIT   = $08000000;
       
   162     SDL_ANYFORMAT   = $10000000;
       
   163     SDL_HWPALETTE   = $00200000;
   145     SDL_HWPALETTE   = $00200000;
   164     SDL_DOUBLEBUF   = $00400000;
   146     SDL_DOUBLEBUF   = $00400000;
   165     SDL_FULLSCREEN  = $00800000;
   147     SDL_FULLSCREEN  = $00800000;
   166     SDL_HWACCEL     = $08000000;
   148     SDL_RESIZABLE   = $01000000;
   167     SDL_SRCCOLORKEY = $00020000;
       
   168     SDL_RLEACCEL    = $08000000;
       
   169     SDL_NOFRAME     = $02000000;
   149     SDL_NOFRAME     = $02000000;
   170     SDL_OPENGL      = $04000000;
   150     SDL_OPENGL      = $04000000;
   171     SDL_RESIZABLE   = $01000000;
   151     SDL_HWSURFACE   = $08000001;  //*< Not used */
   172 {$ELSE}
   152     SDL_ASYNCBLIT   = $08000000;  //*< Not used */
       
   153     SDL_RLEACCELOK  = $08000000;  //*< Not used */
       
   154     SDL_HWACCEL     = $08000000;  //*< Not used */
       
   155 
       
   156     // SDL_WindowFlags (enum)
       
   157     SDL_WINDOW_FULLSCREEN    = $00000001;      //*< fullscreen window, implies borderless */
       
   158     SDL_WINDOW_OPENGL        = $00000002;      //*< window usable with OpenGL context */
       
   159     SDL_WINDOW_SHOWN         = $00000004;      //*< window is visible */
       
   160 //  SDL_WINDOW_HIDDEN        = $00000008;      //*< window is not visible */
       
   161     SDL_WINDOW_BORDERLESS    = $00000008;      //*< no window decoration */
       
   162     SDL_WINDOW_RESIZABLE     = $00000010;      //*< window can be resized */
       
   163     SDL_WINDOW_MINIMIZED     = $00000020;      //*< window is minimized */
       
   164     SDL_WINDOW_MAXIMIZED     = $00000040;      //*< window is maximized */
       
   165     SDL_WINDOW_INPUT_GRABBED = $00000100;      //*< window has grabbed input focus */
       
   166     SDL_WINDOW_INPUT_FOCUS   = $00000200;      //*< window has input focus */
       
   167     SDL_WINDOW_MOUSE_FOCUS   = $00000400;      //*< window has mouse focus */
       
   168     SDL_WINDOW_FOREIGN       = $00000800;      //*< window not created by SDL */
       
   169 
       
   170     SDL_WINDOWPOS_CENTERED_MASK = $2FFF0000;
       
   171 
       
   172     // SDL_WindowEventID (enum)
       
   173     SDL_WINDOWEVENT_NONE         = 0;    //*< Never used
       
   174     SDL_WINDOWEVENT_SHOWN        = 1;    //*< Window has been shown
       
   175     SDL_WINDOWEVENT_HIDDEN       = 2;    //*< Window has been hidden
       
   176     SDL_WINDOWEVENT_EXPOSED      = 3;    //*< Window has been exposed and should be redrawn
       
   177     SDL_WINDOWEVENT_MOVED        = 4;    //*< Window has been moved to data1, data2
       
   178     SDL_WINDOWEVENT_RESIZED      = 5;    //*< Window size changed to data1xdata2
       
   179     SDL_WINDOWEVENT_MINIMIZED    = 6;    //*< Window has been minimized
       
   180     SDL_WINDOWEVENT_MAXIMIZED    = 7;    //*< Window has been maximized
       
   181     SDL_WINDOWEVENT_RESTORED     = 8;    //*< Window has been restored to normal size and position
       
   182     SDL_WINDOWEVENT_ENTER        = 9;    //*< Window has gained mouse focus
       
   183     SDL_WINDOWEVENT_LEAVE        = 10;   //*< Window has lost mouse focus
       
   184     SDL_WINDOWEVENT_FOCUS_GAINED = 11;   //*< Window has gained keyboard focus
       
   185     SDL_WINDOWEVENT_FOCUS_LOST   = 12;   //*< Window has lost keyboard focus
       
   186     SDL_WINDOWEVENT_CLOSE        = 13;   //*< The window manager requests that the window be closed */
       
   187 {$ELSE}
       
   188     // SDL_Event types
       
   189     SDL_NOEVENT         = 0;
       
   190     SDL_ACTIVEEVENT     = 1;
       
   191     SDL_KEYDOWN         = 2;
       
   192     SDL_KEYUP           = 3;
       
   193     SDL_MOUSEMOTION     = 4;
       
   194     SDL_MOUSEBUTTONDOWN = 5;
       
   195     SDL_MOUSEBUTTONUP   = 6;
       
   196     SDL_JOYAXISMOTION   = 7;
       
   197     SDL_JOYBALLMOTION   = 8;
       
   198     SDL_JOYHATMOTION    = 9;
       
   199     SDL_JOYBUTTONDOWN   = 10;
       
   200     SDL_JOYBUTTONUP     = 11;
       
   201     SDL_QUITEV          = 12;
       
   202     SDL_VIDEORESIZE     = 16; // TODO: outdated? no longer in SDL 1.3?
       
   203 
       
   204     // SDL_Surface flags
       
   205     SDL_SWSURFACE   = $00000000;
       
   206     SDL_HWSURFACE   = $00000001;
       
   207     SDL_OPENGL      = $00000002;
   173     SDL_ASYNCBLIT   = $00000004;
   208     SDL_ASYNCBLIT   = $00000004;
       
   209     SDL_RESIZABLE   = $00000010;
       
   210     SDL_NOFRAME     = $00000020;
       
   211     SDL_HWACCEL     = $00000100;
       
   212     SDL_SRCCOLORKEY = $00001000;
       
   213     SDL_RLEACCEL    = $00004000;
       
   214     SDL_SRCALPHA    = $00010000;
   174     SDL_ANYFORMAT   = $00100000;
   215     SDL_ANYFORMAT   = $00100000;
   175     SDL_HWPALETTE   = $20000000;
   216     SDL_HWPALETTE   = $20000000;
   176     SDL_DOUBLEBUF   = $40000000;
   217     SDL_DOUBLEBUF   = $40000000;
   177     SDL_FULLSCREEN  = $80000000;
   218     SDL_FULLSCREEN  = $80000000;
   178     SDL_HWACCEL     = $00000100;
   219 {$ENDIF}
   179     SDL_SRCCOLORKEY = $00001000;
       
   180     SDL_RLEACCEL    = $00004000;
       
   181     SDL_NOFRAME     = $00000020;
       
   182     SDL_OPENGL      = $00000002;
       
   183     SDL_RESIZABLE   = $00000010;
       
   184 {$ENDIF}
       
   185 
       
   186 
   220 
   187 {$IFDEF ENDIAN_LITTLE}
   221 {$IFDEF ENDIAN_LITTLE}
   188     RMask = $000000FF;
   222     RMask = $000000FF;
   189     GMask = $0000FF00;
   223     GMask = $0000FF00;
   190     BMask = $00FF0000;
   224     BMask = $00FF0000;
   194     GMask = $00FF0000;
   228     GMask = $00FF0000;
   195     BMask = $0000FF00;
   229     BMask = $0000FF00;
   196     AMask = $000000FF;
   230     AMask = $000000FF;
   197 {$ENDIF}
   231 {$ENDIF}
   198 
   232 
   199 {$IFDEF SDL13}
       
   200     // SDL_WindowFlags (enum)
       
   201     SDL_WINDOW_FULLSCREEN = $00000001;         //*< fullscreen window, implies borderless */
       
   202     SDL_WINDOW_OPENGL = $00000002;             //*< window usable with OpenGL context */
       
   203     SDL_WINDOW_SHOWN = $00000004;              //*< window is visible */
       
   204     SDL_WINDOW_BORDERLESS = $00000008;         //*< no window decoration */
       
   205     SDL_WINDOW_RESIZABLE = $00000010;          //*< window can be resized */
       
   206     SDL_WINDOW_MINIMIZED = $00000020;          //*< window is minimized */
       
   207     SDL_WINDOW_MAXIMIZED = $00000040;          //*< window is maximized */
       
   208     SDL_WINDOW_INPUT_GRABBED = $00000100;      //*< window has grabbed input focus */
       
   209     SDL_WINDOW_INPUT_FOCUS = $00000200;        //*< window has input focus */
       
   210     SDL_WINDOW_MOUSE_FOCUS = $00000400;        //*< window has mouse focus */
       
   211     SDL_WINDOW_FOREIGN = $00000800;            //*< window not created by SDL */
       
   212 
       
   213     // SDL_WindowEventID (enum)
       
   214     SDL_WINDOWEVENT_NONE = 0;            //*< Never used
       
   215     SDL_WINDOWEVENT_SHOWN = 1;           //*< Window has been shown
       
   216     SDL_WINDOWEVENT_HIDDEN = 2;          //*< Window has been hidden
       
   217     SDL_WINDOWEVENT_EXPOSED = 3;         //*< Window has been exposed and should be redrawn
       
   218     SDL_WINDOWEVENT_MOVED = 4;           //*< Window has been moved to data1, data2
       
   219     SDL_WINDOWEVENT_RESIZED = 5;         //*< Window size changed to data1xdata2
       
   220     SDL_WINDOWEVENT_MINIMIZED = 6;       //*< Window has been minimized
       
   221     SDL_WINDOWEVENT_MAXIMIZED = 7;       //*< Window has been maximized
       
   222     SDL_WINDOWEVENT_RESTORED = 8;        //*< Window has been restored to normal size and position
       
   223     SDL_WINDOWEVENT_ENTER = 9;           //*< Window has gained mouse focus
       
   224     SDL_WINDOWEVENT_LEAVE = 10;          //*< Window has lost mouse focus
       
   225     SDL_WINDOWEVENT_FOCUS_GAINED = 11;   //*< Window has gained keyboard focus
       
   226     SDL_WINDOWEVENT_FOCUS_LOST = 12;     //*< Window has lost keyboard focus
       
   227     SDL_WINDOWEVENT_CLOSE = 13;          //*< The window manager requests that the window be closed */
       
   228 {$ENDIF}
       
   229 
       
   230     {* SDL_mixer *}
   233     {* SDL_mixer *}
   231     MIX_MAX_VOLUME = 128;
   234     MIX_MAX_VOLUME = 128;
   232     MIX_INIT_FLAC = $00000001;
   235     MIX_INIT_FLAC  = $00000001;
   233     MIX_INIT_MOD  = $00000002;
   236     MIX_INIT_MOD   = $00000002;
   234     MIX_INIT_MP3  = $00000004;
   237     MIX_INIT_MP3   = $00000004;
   235     MIX_INIT_OGG  = $00000008;
   238     MIX_INIT_OGG   = $00000008;
   236 
   239 
   237     {* SDL_TTF *}
   240     {* SDL_TTF *}
   238     TTF_STYLE_NORMAL = 0;
   241     TTF_STYLE_NORMAL = 0;
   239     TTF_STYLE_BOLD   = 1;
   242     TTF_STYLE_BOLD   = 1;
   240     TTF_STYLE_ITALIC = 2;
   243     TTF_STYLE_ITALIC = 2;
   245     SDL_HAT_RIGHT     = $02;
   248     SDL_HAT_RIGHT     = $02;
   246     SDL_HAT_DOWN      = $04;
   249     SDL_HAT_DOWN      = $04;
   247     SDL_HAT_LEFT      = $08;
   250     SDL_HAT_LEFT      = $08;
   248     SDL_HAT_RIGHTUP   = SDL_HAT_RIGHT or SDL_HAT_UP;
   251     SDL_HAT_RIGHTUP   = SDL_HAT_RIGHT or SDL_HAT_UP;
   249     SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN;
   252     SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT or SDL_HAT_DOWN;
   250     SDL_HAT_LEFTUP    = SDL_HAT_LEFT or SDL_HAT_UP;
   253     SDL_HAT_LEFTUP    = SDL_HAT_LEFT  or SDL_HAT_UP;
   251     SDL_HAT_LEFTDOWN  = SDL_HAT_LEFT or SDL_HAT_DOWN;
   254     SDL_HAT_LEFTDOWN  = SDL_HAT_LEFT  or SDL_HAT_DOWN;
   252 
   255 
   253     {* SDL_image *}
   256     {* SDL_image *}
   254     IMG_INIT_JPG = $00000001;
   257     IMG_INIT_JPG = $00000001;
   255     IMG_INIT_PNG = $00000002;
   258     IMG_INIT_PNG = $00000002;
   256     IMG_INIT_TIF = $00000004;
   259     IMG_INIT_TIF = $00000004;
   275         Y: LongInt;
   278         Y: LongInt;
   276         end;
   279         end;
   277 
   280 
   278     PSDL_PixelFormat = ^TSDL_PixelFormat;
   281     PSDL_PixelFormat = ^TSDL_PixelFormat;
   279     TSDL_PixelFormat = record
   282     TSDL_PixelFormat = record
       
   283 {$IFDEF SDL13}
       
   284         format: Longword;
       
   285 {$ENDIF}
   280         palette: Pointer;
   286         palette: Pointer;
   281         BitsPerPixel : Byte;
   287         BitsPerPixel : Byte;
   282         BytesPerPixel: Byte;
   288         BytesPerPixel: Byte;
   283         Rloss : Byte;
   289         Rloss : Byte;
   284         Gloss : Byte;
   290         Gloss : Byte;
   290         Ashift: Byte;
   296         Ashift: Byte;
   291         RMask : Longword;
   297         RMask : Longword;
   292         GMask : Longword;
   298         GMask : Longword;
   293         BMask : Longword;
   299         BMask : Longword;
   294         AMask : Longword;
   300         AMask : Longword;
       
   301 {$IFDEF SDL13}
       
   302         refcount: LongInt;
       
   303         next: Pointer;
       
   304 {$ELSE}
   295         colorkey: Longword;
   305         colorkey: Longword;
   296         alpha : Byte;
   306         alpha: Byte;
       
   307 {$ENDIF}
   297         end;
   308         end;
   298 
   309 
   299 
   310 
   300     PSDL_Surface = ^TSDL_Surface;
   311     PSDL_Surface = ^TSDL_Surface;
   301     TSDL_Surface = record
   312     TSDL_Surface = record
   718 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName;
   729 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName;
   719 function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): PSDL_Renderer; cdecl; external SDLLibName;
   730 function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): PSDL_Renderer; cdecl; external SDLLibName;
   720 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   731 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   721 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   732 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   722 procedure SDL_VideoQuit; cdecl; external SDLLibName;
   733 procedure SDL_VideoQuit; cdecl; external SDLLibName;
   723 function  SDL_SelectVideoDisplay(index: LongInt): LongInt; cdecl; external SDLLibName;
       
   724 function  SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName;
   734 function  SDL_GetNumVideoDisplays: LongInt; cdecl; external SDLLibName;
   725 
   735 
   726 function  SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
   736 function  SDL_SetRenderDrawColor(renderer: PSDL_Renderer; r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
   727 function  SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   737 function  SDL_RenderFillRect(renderer: PSDL_Renderer; rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   728 function  SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   738 function  SDL_RenderClear(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
   731 
   741 
   732 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   742 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   733 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   743 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   734 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   744 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   735 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   745 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
       
   746 
       
   747 function  SDL_AllocFormat(format: Longword): PSDL_PixelFormat; cdecl; external SDLLibName;
       
   748 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName;
   736 {$ENDIF}
   749 {$ENDIF}
   737 
   750 
   738 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF};
   751 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF};
   739 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   752 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   740 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   753 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   861 
   874 
   862 implementation
   875 implementation
   863 
   876 
   864 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   877 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   865 begin
   878 begin
       
   879 {$IFDEF SDL13}
       
   880     SDL_MustLock:= ((surface^.flags and SDL_RLEACCEL) <> 0)
       
   881 {$ELSE}
   866     SDL_MustLock:= ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0)
   882     SDL_MustLock:= ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0)
       
   883 {$ENDIF}
   867 end;
   884 end;
   868 
   885 
   869 procedure SDLNet_Write16(value: Word; buf: pointer);
   886 procedure SDLNet_Write16(value: Word; buf: pointer);
   870 begin
   887 begin
   871     PByteArray(buf)^[1]:= value;
   888     PByteArray(buf)^[1]:= value;