hedgewars/SDLh.pas
changeset 6072 e3dc802965d6
parent 6021 652a199d4f38
child 6224 42b256eca362
child 6280 3725cfec4542
equal deleted inserted replaced
6071:212e5a5eadeb 6072:e3dc802965d6
   226     SDL_SRCALPHA    = $00010000;
   226     SDL_SRCALPHA    = $00010000;
   227     SDL_ANYFORMAT   = $00100000;
   227     SDL_ANYFORMAT   = $00100000;
   228     SDL_HWPALETTE   = $20000000;
   228     SDL_HWPALETTE   = $20000000;
   229     SDL_DOUBLEBUF   = $40000000;
   229     SDL_DOUBLEBUF   = $40000000;
   230     SDL_FULLSCREEN  = $80000000;
   230     SDL_FULLSCREEN  = $80000000;
       
   231 
       
   232     SDL_ALLEVENTS = $FFFFFFFF;
   231 {$ENDIF}
   233 {$ENDIF}
   232 
   234 
   233 {$IFDEF ENDIAN_LITTLE}
   235 {$IFDEF ENDIAN_LITTLE}
   234     RMask = $000000FF;
   236     RMask = $000000FF;
   235     GMask = $0000FF00;
   237     GMask = $0000FF00;
   277     IMG_INIT_JPG = $00000001;
   279     IMG_INIT_JPG = $00000001;
   278     IMG_INIT_PNG = $00000002;
   280     IMG_INIT_PNG = $00000002;
   279     IMG_INIT_TIF = $00000004;
   281     IMG_INIT_TIF = $00000004;
   280 
   282 
   281     {* SDL_EventMask type definition *}
   283     {* SDL_EventMask type definition *}
   282 {$IFNDEF SDL13}
       
   283     SDL_ALLEVENTS = $FFFFFFFF;
       
   284 {$ENDIF}
       
   285 
   284 
   286 /////////////////////////////////////////////////////////////////
   285 /////////////////////////////////////////////////////////////////
   287 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   286 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   288 /////////////////////////////////////////////////////////////////
   287 /////////////////////////////////////////////////////////////////
   289 
   288 
   870 
   869 
   871 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   870 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   872 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   871 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   873 
   872 
   874 (*  SDL_mixer  *)
   873 (*  SDL_mixer  *)
   875 function  Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   874 function  Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF}
   876 procedure Mix_Quit; cdecl; external SDL_MixerLibName;
   875 procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName;{$ENDIF}
   877 
   876 
   878 function  Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   877 function  Mix_OpenAudio(frequency: LongInt; format: Word; channels: LongInt; chunksize: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   879 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName;
   878 procedure Mix_CloseAudio; cdecl; external SDL_MixerLibName;
   880 
   879 
   881 function  Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   880 function  Mix_Volume(channel: LongInt; volume: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   902 
   901 
   903 function  Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   902 function  Mix_FadeInChannelTimed(channel: LongInt; chunk: PMixChunk; loops: LongInt; fadems: LongInt; ticks: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   904 function  Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   903 function  Mix_FadeOutChannel(channel: LongInt; fadems: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   905 
   904 
   906 (*  SDL_image  *)
   905 (*  SDL_image  *)
   907 function  IMG_Init(flags: LongInt): LongInt; cdecl; external SDL_ImageLibName;
   906 function  IMG_Init(flags: LongInt): LongInt; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF}
   908 procedure IMG_Quit; cdecl; external SDL_ImageLibName;
   907 procedure IMG_Quit; {$IFDEF SDL_IMAGE_NEWER}cdecl; external SDL_ImageLibName;{$ENDIF}
   909 
   908 
   910 function  IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   909 function  IMG_Load(const _file: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   911 function  IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongInt): PSDL_Surface; cdecl; external SDL_ImageLibName;
   910 function  IMG_Load_RW(rwop: PSDL_RWops; freesrc: LongInt): PSDL_Surface; cdecl; external SDL_ImageLibName;
   912 function  IMG_LoadPNG_RW(rwop: PSDL_RWops): PSDL_Surface; cdecl; external SDL_ImageLibName;
   911 function  IMG_LoadPNG_RW(rwop: PSDL_RWops): PSDL_Surface; cdecl; external SDL_ImageLibName;
   913 function  IMG_LoadTyped_RW(rwop: PSDL_RWops; freesrc: LongInt; type_: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   912 function  IMG_LoadTyped_RW(rwop: PSDL_RWops; freesrc: LongInt; type_: PChar): PSDL_Surface; cdecl; external SDL_ImageLibName;
   962 end;
   961 end;
   963 {$ENDIF}
   962 {$ENDIF}
   964 
   963 
   965 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   964 function SDL_MustLock(Surface: PSDL_Surface): Boolean;
   966 begin
   965 begin
   967 {$IFDEF SDL13}
   966     SDL_MustLock:=
   968     SDL_MustLock:= ((surface^.flags and SDL_RLEACCEL) <> 0)
   967 {$IFDEF SDL13}
   969 {$ELSE}
   968         ((surface^.flags and SDL_RLEACCEL) <> 0)
   970     SDL_MustLock:= ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0)
   969 {$ELSE}
   971 {$ENDIF}
   970         ( surface^.offset <> 0 ) or (( surface^.flags and (SDL_HWSURFACE or SDL_ASYNCBLIT or SDL_RLEACCEL)) <> 0)
   972 end;
   971 {$ENDIF}
       
   972 end;
       
   973 
       
   974 {$IFNDEF SDL_MIXER_NEWER}
       
   975 function  Mix_Init(flags: LongInt): LongInt;
       
   976 begin
       
   977     exit(flags);
       
   978 end;
       
   979 
       
   980 procedure Mix_Quit;
       
   981 begin
       
   982 end;
       
   983 {$ENDIF}
       
   984 
       
   985 {$IFNDEF SDL_IMAGE_NEWER}
       
   986 function  IMG_Init(flags: LongInt): LongInt;
       
   987 begin
       
   988     exit(flags);
       
   989 end;
       
   990 
       
   991 procedure IMG_Quit;
       
   992 begin
       
   993 end;
       
   994 {$ENDIF}
   973 
   995 
   974 procedure SDLNet_Write16(value: Word; buf: pointer);
   996 procedure SDLNet_Write16(value: Word; buf: pointer);
   975 begin
   997 begin
   976     PByteArray(buf)^[1]:= value;
   998     PByteArray(buf)^[1]:= value;
   977     PByteArray(buf)^[0]:= value shr 8
   999     PByteArray(buf)^[0]:= value shr 8