hedgewars/SDLh.pas
branchqmlfrontend
changeset 11549 b69f5f22a3ba
parent 11420 05cf35103206
parent 11538 3189bf281000
child 11704 83c40c1eb0e7
equal deleted inserted replaced
11486:caa1e84c3ac2 11549:b69f5f22a3ba
    86     //SDL_INIT_EVERYTHING                // unsafe, init subsystems one at a time
    86     //SDL_INIT_EVERYTHING                // unsafe, init subsystems one at a time
    87 
    87 
    88     SDL_ALLEVENTS        = $FFFFFFFF;    // dummy event type to prevent stack corruption
    88     SDL_ALLEVENTS        = $FFFFFFFF;    // dummy event type to prevent stack corruption
    89     SDL_APPINPUTFOCUS    = $02;
    89     SDL_APPINPUTFOCUS    = $02;
    90 
    90 
       
    91     // (some) audio formats from SDL_audio.h
       
    92     AUDIO_S16LSB         = $8010; // Signed 16-bit samples, in little-endian byte order
       
    93     AUDIO_S16MSB         = $9010; // Signed 16-bit samples, in big-endian byte order
       
    94     AUDIO_S16SYS         = {$IFDEF ENDIAN_LITTLE}AUDIO_S16LSB{$ELSE}AUDIO_S16MSB{$ENDIF};
       
    95 
       
    96     // default audio format from SDL_mixer.h
       
    97     MIX_DEFAULT_FORMAT   = AUDIO_S16SYS;
       
    98 
    91     SDL_BUTTON_LEFT      = 1;
    99     SDL_BUTTON_LEFT      = 1;
    92     SDL_BUTTON_MIDDLE    = 2;
   100     SDL_BUTTON_MIDDLE    = 2;
    93     SDL_BUTTON_RIGHT     = 3;
   101     SDL_BUTTON_RIGHT     = 3;
    94     SDL_BUTTON_WHEELUP   = 4;
   102     SDL_BUTTON_X1        = 4;
    95     SDL_BUTTON_WHEELDOWN = 5;
   103     SDL_BUTTON_X2        = 5;
    96 
   104 
    97 
   105 
    98     SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
   106     SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
    99     SDL_TEXTINPUTEVENT_TEXT_SIZE   = 32;
   107     SDL_TEXTINPUTEVENT_TEXT_SIZE   = 32;
   100 
   108 
  1006                         numsockets,
  1014                         numsockets,
  1007                         maxsockets: LongInt;
  1015                         maxsockets: LongInt;
  1008                         sockets: PTCPSocket;
  1016                         sockets: PTCPSocket;
  1009                         end;
  1017                         end;
  1010 
  1018 
       
  1019 {$IFDEF WIN32}
       
  1020      TThreadFunction = function (p: pointer): Longword; stdcall;
       
  1021      pfnSDL_CurrentBeginThread = function (
       
  1022         _Security: pointer; 
       
  1023         _StackSize: LongWord;
       
  1024         _StartAddress: TThreadFunction;
       
  1025         _ArgList: pointer;
       
  1026         _InitFlag: Longword;
       
  1027         _ThrdAddr: PLongword): PtrUInt; cdecl;
       
  1028     pfnSDL_CurrentEndThread = procedure (_Retval: LongInt); cdecl;
       
  1029 {$ENDIF} 
  1011 
  1030 
  1012 /////////////////////////////////////////////////////////////////
  1031 /////////////////////////////////////////////////////////////////
  1013 /////////////////////  FUNCTION DEFINITIONS /////////////////////
  1032 /////////////////////  FUNCTION DEFINITIONS /////////////////////
  1014 /////////////////////////////////////////////////////////////////
  1033 /////////////////////////////////////////////////////////////////
  1015 
  1034 
  1058 procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; external SDLLibName;
  1077 procedure SDL_SetWindowIcon(window: PSDL_Window; icon: PSDL_Surface); cdecl; external SDLLibName;
  1059 
  1078 
  1060 function  SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName;
  1079 function  SDL_CreateRenderer(window: PSDL_Window; index: LongInt; flags: LongWord): PSDL_Renderer; cdecl; external SDLLibName;
  1061 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
  1080 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
  1062 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
  1081 function  SDL_DestroyRenderer(renderer: PSDL_Renderer): LongInt; cdecl; external SDLLibName;
       
  1082 procedure SDL_SetWindowPosition(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName;
  1063 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName;
  1083 procedure SDL_SetWindowSize(window: PSDL_Window; w, h: LongInt); cdecl; external SDLLibName;
       
  1084 procedure SDL_SetWindowFullscreen(window: PSDL_Window; flags: LongWord); cdecl; external SDLLibName;
  1064 function  SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName;
  1085 function  SDL_GetCurrentVideoDriver:Pchar; cdecl; external SDLLibName;
  1065 
  1086 
  1066 function  SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; external SDLLibName;
  1087 function  SDL_GL_CreateContext(window: PSDL_Window): PSDL_GLContext; cdecl; external SDLLibName;
  1067 procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; external SDLLibName;
  1088 procedure SDL_GL_DeleteContext(context: PSDL_GLContext); cdecl; external SDLLibName;
  1068 procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; external SDLLibName;
  1089 procedure SDL_GL_SwapWindow(window: PSDL_Window); cdecl; external SDLLibName;
  1115 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
  1136 function  SDL_WM_ToggleFullScreen(surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
  1116 
  1137 
  1117 
  1138 
  1118 (* remember to mark the threaded functions as 'cdecl; export;'
  1139 (* remember to mark the threaded functions as 'cdecl; export;'
  1119    (or have fun debugging nil arguments) *)
  1140    (or have fun debugging nil arguments) *)
       
  1141 {$IFDEF WIN32}
       
  1142 // SDL uses wrapper in windows
       
  1143 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer; bt: pfnSDL_CurrentBeginThread; et: pfnSDL_CurrentEndThread): PSDL_Thread; cdecl; external SDLLibName;
       
  1144 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; overload;
       
  1145 {$ELSE}
  1120 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
  1146 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
       
  1147 {$ENDIF}
  1121 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
  1148 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
  1122 procedure SDL_DetachThread(thread: PSDL_Thread); cdecl; external SDLLibName;
  1149 procedure SDL_DetachThread(thread: PSDL_Thread); cdecl; external SDLLibName;
  1123 
  1150 
  1124 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
  1151 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
  1125 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
  1152 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
  1302                   (PByteArray(buf)^[2] shl  8) or
  1329                   (PByteArray(buf)^[2] shl  8) or
  1303                   (PByteArray(buf)^[1] shl 16) or
  1330                   (PByteArray(buf)^[1] shl 16) or
  1304                   (PByteArray(buf)^[0] shl 24)
  1331                   (PByteArray(buf)^[0] shl 24)
  1305 end;
  1332 end;
  1306 
  1333 
       
  1334 {$IFDEF WIN32}
       
  1335 function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl;
       
  1336 begin
       
  1337     SDL_CreateThread:= SDL_CreateThread(fn, name, data, nil, nil)
       
  1338 end;  
       
  1339 {$ENDIF}
  1307 
  1340 
  1308 end.
  1341 end.
  1309 
  1342