hedgewars/SDLh.pas
changeset 3697 d5b30d6373fc
parent 3668 3f7a95234d8a
child 3701 8c449776ebe6
equal deleted inserted replaced
3695:c11abf387a7d 3697:d5b30d6373fc
    94 /////////////////////////////////////////////////////////////////
    94 /////////////////////////////////////////////////////////////////
    95 
    95 
    96     SDL_SWSURFACE     = $00000000;
    96     SDL_SWSURFACE     = $00000000;
    97     SDL_HWSURFACE     = $00000001;
    97     SDL_HWSURFACE     = $00000001;
    98     SDL_SRCALPHA      = $00010000;
    98     SDL_SRCALPHA      = $00010000;
    99     
    99 
   100     SDL_INIT_TIMER    = $00000001;
   100     SDL_INIT_TIMER    = $00000001;
   101     SDL_INIT_AUDIO    = $00000010;
   101     SDL_INIT_AUDIO    = $00000010;
   102     SDL_INIT_VIDEO    = $00000020;
   102     SDL_INIT_VIDEO    = $00000020;
   103     SDL_INIT_JOYSTICK = $00000200;
   103     SDL_INIT_JOYSTICK = $00000200;
   104 {$IFDEF SDL13}
   104 {$IFDEF SDL13}
   154     SDL_JOYBUTTONUP = 11;
   154     SDL_JOYBUTTONUP = 11;
   155     SDL_QUITEV = 12;
   155     SDL_QUITEV = 12;
   156     SDL_VIDEORESIZE = 16; // TODO: outdated? no longer in SDL 1.3?
   156     SDL_VIDEORESIZE = 16; // TODO: outdated? no longer in SDL 1.3?
   157 {$ENDIF}
   157 {$ENDIF}
   158 {*end SDL_Event binding*}
   158 {*end SDL_Event binding*}
   159         
   159 
   160 {$IFDEF SDL13}
   160 {$IFDEF SDL13}
   161     SDL_ASYNCBLIT   = $08000000;
   161     SDL_ASYNCBLIT   = $08000000;
   162     SDL_ANYFORMAT   = $10000000;
   162     SDL_ANYFORMAT   = $10000000;
   163     SDL_HWPALETTE   = $00200000;
   163     SDL_HWPALETTE   = $00200000;
   164     SDL_DOUBLEBUF   = $00400000;
   164     SDL_DOUBLEBUF   = $00400000;
   207     SDL_WINDOW_MAXIMIZED = $00000040;          //*< window is maximized */
   207     SDL_WINDOW_MAXIMIZED = $00000040;          //*< window is maximized */
   208     SDL_WINDOW_INPUT_GRABBED = $00000100;      //*< window has grabbed input focus */
   208     SDL_WINDOW_INPUT_GRABBED = $00000100;      //*< window has grabbed input focus */
   209     SDL_WINDOW_INPUT_FOCUS = $00000200;        //*< window has input focus */
   209     SDL_WINDOW_INPUT_FOCUS = $00000200;        //*< window has input focus */
   210     SDL_WINDOW_MOUSE_FOCUS = $00000400;        //*< window has mouse focus */
   210     SDL_WINDOW_MOUSE_FOCUS = $00000400;        //*< window has mouse focus */
   211     SDL_WINDOW_FOREIGN = $00000800;            //*< window not created by SDL */
   211     SDL_WINDOW_FOREIGN = $00000800;            //*< window not created by SDL */
   212     
   212 
   213     // SDL_WindowEventID (enum)
   213     // SDL_WindowEventID (enum)
   214     SDL_WINDOWEVENT_NONE = 0;            //*< Never used
   214     SDL_WINDOWEVENT_NONE = 0;            //*< Never used
   215     SDL_WINDOWEVENT_SHOWN = 1;           //*< Window has been shown
   215     SDL_WINDOWEVENT_SHOWN = 1;           //*< Window has been shown
   216     SDL_WINDOWEVENT_HIDDEN = 2;          //*< Window has been hidden
   216     SDL_WINDOWEVENT_HIDDEN = 2;          //*< Window has been hidden
   217     SDL_WINDOWEVENT_EXPOSED = 3;         //*< Window has been exposed and should be redrawn 
   217     SDL_WINDOWEVENT_EXPOSED = 3;         //*< Window has been exposed and should be redrawn
   218     SDL_WINDOWEVENT_MOVED = 4;           //*< Window has been moved to data1, data2
   218     SDL_WINDOWEVENT_MOVED = 4;           //*< Window has been moved to data1, data2
   219     SDL_WINDOWEVENT_RESIZED = 5;         //*< Window size changed to data1xdata2
   219     SDL_WINDOWEVENT_RESIZED = 5;         //*< Window size changed to data1xdata2
   220     SDL_WINDOWEVENT_MINIMIZED = 6;       //*< Window has been minimized
   220     SDL_WINDOWEVENT_MINIMIZED = 6;       //*< Window has been minimized
   221     SDL_WINDOWEVENT_MAXIMIZED = 7;       //*< Window has been maximized
   221     SDL_WINDOWEVENT_MAXIMIZED = 7;       //*< Window has been maximized
   222     SDL_WINDOWEVENT_RESTORED = 8;        //*< Window has been restored to normal size and position
   222     SDL_WINDOWEVENT_RESTORED = 8;        //*< Window has been restored to normal size and position
   231     MIX_MAX_VOLUME = 128;
   231     MIX_MAX_VOLUME = 128;
   232     MIX_INIT_FLAC = $00000001;
   232     MIX_INIT_FLAC = $00000001;
   233     MIX_INIT_MOD  = $00000002;
   233     MIX_INIT_MOD  = $00000002;
   234     MIX_INIT_MP3  = $00000004;
   234     MIX_INIT_MP3  = $00000004;
   235     MIX_INIT_OGG  = $00000008;
   235     MIX_INIT_OGG  = $00000008;
   236     
   236 
   237     {* SDL_TTF *}
   237     {* SDL_TTF *}
   238     TTF_STYLE_NORMAL = 0;
   238     TTF_STYLE_NORMAL = 0;
   239     TTF_STYLE_BOLD   = 1;
   239     TTF_STYLE_BOLD   = 1;
   240     TTF_STYLE_ITALIC = 2;
   240     TTF_STYLE_ITALIC = 2;
   241 
   241 
   257 
   257 
   258 /////////////////////////////////////////////////////////////////
   258 /////////////////////////////////////////////////////////////////
   259 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   259 ///////////////////////  TYPE DEFINITIONS ///////////////////////
   260 /////////////////////////////////////////////////////////////////
   260 /////////////////////////////////////////////////////////////////
   261 
   261 
   262 type 
   262 type
   263     PSDL_Rect = ^TSDL_Rect;
   263     PSDL_Rect = ^TSDL_Rect;
   264     TSDL_Rect = record
   264     TSDL_Rect = record
   265 {$IFDEF SDL13}
   265 {$IFDEF SDL13}
   266         x, y, w, h: LongInt;
   266         x, y, w, h: LongInt;
   267 {$ELSE}
   267 {$ELSE}
   355 
   355 
   356 
   356 
   357 {* SDL_Event type definition *}
   357 {* SDL_Event type definition *}
   358 
   358 
   359 {$IFDEF SDL13}
   359 {$IFDEF SDL13}
   360     PSDL_Window = pointer;  
   360     PSDL_Window = pointer;
   361     PSDL_Texture = pointer;
   361     PSDL_Texture = pointer;
   362     
   362 
   363     TSDL_WindowEvent = record
   363     TSDL_WindowEvent = record
   364         type_: LongInt;
   364         type_: LongInt;
   365         windowID: LongInt;
   365         windowID: LongInt;
   366         event: byte;
   366         event: byte;
   367         padding1, padding2, padding3: byte;
   367         padding1, padding2, padding3: byte;
   368         data1, data2: LongInt;
   368         data1, data2: LongInt;
   369         end;
   369         end;
   370         
   370 
   371     TSDL_KeySym = record
   371     TSDL_KeySym = record
   372         scancode,
   372         scancode,
   373         sym,
   373         sym,
   374         modifier,
   374         modifier,
   375         unicode: LongInt;
   375         unicode: LongInt;
   405         type_: LongInt;
   405         type_: LongInt;
   406         windowID: LongInt;
   406         windowID: LongInt;
   407         padding1, padding2: byte;
   407         padding1, padding2: byte;
   408         x, y, z, xrel, yrel : LongInt;
   408         x, y, z, xrel, yrel : LongInt;
   409         pressure, pressure_max, pressure_min,
   409         pressure, pressure_max, pressure_min,
   410         rotation, tilt, cursor: LongInt; 
   410         rotation, tilt, cursor: LongInt;
   411 {$ELSE}
   411 {$ELSE}
   412         type_: byte;
   412         type_: byte;
   413         x, y, xrel, yrel : word;
   413         x, y, xrel, yrel : word;
   414 {$ENDIF}
   414 {$ENDIF}
   415         end;
   415         end;
   448         windowID: LongInt;
   448         windowID: LongInt;
   449         which: Byte;
   449         which: Byte;
   450         x, y: LongInt;
   450         x, y: LongInt;
   451         padding1, padding2, padding3: byte;
   451         padding1, padding2, padding3: byte;
   452         end;
   452         end;
   453         
   453 
   454     // implement SDL_ProximityEvent
   454     // implement SDL_ProximityEvent
   455 {$ENDIF}
   455 {$ENDIF}
   456 
   456 
   457     TSDL_JoyAxisEvent = record
   457     TSDL_JoyAxisEvent = record
   458 {$IFDEF SDL13}
   458 {$IFDEF SDL13}
   464         axis: Byte;
   464         axis: Byte;
   465 {$IFDEF SDL13}
   465 {$IFDEF SDL13}
   466         value: LongInt;
   466         value: LongInt;
   467 {$ELSE}
   467 {$ELSE}
   468         value: word;
   468         value: word;
   469 {$ENDIF}    
   469 {$ENDIF}
   470         end;
   470         end;
   471             
   471 
   472     TSDL_JoyBallEvent = record
   472     TSDL_JoyBallEvent = record
   473         which: Byte;
   473         which: Byte;
   474         ball: Byte;
   474         ball: Byte;
   475 {$IFDEF SDL13}
   475 {$IFDEF SDL13}
   476         type_: LongInt;
   476         type_: LongInt;
   489 {$ENDIF}
   489 {$ENDIF}
   490         which: Byte;
   490         which: Byte;
   491         hat: Byte;
   491         hat: Byte;
   492         value: Byte;
   492         value: Byte;
   493         end;
   493         end;
   494     
   494 
   495     TSDL_JoyButtonEvent = record
   495     TSDL_JoyButtonEvent = record
   496 {$IFDEF SDL13}
   496 {$IFDEF SDL13}
   497         type_: LongInt;
   497         type_: LongInt;
   498 {$ELSE}
   498 {$ELSE}
   499         type_: Byte;
   499         type_: Byte;
   584         SDL_GL_SWAP_CONTROL
   584         SDL_GL_SWAP_CONTROL
   585 {$ENDIF}
   585 {$ENDIF}
   586         );
   586         );
   587 
   587 
   588 {$IFDEF SDL13}
   588 {$IFDEF SDL13}
   589     TSDL_ArrayByteOrder = (  // array component order, low byte -> high byte 
   589     TSDL_ArrayByteOrder = (  // array component order, low byte -> high byte
   590         SDL_ARRAYORDER_NONE,
   590         SDL_ARRAYORDER_NONE,
   591         SDL_ARRAYORDER_RGB,
   591         SDL_ARRAYORDER_RGB,
   592         SDL_ARRAYORDER_RGBA,
   592         SDL_ARRAYORDER_RGBA,
   593         SDL_ARRAYORDER_ARGB,
   593         SDL_ARRAYORDER_ARGB,
   594         SDL_ARRAYORDER_BGR,
   594         SDL_ARRAYORDER_BGR,
   700 
   700 
   701 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   701 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   702 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   702 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   703 
   703 
   704 {$IFDEF SDL13}
   704 {$IFDEF SDL13}
   705 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName;      
   705 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName;
   706 function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): LongInt; cdecl; external SDLLibName;   
   706 function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): LongInt; cdecl; external SDLLibName;
   707 function  SDL_SetRenderDrawColor(r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
   707 function  SDL_SetRenderDrawColor(r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
   708 function  SDL_DestroyRenderer(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   708 function  SDL_DestroyRenderer(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   709 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   709 function  SDL_DestroyWindow(window: PSDL_Window): LongInt; cdecl; external SDLLibName;
   710 
   710 
   711 function  SDL_RenderFill(rect: PSDL_Rect): LongInt;
   711 function  SDL_RenderFill(rect: PSDL_Rect): LongInt;