hedgewars/SDLh.pas
changeset 107 b08ce0293a51
parent 106 98cb6606bf67
child 109 ab0340f580c2
equal deleted inserted replaced
106:98cb6606bf67 107:b08ce0293a51
   115                     flags : Longword;
   115                     flags : Longword;
   116                     format: PSDL_PixelFormat;
   116                     format: PSDL_PixelFormat;
   117                     w, h  : integer;
   117                     w, h  : integer;
   118                     pitch : Word;
   118                     pitch : Word;
   119                     pixels: Pointer;
   119                     pixels: Pointer;
   120                     offset: LongInt;
   120                     offset: integer;
   121                     end;
   121                     end;
   122 
   122 
   123      PSDL_Color = ^TSDL_Color;
   123      PSDL_Color = ^TSDL_Color;
   124      TSDL_Color = record
   124      TSDL_Color = record
   125                   r: Byte;
   125                   r: Byte;
   190      TByteArray = array[0..32767] of Byte;
   190      TByteArray = array[0..32767] of Byte;
   191 
   191 
   192      PSDL_Thread = Pointer;
   192      PSDL_Thread = Pointer;
   193      PSDL_mutex = Pointer;
   193      PSDL_mutex = Pointer;
   194 
   194 
   195 function  SDL_Init(flags: Longword): LongInt; cdecl; external SDLLibName;
   195 function  SDL_Init(flags: Longword): integer; cdecl; external SDLLibName;
   196 procedure SDL_Quit; cdecl; external SDLLibName;
   196 procedure SDL_Quit; cdecl; external SDLLibName;
   197 
   197 
   198 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
   198 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
   199 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
   199 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
   200 
   200 
   201 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
   201 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
   202 function  SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   202 function  SDL_LockSurface(Surface: PSDL_Surface): integer; cdecl; external SDLLibName;
   203 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   203 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   204 
   204 
   205 function  SDL_GetError: PChar; cdecl; external SDLLibName;
   205 function  SDL_GetError: PChar; cdecl; external SDLLibName;
   206 
   206 
   207 function  SDL_SetVideoMode(width, height, bpp: LongInt; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
   207 function  SDL_SetVideoMode(width, height, bpp: integer; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
   208 function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   208 function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   209 function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   209 function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
   210 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   210 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
   211 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName;
   211 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName;
   212 
   212 
   213 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   213 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   214 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName;
   214 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName;
   215 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName;
   215 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName;
   216 function  SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName;
   216 function  SDL_Flip(Screen: PSDL_Surface): integer; cdecl; external SDLLibName;
   217 
   217 
   218 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
   218 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
   219 function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): LongInt; cdecl; external SDLLibName;
   219 function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName;
   220 
   220 
   221 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   221 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   222 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   222 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
   223 
   223 
   224 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   224 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   225 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   225 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: integer): integer; cdecl; external SDLLibName;
   226 
   226 
   227 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   227 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   228 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   228 function  SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName;
   229 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   229 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   230 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
   230 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
   231 
   231 
   232 function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   232 function  SDL_PollEvent(event: PSDL_Event): integer; cdecl; external SDLLibName;
   233 
   233 
   234 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
   234 function  SDL_ShowCursor(toggle: integer): integer; cdecl; external SDLLibName;
   235 
   235 
   236 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   236 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   237 
   237 
   238 function  SDL_CreateThread(fn: pointer; data: pointer): PSDL_Thread; cdecl; external SDLLibName;
   238 function  SDL_CreateThread(fn: pointer; data: pointer): PSDL_Thread; cdecl; external SDLLibName;
   239 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
   239 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
   240 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
   240 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
   241 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
   241 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
   242 function  SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP';
   242 function  SDL_LockMutex(mutex: PSDL_mutex): integer; cdecl; external SDLLibName name 'SDL_mutexP';
   243 function  SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV';
   243 function  SDL_UnlockMutex(mutex: PSDL_mutex): integer; cdecl; external SDLLibName name 'SDL_mutexV';
   244 
   244 
   245 (*  TTF  *)
   245 (*  TTF  *)
   246 
   246 
   247 const {$IFDEF WIN32}
   247 const {$IFDEF WIN32}
   248       SDL_TTFLibName = 'SDL_ttf.dll';
   248       SDL_TTFLibName = 'SDL_ttf.dll';
   258 
   258 
   259 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName;
   259 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName;
   260 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
   260 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
   261 
   261 
   262 
   262 
   263 function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
   263 function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: integer): LongInt; cdecl; external SDL_TTFLibName;
   264 function TTF_RenderUTF8_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   264 function TTF_RenderUTF8_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   265 function TTF_RenderUTF8_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   265 function TTF_RenderUTF8_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   266 function TTF_OpenFont(const filename: Pchar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   266 function TTF_OpenFont(const filename: Pchar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName;
   267 
   267 
   268 (*  SDL_mixer *)
   268 (*  SDL_mixer *)
   269 
   269 
   270 const {$IFDEF WIN32}
   270 const {$IFDEF WIN32}
   271       SDL_MixerLibName = 'SDL_mixer.dll';
   271       SDL_MixerLibName = 'SDL_mixer.dll';