hedgewars/SDLh.pas
branchhedgeroid
changeset 5824 2e5835130d9a
parent 5725 e27100a0e2d0
parent 5745 71e69623be39
child 5826 2a2cce052b4d
equal deleted inserted replaced
5733:5ab22736bdb6 5824:2e5835130d9a
    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}
   289     {* SDL_image *}
   289     {* SDL_image *}
   290     IMG_INIT_JPG = $00000001;
   290     IMG_INIT_JPG = $00000001;
   291     IMG_INIT_PNG = $00000002;
   291     IMG_INIT_PNG = $00000002;
   292     IMG_INIT_TIF = $00000004;
   292     IMG_INIT_TIF = $00000004;
   293 
   293 
       
   294     {* SDL_EventMask type definition *}
       
   295 {$IFNDEF SDL13}
       
   296     SDL_ALLEVENTS = $FFFFFFFF;
       
   297 {$ENDIF}
       
   298 
   294 /////////////////////////////////////////////////////////////////
   299 /////////////////////////////////////////////////////////////////
   295 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   300 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   296 /////////////////////////////////////////////////////////////////
   301 /////////////////////////////////////////////////////////////////
   297 
   302 
   298 type
   303 type
   357         AMask : Longword;
   362         AMask : Longword;
   358         colorkey: Longword;
   363         colorkey: Longword;
   359         alpha: Byte;
   364         alpha: Byte;
   360 {$ENDIF}
   365 {$ENDIF}
   361         end;
   366         end;
   362    
   367 
   363     SDL_eventaction = (SDL_ADDEVENT = 0, SDL_PEEPEVENT, SDL_GETEVENT);
   368     SDL_eventaction = (SDL_ADDEVENT = 0, SDL_PEEPEVENT, SDL_GETEVENT);
   364 
   369 
   365     PSDL_Surface = ^TSDL_Surface;
   370     PSDL_Surface = ^TSDL_Surface;
   366     TSDL_Surface = record
   371     TSDL_Surface = record
   367         flags : Longword;
   372         flags : Longword;
   486         state: byte;
   491         state: byte;
   487 {$IFDEF SDL13}
   492 {$IFDEF SDL13}
   488         type_: LongInt;
   493         type_: LongInt;
   489         windowID: LongInt;
   494         windowID: LongInt;
   490         padding1, padding2: byte;
   495         padding1, padding2: byte;
   491         x, y, z,xrel, yrel : LongInt;
   496         x, y, z, xrel, yrel : LongInt;
   492         pressure, pressure_max, pressure_min,
   497         pressure, pressure_max, pressure_min,
   493         rotation, tilt, cursor: LongInt;
   498         rotation, tilt, cursor: LongInt;
   494 {$ELSE}
   499 {$ELSE}
   495         type_: byte;
   500         type_: byte;
   496         x, y, xrel, yrel : word;
   501         x, y, xrel, yrel : word;
   640             //SDL_SYSWMEVENT,SDL_EVENT_RESERVEDA,SDL_EVENT_RESERVEDB
   645             //SDL_SYSWMEVENT,SDL_EVENT_RESERVEDA,SDL_EVENT_RESERVEDB
   641             SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent);
   646             SDL_VIDEORESIZE: (resize: TSDL_ResizeEvent);
   642 {$ENDIF}
   647 {$ENDIF}
   643         end;
   648         end;
   644 
   649 
       
   650 
       
   651     TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl;
       
   652 
       
   653     
   645     PByteArray = ^TByteArray;
   654     PByteArray = ^TByteArray;
   646     TByteArray = array[0..65535] of Byte;
   655     TByteArray = array[0..65535] of Byte;
   647     PLongWordArray = ^TLongWordArray;
   656     PLongWordArray = ^TLongWordArray;
   648     TLongWordArray = array[0..16383] of LongWord;
   657     TLongWordArray = array[0..16383] of LongWord;
   649 
   658 
   820 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   829 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   821 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   830 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   822 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   831 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   823 
   832 
   824 
   833 
   825 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName ;
   834 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
   826 
   835 function  SDL_SetHint(name, value: PChar): boolean; cdecl; external SDLLibName;
   827 function  SDL_SetHint(name, value: PChar): boolean; cdecl; external SDLLibName; 
       
   828 
   836 
   829 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongInt): LongInt; cdecl; external SDLLibName;
   837 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongInt): LongInt; cdecl; external SDLLibName;
   830 
   838 {$ELSE}
       
   839 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; mask: LongInt): LongInt; cdecl; external SDLLibName;
   831 {$ENDIF}
   840 {$ENDIF}
   832 
   841 
   833 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   842 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   834 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   843 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   835 
   844 
   836 procedure SDL_PumpEvents; cdecl; external SDLLibName;
   845 procedure SDL_PumpEvents; cdecl; external SDLLibName;
   837 function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   846 function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   838 function  SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
   847 function  SDL_WaitEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
       
   848 procedure SDL_SetEventFilter( filter : TSDL_EventFilter ); cdecl; external SDLLibName;
   839 
   849 
   840 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
   850 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
   841 
   851 
   842 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : byte); cdecl; external SDLLibName;
   852 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : byte); cdecl; external SDLLibName;
   843 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   853 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
   888 function  TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
   898 function  TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
   889 
   899 
   890 function  TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   900 function  TTF_RenderUTF8_Solid(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   891 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   901 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   892 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   902 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
       
   903 
   893 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   904 function  TTF_OpenFont(const filename: PChar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   894 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   905 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   895 
   906 
   896 (*  SDL_mixer  *)
   907 (*  SDL_mixer  *)
   897 function  Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName;
   908 function  Mix_Init(flags: LongInt): LongInt; cdecl; external SDL_MixerLibName;
  1018     SDLNet_Read32:=  PByteArray(buf)^[3] or
  1029     SDLNet_Read32:=  PByteArray(buf)^[3] or
  1019                   (PByteArray(buf)^[2] shl  8) or
  1030                   (PByteArray(buf)^[2] shl  8) or
  1020                   (PByteArray(buf)^[1] shl 16) or
  1031                   (PByteArray(buf)^[1] shl 16) or
  1021                   (PByteArray(buf)^[0] shl 24)
  1032                   (PByteArray(buf)^[0] shl 24)
  1022 end;
  1033 end;
       
  1034 
  1023 end.
  1035 end.
       
  1036