hedgewars/SDLh.pas
branchsdl2transition
changeset 11342 ed5a6478e710
parent 11338 7a7611adf715
parent 11151 5c40c65b619d
child 11343 9006e158a81f
equal deleted inserted replaced
11340:31570b766315 11342:ed5a6478e710
     1 (*
     1 (*
     2  * Hedgewars, a free turn based strategy game
     2  * Hedgewars, a free turn based strategy game
     3  * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * This program is free software; you can redistribute it and/or modify
     5  * This program is free software; you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation; version 2 of the License
     7  * the Free Software Foundation; version 2 of the License
     8  *
     8  *
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    12  * GNU General Public License for more details.
    13  *
    13  *
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    17  *)
    17  *)
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit SDLh;
    21 unit SDLh;
   233     KMOD_NUM    = $1000;
   233     KMOD_NUM    = $1000;
   234     KMOD_CAPS   = $2000;
   234     KMOD_CAPS   = $2000;
   235     KMOD_MODE   = $4000;
   235     KMOD_MODE   = $4000;
   236 
   236 
   237     {* SDL_mixer *}
   237     {* SDL_mixer *}
   238     MIX_MAX_VOLUME = 128;
   238     MIX_MAX_VOLUME      = 128;
   239     MIX_INIT_FLAC  = $00000001;
   239     MIX_INIT_FLAC       = $00000001;
   240     MIX_INIT_MOD   = $00000002;
   240     MIX_INIT_MOD        = $00000002;
   241     MIX_INIT_MP3   = $00000004;
   241     MIX_INIT_MODPLUG    = $00000004;
   242     MIX_INIT_OGG   = $00000008;
   242     MIX_INIT_MP3        = $00000008;
       
   243     MIX_INIT_OGG        = $00000010;
       
   244     MIX_INIT_FLUIDSYNTH = $00000020; 
   243 
   245 
   244     {* SDL_TTF *}
   246     {* SDL_TTF *}
   245     TTF_STYLE_NORMAL = 0;
   247     TTF_STYLE_NORMAL = 0;
   246     TTF_STYLE_BOLD   = 1;
   248     TTF_STYLE_BOLD   = 1;
   247     TTF_STYLE_ITALIC = 2;
   249     TTF_STYLE_ITALIC = 2;
   264 
   266 
   265     {* SDL_keysym *}
   267     {* SDL_keysym *}
   266     SDLK_BACKSPACE = 8;
   268     SDLK_BACKSPACE = 8;
   267     SDLK_RETURN    = 13;
   269     SDLK_RETURN    = 13;
   268     SDLK_ESCAPE    = 27;
   270     SDLK_ESCAPE    = 27;
       
   271     SDLK_a         = 97;
       
   272     SDLK_c         = 99;
   269     SDLK_q         = 113;
   273     SDLK_q         = 113;
       
   274     SDLK_v         = 118;
   270     SDLK_w         = 119;
   275     SDLK_w         = 119;
       
   276     SDLK_x         = 120;
   271     SDLK_DELETE    = 127;
   277     SDLK_DELETE    = 127;
   272     SDLK_KP_ENTER  = 271;
   278     SDLK_KP_ENTER  = 271;
   273     SDLK_UP        = 273;
   279     SDLK_UP        = 273;
   274     SDLK_DOWN      = 274;
   280     SDLK_DOWN      = 274;
   275     SDLK_RIGHT     = 275;
   281     SDLK_RIGHT     = 275;
   335         flags : LongWord;
   341         flags : LongWord;
   336         format: PSDL_PixelFormat;
   342         format: PSDL_PixelFormat;
   337         w, h  : LongInt;
   343         w, h  : LongInt;
   338         pitch : LongInt;
   344         pitch : LongInt;
   339         pixels: Pointer;
   345         pixels: Pointer;
   340         userdata: Pointer;
   346 {$IFDEF PAS2C}
   341         locked: LongInt;
   347         hwdata   : Pointer;
   342         lock_data: Pointer;
       
   343         clip_rect: TSDL_Rect;
   348         clip_rect: TSDL_Rect;
   344         map: Pointer;
   349         unsed1   : LongWord;
   345         refcount: LongInt;
   350         locked   : LongWord;
       
   351         map      : Pointer;
       
   352         format_version: Longword;
       
   353         refcount : LongInt;
       
   354         offset   : LongInt;
       
   355 {$ELSE}
       
   356         userdata  : Pointer;
       
   357         locked    : LongInt;
       
   358         lock_data : Pointer;
       
   359         clip_rect : TSDL_Rect;
       
   360         map       : Pointer;
       
   361         refcount  : LongInt;
       
   362 {$ENDIF}
   346         end;
   363         end;
   347 
   364 
   348 
   365 
   349     PSDL_Color = ^TSDL_Color;
   366     PSDL_Color = ^TSDL_Color;
   350     TSDL_Color = record
   367     TSDL_Color = record
   648 
   665 
   649     TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl;
   666     TSDL_EventFilter = function( event : PSDL_Event ): Integer; cdecl;
   650 
   667 
   651     TByteArray = array[0..65535] of Byte;
   668     TByteArray = array[0..65535] of Byte;
   652     PByteArray = ^TByteArray;
   669     PByteArray = ^TByteArray;
       
   670 
   653     TLongWordArray = array[0..16383] of LongWord;
   671     TLongWordArray = array[0..16383] of LongWord;
   654     PLongWordArray = ^TLongWordArray;
   672     PLongWordArray = ^TLongWordArray;
   655 
   673 
   656     PSDL_Thread = Pointer;
   674     PSDL_Thread = Pointer;
   657     PSDL_mutex = Pointer;
   675     PSDL_mutex = Pointer;
   904 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   922 function  TTF_RenderUTF8_Blended(font: PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   905 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   923 function  TTF_RenderUTF8_Shaded(font: PTTF_Font; const text: PChar; fg, bg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
   906 
   924 
   907 function  TTF_OpenFontRW(src: PSDL_RWops; freesrc: LongBool; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   925 function  TTF_OpenFontRW(src: PSDL_RWops; freesrc: LongBool; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
   908 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
   926 procedure TTF_SetFontStyle(font: PTTF_Font; style: LongInt); cdecl; external SDL_TTFLibName;
       
   927 procedure TTF_CloseFont(font: PTTF_Font); cdecl; external SDL_TTFLibName;
   909 
   928 
   910 (*  SDL_mixer  *)
   929 (*  SDL_mixer  *)
   911 function  Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF};
   930 function  Mix_Init(flags: LongInt): LongInt; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF};
   912 procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF};
   931 procedure Mix_Quit; {$IFDEF SDL_MIXER_NEWER}cdecl; external SDL_MixerLibName{$ELSE}inline{$ENDIF};
   913 
   932