hedgewars/SDLh.pas
branchhedgeroid
changeset 5286 22c1f4833a86
parent 5187 b01ab1ef01fb
child 5288 af34aeab55c9
equal deleted inserted replaced
5284:34abd278344e 5286:22c1f4833a86
    33 {$IFDEF HAIKU}
    33 {$IFDEF HAIKU}
    34   {$DEFINE UNIX}
    34   {$DEFINE UNIX}
    35 {$ENDIF}
    35 {$ENDIF}
    36 
    36 
    37 {$IFDEF UNIX}
    37 {$IFDEF UNIX}
    38   {$IFNDEF DARWIN}
    38   {$IFNDEF DARWIN}    
    39     {$linklib c}
    39     {$linklib c}
    40   {$ENDIF}
    40   {$ENDIF}
    41   {$IFDEF HAIKU}
    41   {$IFDEF HAIKU}
    42     {$linklib root}
    42     {$linklib root}
    43   {$ELSE}
    43   {$ELSE}
    44     {$linklib pthread}
    44     {$IFNDEF ANDROID}    
       
    45 	{$linklib pthread}
       
    46     {$ENDIF}
    45   {$ENDIF}
    47   {$ENDIF}
    46 {$ENDIF}
    48 {$ENDIF}
    47 
    49 
    48 {$IFDEF FPC}
    50 {$IFDEF FPC}
    49   {$PACKRECORDS C}
    51   {$PACKRECORDS C}
    72     SDL_TTFLibName = 'SDL_ttf.dll';
    74     SDL_TTFLibName = 'SDL_ttf.dll';
    73     SDL_MixerLibName = 'SDL_mixer.dll';
    75     SDL_MixerLibName = 'SDL_mixer.dll';
    74     SDL_ImageLibName = 'SDL_image.dll';
    76     SDL_ImageLibName = 'SDL_image.dll';
    75     SDL_NetLibName = 'SDL_net.dll';
    77     SDL_NetLibName = 'SDL_net.dll';
    76 {$ELSE}
    78 {$ELSE}
    77   {$IFDEF DARWIN}
    79   {$IFDEF DARWINN}
    78     SDLLibName = 'SDL';
    80     SDLLibName = 'SDL';
    79     SDL_TTFLibName = 'SDL_ttf';
    81     SDL_TTFLibName = 'SDL_ttf';
    80     SDL_MixerLibName = 'SDL_mixer';
    82     SDL_MixerLibName = 'SDL_mixer';
    81     SDL_ImageLibName = 'SDL_image';
    83     SDL_ImageLibName = 'SDL_image';
    82     SDL_NetLibName = 'SDL_net';
    84     SDL_NetLibName = 'SDL_net';
    83   {$ELSE}
    85   {$ELSE}
    84     SDLLibName = 'libSDL.so';
    86     {$IFDEF ANDROID}
    85     SDL_TTFLibName = 'libSDL_ttf.so';
    87         SDLLibName = 'SDL';
    86     SDL_MixerLibName = 'libSDL_mixer.so';
    88 	SDL_TTFLibName = 'libSDL_ttf.so';
    87     SDL_ImageLibName = 'libSDL_image.so';
    89 	SDL_MixerLibName = 'libSDL_mixer.so';
    88     SDL_NetLibName = 'libSDL_net.so';
    90 	SDL_ImageLibName = 'libSDL_image.so';
       
    91 	SDL_NetLibName = 'libSDL_net.so';
       
    92     {$ELSE}
       
    93         SDLLibName = 'SDL';
       
    94         SDL_TTFLibName = 'libSDL_ttf.so';
       
    95         SDL_MixerLibName = 'libSDL_mixer.so';
       
    96 	SDL_ImageLibName = 'libSDL_image.so';
       
    97 	SDL_NetLibName = 'libSDL_net.so';
       
    98     {$ENDIF}
    89   {$ENDIF}
    99   {$ENDIF}
    90 {$ENDIF}
   100 {$ENDIF}
    91 
   101 
    92 /////////////////////////////////////////////////////////////////
   102 /////////////////////////////////////////////////////////////////
    93 /////////////////////  CONSTANT DEFINITIONS /////////////////////
   103 /////////////////////  CONSTANT DEFINITIONS /////////////////////
   343         AMask : Longword;
   353         AMask : Longword;
   344         colorkey: Longword;
   354         colorkey: Longword;
   345         alpha: Byte;
   355         alpha: Byte;
   346 {$ENDIF}
   356 {$ENDIF}
   347         end;
   357         end;
   348 
   358    
       
   359     SDL_eventaction = (SDL_ADDEVENT = 0, SDL_PEEPEVENT, SDL_GETEVENT);
   349 
   360 
   350     PSDL_Surface = ^TSDL_Surface;
   361     PSDL_Surface = ^TSDL_Surface;
   351     TSDL_Surface = record
   362     TSDL_Surface = record
   352         flags : Longword;
   363         flags : Longword;
   353         format: PSDL_PixelFormat;
   364         format: PSDL_PixelFormat;
   471         state: byte;
   482         state: byte;
   472 {$IFDEF SDL13}
   483 {$IFDEF SDL13}
   473         type_: LongInt;
   484         type_: LongInt;
   474         windowID: LongInt;
   485         windowID: LongInt;
   475         padding1, padding2: byte;
   486         padding1, padding2: byte;
   476         x, y, z, xrel, yrel : LongInt;
   487         x, y, z,xrel, yrel : LongInt;
   477         pressure, pressure_max, pressure_min,
   488         pressure, pressure_max, pressure_min,
   478         rotation, tilt, cursor: LongInt;
   489         rotation, tilt, cursor: LongInt;
   479 {$ELSE}
   490 {$ELSE}
   480         type_: byte;
   491         type_: byte;
   481         x, y, xrel, yrel : word;
   492         x, y, xrel, yrel : word;
   782 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   793 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   783 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   794 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   784 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   795 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   785 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   796 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   786 
   797 
   787 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
   798 
   788 function  SDL_SetHint(name, value: PChar): boolean; cdecl; external SDLLibName;
   799 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName ;
       
   800 
       
   801 function  SDL_SetHint(name, value: PChar): boolean; cdecl; external SDLLibName; 
       
   802 
       
   803 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongInt): LongInt; cdecl; external SDLLibName;
       
   804 
   789 {$ENDIF}
   805 {$ENDIF}
   790 
   806 
   791 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   807 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   792 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   808 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   793 
   809 
   848 function  TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
   864 function  TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
   849 
   865 
   850 function  TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   866 function  TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   851 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   867 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   852 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   868 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   853 
   869 (*
       
   870 function  TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; 
       
   871 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface;
       
   872 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; 
       
   873 *)
   854 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   874 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   855 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   875 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   856 
   876 
   857 (*  SDL_mixer  *)
   877 (*  SDL_mixer  *)
   858 function  Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   878 function  Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   979     SDLNet_Read32:=  PByteArray(buf)^[3] or
   999     SDLNet_Read32:=  PByteArray(buf)^[3] or
   980                   (PByteArray(buf)^[2] shl  8) or
  1000                   (PByteArray(buf)^[2] shl  8) or
   981                   (PByteArray(buf)^[1] shl 16) or
  1001                   (PByteArray(buf)^[1] shl 16) or
   982                   (PByteArray(buf)^[0] shl 24)
  1002                   (PByteArray(buf)^[0] shl 24)
   983 end;
  1003 end;
   984 
  1004 (*
       
  1005 function TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface;
       
  1006 begin
       
  1007 TTF_RenderUTF8_Solid:= SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, RMask, GMask, BMask, AMask);
       
  1008 end;
       
  1009 function TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface;
       
  1010 begin
       
  1011 TTF_RenderUTF8_Blended:= SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, RMask, GMask, BMask, AMask);
       
  1012 end;
       
  1013 function TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface;
       
  1014 begin
       
  1015 TTF_RenderUTF8_Shaded:= SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, RMask, GMask, BMask, AMask);
       
  1016 end;*)
   985 end.
  1017 end.
   986