hedgewars/SDLh.pas
changeset 14199 3c36a4e66c82
parent 13568 470982c05f7e
child 14808 9443dc6663ba
equal deleted inserted replaced
14198:73c5ba3aac45 14199:3c36a4e66c82
    57 {$ENDIF}
    57 {$ENDIF}
    58 
    58 
    59 
    59 
    60 (*  SDL  *)
    60 (*  SDL  *)
    61 const
    61 const
    62 {$IFDEF WIN32}
    62 {$IFDEF WINDOWS}
    63     SDLLibName = 'SDL2.dll';
    63     SDLLibName = 'SDL2.dll';
    64     SDL_TTFLibName = 'SDL2_ttf.dll';
    64     SDL_TTFLibName = 'SDL2_ttf.dll';
    65     SDL_MixerLibName = 'SDL2_mixer.dll';
    65     SDL_MixerLibName = 'SDL2_mixer.dll';
    66     SDL_ImageLibName = 'SDL2_image.dll';
    66     SDL_ImageLibName = 'SDL2_image.dll';
    67     SDL_NetLibName = 'SDL2_net.dll';
    67     SDL_NetLibName = 'SDL2_net.dll';
   655         readMethod, assetFileDescriptor: Pointer;
   655         readMethod, assetFileDescriptor: Pointer;
   656         position, size, offset: Int64;
   656         position, size, offset: Int64;
   657         fd: LongInt;
   657         fd: LongInt;
   658         end;
   658         end;
   659 {$ELSE}
   659 {$ELSE}
   660 {$IFDEF WIN32}
   660 {$IFDEF WINDOWS}
   661     TWinbuffer = record
   661     TWinbuffer = record
   662         data: Pointer;
   662         data: Pointer;
   663         size, left: LongInt;
   663         size, left: LongInt;
   664         end;
   664         end;
   665     TWindowsio = record
   665     TWindowsio = record
   679         type_: LongWord;
   679         type_: LongWord;
   680         case Byte of
   680         case Byte of
   681 {$IFDEF ANDROID}
   681 {$IFDEF ANDROID}
   682             0: (androidio: TAndroidio);
   682             0: (androidio: TAndroidio);
   683 {$ELSE}
   683 {$ELSE}
   684 {$IFDEF WIN32}
   684 {$IFDEF WINDOWS}
   685             0: (windowsio: TWindowsio);
   685             0: (windowsio: TWindowsio);
   686 {$ENDIF}
   686 {$ENDIF}
   687 {$ENDIF}
   687 {$ENDIF}
   688             1: (stdio: TStdio);     // assumes HAVE_STDIO_H
   688             1: (stdio: TStdio);     // assumes HAVE_STDIO_H
   689             2: (mem: TMem);
   689             2: (mem: TMem);
  1021                         numsockets,
  1021                         numsockets,
  1022                         maxsockets: LongInt;
  1022                         maxsockets: LongInt;
  1023                         sockets: PTCPSocket;
  1023                         sockets: PTCPSocket;
  1024                         end;
  1024                         end;
  1025 
  1025 
  1026 {$IFDEF WIN32}
  1026 {$IFDEF WINDOWS}
  1027      TThreadFunction = function (p: pointer): Longword; stdcall;
  1027      TThreadFunction = function (p: pointer): Longword; stdcall;
  1028      pfnSDL_CurrentBeginThread = function (
  1028      pfnSDL_CurrentBeginThread = function (
  1029         _Security: pointer; 
  1029         _Security: pointer; 
  1030         _StackSize: LongWord;
  1030         _StackSize: LongWord;
  1031         _StartAddress: TThreadFunction;
  1031         _StartAddress: TThreadFunction;
  1143 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
  1143 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
  1144 
  1144 
  1145 
  1145 
  1146 (* remember to mark the threaded functions as 'cdecl; export;'
  1146 (* remember to mark the threaded functions as 'cdecl; export;'
  1147    (or have fun debugging nil arguments) *)
  1147    (or have fun debugging nil arguments) *)
  1148 {$IFDEF WIN32}
  1148 {$IFDEF WINDOWS}
  1149 // SDL uses wrapper in windows
  1149 // SDL uses wrapper in windows
  1150 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer; bt: pfnSDL_CurrentBeginThread; et: pfnSDL_CurrentEndThread): PSDL_Thread; cdecl; external SDLLibName;
  1150 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer; bt: pfnSDL_CurrentBeginThread; et: pfnSDL_CurrentEndThread): PSDL_Thread; cdecl; external SDLLibName;
  1151 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; overload;
  1151 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; overload;
  1152 {$ELSE}
  1152 {$ELSE}
  1153 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
  1153 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
  1181 function  SDL_JoystickGetBall(joy: PSDL_Joystick; ball: LongInt; dx: PInteger; dy: PInteger): Word; cdecl; external SDLLibName;
  1181 function  SDL_JoystickGetBall(joy: PSDL_Joystick; ball: LongInt; dx: PInteger; dy: PInteger): Word; cdecl; external SDLLibName;
  1182 function  SDL_JoystickGetHat(joy: PSDL_Joystick; hat: LongInt): Byte; cdecl; external SDLLibName;
  1182 function  SDL_JoystickGetHat(joy: PSDL_Joystick; hat: LongInt): Byte; cdecl; external SDLLibName;
  1183 function  SDL_JoystickGetButton(joy: PSDL_Joystick; button: LongInt): Byte; cdecl; external SDLLibName;
  1183 function  SDL_JoystickGetButton(joy: PSDL_Joystick; button: LongInt): Byte; cdecl; external SDLLibName;
  1184 procedure SDL_JoystickClose(joy: PSDL_Joystick); cdecl; external SDLLibName;
  1184 procedure SDL_JoystickClose(joy: PSDL_Joystick); cdecl; external SDLLibName;
  1185 
  1185 
  1186 {$IFDEF WIN32}
  1186 {$IFDEF WINDOWS}
  1187 function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName;
  1187 function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName;
  1188 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName;
  1188 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName;
  1189 {$ENDIF}
  1189 {$ENDIF}
  1190 
  1190 
  1191 
  1191 
  1319                   (PByteArray(buf)^[2] shl  8) or
  1319                   (PByteArray(buf)^[2] shl  8) or
  1320                   (PByteArray(buf)^[1] shl 16) or
  1320                   (PByteArray(buf)^[1] shl 16) or
  1321                   (PByteArray(buf)^[0] shl 24)
  1321                   (PByteArray(buf)^[0] shl 24)
  1322 end;
  1322 end;
  1323 
  1323 
  1324 {$IFDEF WIN32}
  1324 {$IFDEF WINDOWS}
  1325 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl;
  1325 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl;
  1326 begin
  1326 begin
  1327     SDL_CreateThread:= SDL_CreateThread(fn, name, data, nil, nil)
  1327     SDL_CreateThread:= SDL_CreateThread(fn, name, data, nil, nil)
  1328 end;  
  1328 end;  
  1329 {$ENDIF}
  1329 {$ENDIF}