hedgewars/SDLh.pas
branchhedgeroid
changeset 6224 42b256eca362
parent 6025 cac1d5601d7c
parent 6072 e3dc802965d6
child 6328 d14adf1c7721
equal deleted inserted replaced
6055:88cfcd9161d3 6224:42b256eca362
   231     SDL_SRCALPHA    = $00010000;
   231     SDL_SRCALPHA    = $00010000;
   232     SDL_ANYFORMAT   = $00100000;
   232     SDL_ANYFORMAT   = $00100000;
   233     SDL_HWPALETTE   = $20000000;
   233     SDL_HWPALETTE   = $20000000;
   234     SDL_DOUBLEBUF   = $40000000;
   234     SDL_DOUBLEBUF   = $40000000;
   235     SDL_FULLSCREEN  = $80000000;
   235     SDL_FULLSCREEN  = $80000000;
       
   236 
       
   237     SDL_ALLEVENTS = $FFFFFFFF;
   236 {$ENDIF}
   238 {$ENDIF}
   237 
   239 
   238 {$IFDEF ENDIAN_LITTLE}
   240 {$IFDEF ENDIAN_LITTLE}
   239     RMask = $000000FF;
   241     RMask = $000000FF;
   240     GMask = $0000FF00;
   242     GMask = $0000FF00;
   282     IMG_INIT_JPG = $00000001;
   284     IMG_INIT_JPG = $00000001;
   283     IMG_INIT_PNG = $00000002;
   285     IMG_INIT_PNG = $00000002;
   284     IMG_INIT_TIF = $00000004;
   286     IMG_INIT_TIF = $00000004;
   285 
   287 
   286     {* SDL_EventMask type definition *}
   288     {* SDL_EventMask type definition *}
   287 {$IFNDEF SDL13}
       
   288     SDL_ALLEVENTS = $FFFFFFFF;
       
   289 {$ENDIF}
       
   290 
   289 
   291 /////////////////////////////////////////////////////////////////
   290 /////////////////////////////////////////////////////////////////
   292 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   291 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   293 /////////////////////////////////////////////////////////////////
   292 /////////////////////////////////////////////////////////////////
   294 
   293 
   896 
   895 
   897 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   896 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   898 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   897 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   899 
   898 
   900 (*  SDL_mixer  *)
   899 (*  SDL_mixer  *)
   901 function  Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   900 function  Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF}
   902 procedure Mix_Quit; cdecl; external SDL_MixerLibName;
   901 procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF}
   903 
   902 
   904 function  Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   903 function  Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   905 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName;
   904 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName;
   906 
   905 
   907 function  Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   906 function  Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   928 
   927 
   929 function  Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   928 function  Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   930 function  Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   929 function  Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   931 
   930 
   932 (*  SDL_image  *)
   931 (*  SDL_image  *)
   933 function  IMG_Init(flags: LongInt): LongInt; cdecl; external SDL_ImageLibName;
   932 function  IMG_Init(flags: LongInt): LongInt; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF}
   934 procedure IMG_Quit; cdecl; external SDL_ImageLibName;
   933 procedure IMG_Quit; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF}
   935 
   934 
   936 function  IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   935 function  IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   937 function  IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongInt): PSDL_Surface; cdecl; external SDL_ImageLibName;
   936 function  IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongInt): PSDL_Surface; cdecl; external SDL_ImageLibName;
   938 function  IMG_LoadPNG_RW(rwop: PSDL_RWops): PSDL_Surface; cdecl; external SDL_ImageLibName;
   937 function  IMG_LoadPNG_RW(rwop: PSDL_RWops): PSDL_Surface; cdecl; external SDL_ImageLibName;
   939 function  IMG_LoadTyped_RW(rwop: PSDL_RWops; freesrc: LongInt; type_: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   938 function  IMG_LoadTyped_RW(rwop: PSDL_RWops; freesrc: LongInt; type_: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   988 end;
   987 end;
   989 {$ENDIF}
   988 {$ENDIF}
   990 
   989 
   991 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   990 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   992 begin
   991 begin
   993 {$IFDEF SDL13}
   992     SDL_MustLock:=
   994     SDL_MustLock:= ((surface^.flags and SDL_RLEACCEL) <> 0)
   993 {$IFDEF SDL13}
   995 {$ELSE}
   994         ((surface^.flags and SDL_RLEACCEL) <> 0)
   996     SDL_MustLock:= ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0)
   995 {$ELSE}
   997 {$ENDIF}
   996         ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0)
   998 end;
   997 {$ENDIF}
       
   998 end;
       
   999 
       
  1000 {$IFNDEF SDL_MIXER_NEWER}
       
  1001 function  Mix_Init(flags: LongInt): LongInt;
       
  1002 begin
       
  1003     exit(flags);
       
  1004 end;
       
  1005 
       
  1006 procedure Mix_Quit;
       
  1007 begin
       
  1008 end;
       
  1009 {$ENDIF}
       
  1010 
       
  1011 {$IFNDEF SDL_IMAGE_NEWER}
       
  1012 function  IMG_Init(flags: LongInt): LongInt;
       
  1013 begin
       
  1014     exit(flags);
       
  1015 end;
       
  1016 
       
  1017 procedure IMG_Quit;
       
  1018 begin
       
  1019 end;
       
  1020 {$ENDIF}
   999 
  1021 
  1000 procedure SDLNet_Write16(value: Word; buf: pointer);
  1022 procedure SDLNet_Write16(value: Word; buf: pointer);
  1001 begin
  1023 begin
  1002     PByteArray(buf)^[1]:= value;
  1024     PByteArray(buf)^[1]:= value;
  1003     PByteArray(buf)^[0]:= value shr 8
  1025     PByteArray(buf)^[0]:= value shr 8