hedgewars/SDLh.pas
changeset 105 e7cb9bb4a9de
parent 95 1ef5e2c41115
child 106 98cb6606bf67
equal deleted inserted replaced
104:e647d0589bff 105:e7cb9bb4a9de
     1 (*
     1 (*
     2  * Hedgewars, a worms-like game
     2  * Hedgewars, a worms-like game
     3  * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004, 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * Distributed under the terms of the BSD-modified licence:
     5  * Distributed under the terms of the BSD-modified licence:
     6  *
     6  *
     7  * Permission is hereby granted, free of charge, to any person obtaining a copy
     7  * Permission is hereby granted, free of charge, to any person obtaining a copy
     8  * of this software and associated documentation files (the "Software"), to deal
     8  * of this software and associated documentation files (the "Software"), to deal
    40 {$DEFINE UNIX}
    40 {$DEFINE UNIX}
    41 {$ENDIF}
    41 {$ENDIF}
    42 
    42 
    43 {$IFDEF UNIX}
    43 {$IFDEF UNIX}
    44 {$linklib c}
    44 {$linklib c}
    45 {$linklib pthread}  // кажется, это только для FreeBSD, не уверен
    45 {$linklib pthread}
    46 {$ENDIF}
    46 {$ENDIF}
    47 
    47 
    48 {$IFDEF FPC}
    48 {$IFDEF FPC}
    49   {$MODE Delphi}
    49   {$MODE Delphi}
    50   {$PACKRECORDS 4}
    50   {$PACKRECORDS 4}
    82                  x, y: SmallInt;
    82                  x, y: SmallInt;
    83                  w, h: Word;
    83                  w, h: Word;
    84                  end;
    84                  end;
    85 
    85 
    86      TPoint = record
    86      TPoint = record
    87               X: Integer;
    87               X: LongInt;
    88               Y: Integer;
    88               Y: LongInt;
    89               end;
    89               end;
    90 
    90 
    91      PSDL_PixelFormat = ^TSDL_PixelFormat;
    91      PSDL_PixelFormat = ^TSDL_PixelFormat;
    92      TSDL_PixelFormat = record
    92      TSDL_PixelFormat = record
    93                         palette: Pointer;
    93                         palette: Pointer;
   112 
   112 
   113      PSDL_Surface = ^TSDL_Surface;
   113      PSDL_Surface = ^TSDL_Surface;
   114      TSDL_Surface = record
   114      TSDL_Surface = record
   115                     flags : Longword;
   115                     flags : Longword;
   116                     format: PSDL_PixelFormat;
   116                     format: PSDL_PixelFormat;
   117                     w, h  : Integer;
   117                     w, h  : LongInt;
   118                     pitch : Word;
   118                     pitch : Word;
   119                     pixels: Pointer;
   119                     pixels: Pointer;
   120                     offset: Integer;
   120                     offset: LongInt;
   121                     hwdata: Pointer;
   121                     hwdata: Pointer;
   122                     clip_rect: TSDL_Rect;
   122                     clip_rect: TSDL_Rect;
   123                     unused1,
   123                     unused1,
   124                     locked   : Longword;
   124                     locked   : Longword;
   125                     Blitmap  : Pointer;
   125                     Blitmap  : Pointer;
   126                     format_version: Longword;
   126                     format_version: Longword;
   127                     refcount : Integer;
   127                     refcount : LongInt;
   128                     end;
   128                     end;
   129 
   129 
   130      PSDL_Color = ^TSDL_Color;
   130      PSDL_Color = ^TSDL_Color;
   131      TSDL_Color = record
   131      TSDL_Color = record
   132                   r: Byte;
   132                   r: Byte;
   134                   b: Byte;
   134                   b: Byte;
   135                   a: Byte;
   135                   a: Byte;
   136                   end;
   136                   end;
   137 
   137 
   138      PSDL_RWops = ^TSDL_RWops;
   138      PSDL_RWops = ^TSDL_RWops;
   139      TSeek = function( context: PSDL_RWops; offset: Integer; whence: Integer ): Integer; cdecl;
   139      TSeek = function( context: PSDL_RWops; offset: LongInt; whence: LongInt ): LongInt; cdecl;
   140      TRead = function( context: PSDL_RWops; Ptr: Pointer; size: Integer; maxnum : Integer ): Integer;  cdecl;
   140      TRead = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; maxnum : LongInt ): LongInt;  cdecl;
   141      TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: Integer; num: Integer ): Integer; cdecl;
   141      TWrite = function( context: PSDL_RWops; Ptr: Pointer; size: LongInt; num: LongInt ): LongInt; cdecl;
   142      TClose = function( context: PSDL_RWops ): Integer; cdecl;
   142      TClose = function( context: PSDL_RWops ): LongInt; cdecl;
   143 
   143 
   144      TStdio = record
   144      TStdio = record
   145               autoclose: Integer;
   145               autoclose: LongInt;
   146               fp: pointer;
   146               fp: pointer;
   147               end;
   147               end;
   148 
   148 
   149      TMem = record
   149      TMem = record
   150             base: PByte;
   150             base: PByte;
   197      TByteArray = array[0..32767] of Byte;
   197      TByteArray = array[0..32767] of Byte;
   198 
   198 
   199      PSDL_Thread = Pointer;
   199      PSDL_Thread = Pointer;
   200      PSDL_mutex = Pointer;
   200      PSDL_mutex = Pointer;
   201 
   201 
   202 function  SDL_Init(flags: Longword): Integer; cdecl; external SDLLibName;
   202 function  SDL_Init(flags: Longword): LongInt; cdecl; external SDLLibName;
   203 procedure SDL_Quit; cdecl; external SDLLibName;
   203 procedure SDL_Quit; cdecl; external SDLLibName;
   204 
   204 
   205 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
   205 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
   206 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
   206 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
   207 
   207 
   208 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
   208 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
   209 function  SDL_LockSurface(Surface: PSDL_Surface): Integer; cdecl; external SDLLibName;
   209 function  SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   210 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   210 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   211 
   211 
   212 function  SDL_GetError: PChar; cdecl; external SDLLibName;
   212 function  SDL_GetError: PChar; cdecl; external SDLLibName;
   213 
   213 
   214 function  SDL_SetVideoMode(width, height, bpp: Integer; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
   214 function  SDL_SetVideoMode(width, height, bpp: LongInt; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
   215 function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: Integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   215 function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   216 function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: Integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   216 function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   217 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   217 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   218 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): Integer; cdecl; external SDLLibName;
   218 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName;
   219 
   219 
   220 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): Integer; cdecl; external SDLLibName;
   220 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   221 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): Integer; cdecl; external SDLLibName;
   221 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName;
   222 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: Integer; w, h: Longword); cdecl; external SDLLibName;
   222 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName;
   223 function  SDL_Flip(Screen: PSDL_Surface): Integer; cdecl; external SDLLibName;
   223 function  SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   224 
   224 
   225 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
   225 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
   226 function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Integer; cdecl; external SDLLibName;
   226 function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): LongInt; cdecl; external SDLLibName;
   227 
   227 
   228 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   228 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   229 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   229 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   230 
   230 
   231 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   231 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   232 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: Integer): Integer; cdecl; external SDLLibName;
   232 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   233 
   233 
   234 function  SDL_GetKeyState(numkeys: PInteger): PByteArray; cdecl; external SDLLibName;
   234 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   235 function  SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName;
   235 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   236 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   236 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   237 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
   237 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
   238 
   238 
   239 function  SDL_PollEvent(event: PSDL_Event): Integer; cdecl; external SDLLibName;
   239 function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   240 
   240 
   241 function  SDL_ShowCursor(toggle: Integer): Integer; cdecl; external SDLLibName;
   241 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
   242 
   242 
   243 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   243 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   244 
   244 
   245 function  SDL_CreateThread(fn: pointer; data: pointer): PSDL_Thread; cdecl; external SDLLibName;
   245 function  SDL_CreateThread(fn: pointer; data: pointer): PSDL_Thread; cdecl; external SDLLibName;
   246 procedure SDL_WaitThread(thread: PSDL_Thread; status: PInteger); cdecl; external SDLLibName;
   246 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
   247 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
   247 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
   248 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
   248 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
   249 function  SDL_LockMutex(mutex: PSDL_mutex): integer; cdecl; external SDLLibName name 'SDL_mutexP';
   249 function  SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP';
   250 function  SDL_UnlockMutex(mutex: PSDL_mutex): integer; cdecl; external SDLLibName name 'SDL_mutexV';
   250 function  SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV';
   251 
   251 
   252 (*  TTF  *)
   252 (*  TTF  *)
   253 
   253 
   254 const {$IFDEF WIN32}
   254 const {$IFDEF WIN32}
   255       SDL_TTFLibName = 'SDL_ttf.dll';
   255       SDL_TTFLibName = 'SDL_ttf.dll';
   261 
   261 
   262 type PTTF_Font = ^TTTF_font;
   262 type PTTF_Font = ^TTTF_font;
   263      TTTF_Font = record
   263      TTTF_Font = record
   264                  end;
   264                  end;
   265 
   265 
   266 function TTF_Init: integer; cdecl; external SDL_TTFLibName;
   266 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName;
   267 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
   267 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
   268 
   268 
   269 
   269 
   270 function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: integer): Integer; cdecl; external SDL_TTFLibName;
   270 function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
   271 function TTF_RenderUTF8_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   271 function TTF_RenderUTF8_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   272 function TTF_RenderUTF8_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   272 function TTF_RenderUTF8_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   273 function TTF_OpenFont(const filename: Pchar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName;
   273 function TTF_OpenFont(const filename: Pchar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   274 
   274 
   275 (*  SDL_mixer *)
   275 (*  SDL_mixer *)
   276 
   276 
   277 const {$IFDEF WIN32}
   277 const {$IFDEF WIN32}
   278       SDL_MixerLibName = 'SDL_mixer.dll';
   278       SDL_MixerLibName = 'SDL_mixer.dll';
   290                   end;
   290                   end;
   291      TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3);
   291      TMusic = (MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3);
   292      TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN);
   292      TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN);
   293 
   293 
   294      TMidiSong = record
   294      TMidiSong = record
   295                samples : Integer;
   295                samples : LongInt;
   296                events  : pointer;
   296                events  : pointer;
   297                end;
   297                end;
   298 
   298 
   299      TMusicUnion = record
   299      TMusicUnion = record
   300         case Byte of
   300         case Byte of
   308                  data   : TMusicUnion;
   308                  data   : TMusicUnion;
   309                  fading : TMix_Fading;
   309                  fading : TMix_Fading;
   310                  fade_volume,
   310                  fade_volume,
   311                  fade_step,
   311                  fade_step,
   312                  fade_steps,
   312                  fade_steps,
   313                  error  : integer;
   313                  error  : LongInt;
   314                  end;
   314                  end;
   315 
   315 
   316 function  Mix_OpenAudio(frequency: integer; format: Word; channels: integer; chunksize: integer): integer; cdecl; external SDL_MixerLibName;
   316 function  Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   317 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName;
   317 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName;
   318 
   318 
   319 function  Mix_VolumeMusic(volume: integer): integer; cdecl; external SDL_MixerLibName;
   319 function  Mix_VolumeMusic(volume: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   320 
   320 
   321 function Mix_AllocateChannels(numchans: integer): integer; cdecl; external SDL_MixerLibName;
   321 function Mix_AllocateChannels(numchans: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   322 procedure Mix_FreeChunk(chunk: PMixChunk); cdecl; external SDL_MixerLibName;
   322 procedure Mix_FreeChunk(chunk: PMixChunk); cdecl; external SDL_MixerLibName;
   323 procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName;
   323 procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName;
   324 
   324 
   325 function  Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: integer): PMixChunk; cdecl; external SDL_MixerLibName;
   325 function  Mix_LoadWAV_RW(src: PSDL_RWops; freesrc: LongInt): PMixChunk; cdecl; external SDL_MixerLibName;
   326 function  Mix_LoadMUS(const filename: PChar): PMixMusic; cdecl; external SDL_MixerLibName;
   326 function  Mix_LoadMUS(const filename: PChar): PMixMusic; cdecl; external SDL_MixerLibName;
   327 
   327 
   328 function  Mix_Playing(channel: integer): integer; cdecl; external SDL_MixerLibName;
   328 function  Mix_Playing(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   329 function  Mix_PlayingMusic: integer; cdecl; external SDL_MixerLibName;
   329 function  Mix_PlayingMusic: LongInt; cdecl; external SDL_MixerLibName;
   330 
   330 
   331 function  Mix_PlayChannelTimed(channel: integer; chunk: PMixChunk; loops: integer; ticks: integer): integer; cdecl; external SDL_MixerLibName;
   331 function  Mix_PlayChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   332 function  Mix_PlayMusic(music: PMixMusic; loops: integer): integer; cdecl; external SDL_MixerLibName;
   332 function  Mix_PlayMusic(music: PMixMusic; loops: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   333 function  Mix_HaltChannel(channel: integer): integer; cdecl; external SDL_MixerLibName;
   333 function  Mix_HaltChannel(channel: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   334 
   334 
   335 (*  SDL_image *)
   335 (*  SDL_image *)
   336 
   336 
   337 const {$IFDEF WIN32}
   337 const {$IFDEF WIN32}
   338       SDL_ImageLibName = 'SDL_image.dll';
   338       SDL_ImageLibName = 'SDL_image.dll';
   358                   end;
   358                   end;
   359 
   359 
   360      PTCPSocket = ^TTCPSocket;
   360      PTCPSocket = ^TTCPSocket;
   361      TTCPSocket = record
   361      TTCPSocket = record
   362                   ready,
   362                   ready,
   363                   channel: integer;
   363                   channel: LongInt;
   364                   remoteAddress,
   364                   remoteAddress,
   365                   localAddress: TIPaddress;
   365                   localAddress: TIPaddress;
   366                   sflag: integer;
   366                   sflag: LongInt;
   367                   end;
   367                   end;
   368      PSDLNet_SocketSet = ^TSDLNet_SocketSet;
   368      PSDLNet_SocketSet = ^TSDLNet_SocketSet;
   369      TSDLNet_SocketSet = record
   369      TSDLNet_SocketSet = record
   370                          numsockets,
   370                          numsockets,
   371                          maxsockets: integer;
   371                          maxsockets: LongInt;
   372                          sockets: PTCPSocket;
   372                          sockets: PTCPSocket;
   373                          end;
   373                          end;
   374 
   374 
   375 function SDLNet_Init: integer; cdecl; external SDL_NetLibName;
   375 function SDLNet_Init: LongInt; cdecl; external SDL_NetLibName;
   376 procedure SDLNet_Quit; cdecl; external SDL_NetLibName;
   376 procedure SDLNet_Quit; cdecl; external SDL_NetLibName;
   377 
   377 
   378 function SDLNet_AllocSocketSet(maxsockets: integer): PSDLNet_SocketSet; cdecl; external SDL_NetLibName;
   378 function SDLNet_AllocSocketSet(maxsockets: LongInt): PSDLNet_SocketSet; cdecl; external SDL_NetLibName;
   379 function SDLNet_ResolveHost(var address: TIPaddress; host: PCHar; port: Word): integer; cdecl; external SDL_NetLibName;
   379 function SDLNet_ResolveHost(var address: TIPaddress; host: PCHar; port: Word): LongInt; cdecl; external SDL_NetLibName;
   380 function SDLNet_TCP_Accept(server: PTCPsocket): PTCPSocket; cdecl; external SDL_NetLibName;
   380 function SDLNet_TCP_Accept(server: PTCPsocket): PTCPSocket; cdecl; external SDL_NetLibName;
   381 function SDLNet_TCP_Open(var ip: TIPaddress): PTCPSocket; cdecl; external SDL_NetLibName;
   381 function SDLNet_TCP_Open(var ip: TIPaddress): PTCPSocket; cdecl; external SDL_NetLibName;
   382 function SDLNet_TCP_Send(sock: PTCPsocket; data: Pointer; len: integer): integer; cdecl; external SDL_NetLibName;
   382 function SDLNet_TCP_Send(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName;
   383 function SDLNet_TCP_Recv(sock: PTCPsocket; data: Pointer; len: integer): integer; cdecl; external SDL_NetLibName;
   383 function SDLNet_TCP_Recv(sock: PTCPsocket; data: Pointer; len: LongInt): LongInt; cdecl; external SDL_NetLibName;
   384 procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName;
   384 procedure SDLNet_TCP_Close(sock: PTCPsocket); cdecl; external SDL_NetLibName;
   385 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName;
   385 procedure SDLNet_FreeSocketSet(_set: PSDLNet_SocketSet); cdecl; external SDL_NetLibName;
   386 function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): integer; cdecl; external SDL_NetLibName;
   386 function SDLNet_AddSocket(_set: PSDLNet_SocketSet; sock: PTCPSocket): LongInt; cdecl; external SDL_NetLibName;
   387 function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: integer): integer; cdecl; external SDL_NetLibName;
   387 function SDLNet_CheckSockets(_set: PSDLNet_SocketSet; timeout: LongInt): LongInt; cdecl; external SDL_NetLibName;
   388 
   388 
   389 
   389 
   390 implementation
   390 implementation
   391 
   391 
   392 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   392 function SDL_MustLock(Surface: PSDL_Surface): Boolean;