hedgewars/SDLh.pas
changeset 3463 23c50be687a9
parent 3405 8fdb08497bf1
child 3598 a8aa06bae895
equal deleted inserted replaced
3462:4b36933dce1d 3463:23c50be687a9
   111     SDL_INIT_EVERYTHING  = $0000FFFF;
   111     SDL_INIT_EVERYTHING  = $0000FFFF;
   112 
   112 
   113     SDL_APPINPUTFOCUS    = 2;
   113     SDL_APPINPUTFOCUS    = 2;
   114     SDL_BUTTON_WHEELUP   = 4;
   114     SDL_BUTTON_WHEELUP   = 4;
   115     SDL_BUTTON_WHEELDOWN = 5;
   115     SDL_BUTTON_WHEELDOWN = 5;
   116         
   116 
       
   117 
   117 {*begin SDL_Event binding*}
   118 {*begin SDL_Event binding*}
   118 
   119 
   119 {$IFDEF SDL13}
   120 {$IFDEF SDL13}
   120     SDL_FIRSTEVENT = 0;
   121     SDL_FIRSTEVENT = 0;
   121     SDL_QUITEV = $100;
   122     SDL_QUITEV = $100;
   194     BMask = $0000FF00;
   195     BMask = $0000FF00;
   195     AMask = $000000FF;
   196     AMask = $000000FF;
   196 {$ENDIF}
   197 {$ENDIF}
   197 
   198 
   198 {$IFDEF SDL13}
   199 {$IFDEF SDL13}
   199 // SDL_WindowFlags (enum)
   200     // SDL_WindowFlags (enum)
   200     SDL_WINDOW_FULLSCREEN = $00000001;         //*< fullscreen window, implies borderless */
   201     SDL_WINDOW_FULLSCREEN = $00000001;         //*< fullscreen window, implies borderless */
   201     SDL_WINDOW_OPENGL = $00000002;             //*< window usable with OpenGL context */
   202     SDL_WINDOW_OPENGL = $00000002;             //*< window usable with OpenGL context */
   202     SDL_WINDOW_SHOWN = $00000004;              //*< window is visible */
   203     SDL_WINDOW_SHOWN = $00000004;              //*< window is visible */
   203     SDL_WINDOW_BORDERLESS = $00000008;         //*< no window decoration */
   204     SDL_WINDOW_BORDERLESS = $00000008;         //*< no window decoration */
   204     SDL_WINDOW_RESIZABLE = $00000010;          //*< window can be resized */
   205     SDL_WINDOW_RESIZABLE = $00000010;          //*< window can be resized */
   206     SDL_WINDOW_MAXIMIZED = $00000040;          //*< window is maximized */
   207     SDL_WINDOW_MAXIMIZED = $00000040;          //*< window is maximized */
   207     SDL_WINDOW_INPUT_GRABBED = $00000100;      //*< window has grabbed input focus */
   208     SDL_WINDOW_INPUT_GRABBED = $00000100;      //*< window has grabbed input focus */
   208     SDL_WINDOW_INPUT_FOCUS = $00000200;        //*< window has input focus */
   209     SDL_WINDOW_INPUT_FOCUS = $00000200;        //*< window has input focus */
   209     SDL_WINDOW_MOUSE_FOCUS = $00000400;        //*< window has mouse focus */
   210     SDL_WINDOW_MOUSE_FOCUS = $00000400;        //*< window has mouse focus */
   210     SDL_WINDOW_FOREIGN = $00000800;            //*< window not created by SDL */
   211     SDL_WINDOW_FOREIGN = $00000800;            //*< window not created by SDL */
       
   212     
       
   213     // SDL_WindowEventID (enum)
       
   214     SDL_WINDOWEVENT_NONE = 0;            //*< Never used
       
   215     SDL_WINDOWEVENT_SHOWN = 1;           //*< Window has been shown
       
   216     SDL_WINDOWEVENT_HIDDEN = 2;          //*< Window has been hidden
       
   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
       
   219     SDL_WINDOWEVENT_RESIZED = 5;         //*< Window size changed to data1xdata2
       
   220     SDL_WINDOWEVENT_MINIMIZED = 6;       //*< Window has been minimized
       
   221     SDL_WINDOWEVENT_MAXIMIZED = 7;       //*< Window has been maximized
       
   222     SDL_WINDOWEVENT_RESTORED = 8;        //*< Window has been restored to normal size and position
       
   223     SDL_WINDOWEVENT_ENTER = 9;           //*< Window has gained mouse focus
       
   224     SDL_WINDOWEVENT_LEAVE = 10;          //*< Window has lost mouse focus
       
   225     SDL_WINDOWEVENT_FOCUS_GAINED = 11;   //*< Window has gained keyboard focus
       
   226     SDL_WINDOWEVENT_FOCUS_LOST = 12;     //*< Window has lost keyboard focus
       
   227     SDL_WINDOWEVENT_CLOSE = 13;          //*< The window manager requests that the window be closed */
   211 {$ENDIF}
   228 {$ENDIF}
   212 
   229 
   213     {* SDL_mixer *}
   230     {* SDL_mixer *}
   214     MIX_MAX_VOLUME = 128;
   231     MIX_MAX_VOLUME = 128;
   215     MIX_INIT_FLAC = $00000001;
   232     MIX_INIT_FLAC = $00000001;
   334             0: (stdio: TStdio);
   351             0: (stdio: TStdio);
   335             1: (mem: TMem);
   352             1: (mem: TMem);
   336             2: (unknown: TUnknown);
   353             2: (unknown: TUnknown);
   337             end;
   354             end;
   338 
   355 
   339     TSDL_KeySym = record
       
   340         scancode: Byte;
       
   341         sym: Longword;
       
   342         modifier: Longword;
       
   343         unicode: Word;
       
   344         end;
       
   345 
       
   346 
   356 
   347 {* SDL_Event type definition *}
   357 {* SDL_Event type definition *}
   348 
   358 
   349 {$IFDEF SDL13}
   359 {$IFDEF SDL13}
   350     PSDL_Window = pointer;  
   360     PSDL_Window = pointer;  
   355         windowID: LongInt;
   365         windowID: LongInt;
   356         event: byte;
   366         event: byte;
   357         padding1, padding2, padding3: byte;
   367         padding1, padding2, padding3: byte;
   358         data1, data2: LongInt;
   368         data1, data2: LongInt;
   359         end;
   369         end;
       
   370         
       
   371     TSDL_KeySym = record
       
   372         scancode,
       
   373         sym,
       
   374         modifier,
       
   375         unicode: LongInt;
       
   376         end;
   360 
   377 
   361 // implement SDL_TextEditingEvent + SDL_TextInputEvent for sdl13
   378 // implement SDL_TextEditingEvent + SDL_TextInputEvent for sdl13
   362 {$ELSE}
   379 {$ELSE}
       
   380     TSDL_KeySym = record
       
   381         scancode: Byte;
       
   382         sym: Longword;
       
   383         modifier: Longword;
       
   384         unicode: Word;
       
   385         end;
       
   386 
   363     // these two are present in sdl1.3 but only for backward compatibility
   387     // these two are present in sdl1.3 but only for backward compatibility
   364     // and in 1.3 type_ is LongInt, not byte
   388     // and in 1.3 type_ is LongInt, not byte
   365     TSDL_ActiveEvent = record
   389     TSDL_ActiveEvent = record
   366         type_: byte;
   390         type_: byte;
   367         gain: byte;
   391         gain: byte;
   402         state: byte;
   426         state: byte;
   403         keysym: TSDL_KeySym;
   427         keysym: TSDL_KeySym;
   404         end;
   428         end;
   405 
   429 
   406     TSDL_MouseButtonEvent = record
   430     TSDL_MouseButtonEvent = record
   407 
       
   408 {$IFDEF SDL13}
   431 {$IFDEF SDL13}
   409         _type: LongInt;
   432         _type: LongInt;
   410         windowID: LongInt;
   433         windowID: LongInt;
   411         x, y: LongInt;
   434         x, y: LongInt;
   412         padding1: byte;
   435         padding1: byte;
   430         
   453         
   431     // implement SDL_ProximityEvent
   454     // implement SDL_ProximityEvent
   432 {$ENDIF}
   455 {$ENDIF}
   433 
   456 
   434     TSDL_JoyAxisEvent = record
   457     TSDL_JoyAxisEvent = record
       
   458 {$IFDEF SDL13}
       
   459         type_: LongInt;
       
   460 {$ELSE}
   435         type_: Byte;
   461         type_: Byte;
       
   462 {$ENDIF}
   436         which: Byte;
   463         which: Byte;
   437         axis: Byte;
   464         axis: Byte;
   438 {$IFDEF SDL13}
   465 {$IFDEF SDL13}
   439         value: LongInt;
   466         value: LongInt;
   440 {$ELSE}
   467 {$ELSE}
   484 {$ENDIF}
   511 {$ENDIF}
   485         end;
   512         end;
   486 
   513 
   487     PSDL_Event = ^TSDL_Event;
   514     PSDL_Event = ^TSDL_Event;
   488     TSDL_Event = record
   515     TSDL_Event = record
   489         case Byte of
   516 {$IFDEF SDL13}
   490 {$IFDEF SDL13}
   517         case LongInt of
   491             SDL_FIRSTEVENT: (type_: byte);
   518             SDL_FIRSTEVENT: (type_: LongInt);
   492             SDL_QUITEV: (quit: TSDL_QuitEvent);
   519             SDL_QUITEV: (quit: TSDL_QuitEvent);
   493             SDL_WINDOWEVENT: (active: TSDL_WindowEvent);
   520             SDL_WINDOWEVENT: (wevent: TSDL_WindowEvent);
   494             SDL_KEYDOWN,
   521             SDL_KEYDOWN,
   495             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   522             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   496             SDL_TEXTEDITING,
   523             SDL_TEXTEDITING,
   497             SDL_TEXTINPUT: (txtin: byte);
   524             SDL_TEXTINPUT: (txtin: byte);
   498             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   525             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   503             SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent);
   530             SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent);
   504             SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent);
   531             SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent);
   505             SDL_JOYBUTTONDOWN,
   532             SDL_JOYBUTTONDOWN,
   506             SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent);
   533             SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent);
   507 {$ELSE}
   534 {$ELSE}
       
   535         case Byte of
   508             SDL_NOEVENT: (type_: byte);
   536             SDL_NOEVENT: (type_: byte);
   509             SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent);
   537             SDL_ACTIVEEVENT: (active: TSDL_ActiveEvent);
   510             SDL_KEYDOWN,
   538             SDL_KEYDOWN,
   511             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   539             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   512             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   540             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);