hedgewars/SDLh.pas
branchsdl2transition
changeset 9697 198c3ed28fe8
parent 9684 8113075dc7cc
child 11360 7a7611adf715
equal deleted inserted replaced
9694:e8d0fe885169 9697:198c3ed28fe8
   137     SDL_BUTTON_WHEELUP   = 4;
   137     SDL_BUTTON_WHEELUP   = 4;
   138     SDL_BUTTON_WHEELDOWN = 5;
   138     SDL_BUTTON_WHEELDOWN = 5;
   139 
   139 
   140 
   140 
   141 {$IFDEF SDL2}
   141 {$IFDEF SDL2}
       
   142     SDL_TEXTEDITINGEVENT_TEXT_SIZE = 32;
       
   143     SDL_TEXTINPUTEVENT_TEXT_SIZE   = 32;
       
   144 
   142     // SDL_Event types
   145     // SDL_Event types
   143     // pascal does not support unions as is, so we list here every possible event
   146     // pascal does not support unions as is, so we list here every possible event
   144     // and later associate a struct type each
   147     // and later associate a struct type each
   145     SDL_FIRSTEVENT        = 0;              // type
   148     SDL_FIRSTEVENT        = 0;              // type
   146     SDL_COMMONDEVENT      = 1;              // type and timestamp
   149     SDL_COMMONDEVENT      = 1;              // type and timestamp
   541         event: Byte;
   544         event: Byte;
   542         padding1, padding2, padding3: Byte;
   545         padding1, padding2, padding3: Byte;
   543         data1, data2: LongInt;
   546         data1, data2: LongInt;
   544         end;
   547         end;
   545 
   548 
   546     // available in sdl12 but not exposed
       
   547     TSDL_TextEditingEvent = record
   549     TSDL_TextEditingEvent = record
   548         type_: LongWord;
   550         type_: Longword;
   549         timestamp: LongWord;
   551         timestamp: Longword;
   550         windowID: LongWord;
   552         windowID: Longword;
   551         text: array[0..31] of Byte;
   553         text: array [0..SDL_TEXTEDITINGEVENT_TEXT_SIZE - 1] of char;
   552         start, lenght: LongInt;
   554         start: LongInt;
   553         end;
   555         length: LongInt;
   554 
   556         end;
   555     // available in sdl12 but not exposed
   557 
   556     TSDL_TextInputEvent = record
   558     TSDL_TextInputEvent = record
   557         type_: LongWord;
   559         type_: Longword;
   558         timestamp: LongWord;
   560         timestamp: Longword;
   559         windowID: LongWord;
   561         windowID: Longword;
   560         text: array[0..31] of Byte;
   562         text: array [0..SDL_TEXTINPUTEVENT_TEXT_SIZE - 1] of char;
   561         end;
   563         end;
   562 
   564 
   563     TSDL_TouchFingerEvent = record
   565     TSDL_TouchFingerEvent = record
   564         type_: LongWord;
   566         type_: LongWord;
   565         timestamp: LongWord;
   567         timestamp: LongWord;
   794             SDL_COMMONDEVENT: (common: TSDL_CommonEvent);
   796             SDL_COMMONDEVENT: (common: TSDL_CommonEvent);
   795             SDL_WINDOWEVENT: (window: TSDL_WindowEvent);
   797             SDL_WINDOWEVENT: (window: TSDL_WindowEvent);
   796             SDL_KEYDOWN,
   798             SDL_KEYDOWN,
   797             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   799             SDL_KEYUP: (key: TSDL_KeyboardEvent);
   798             SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent);
   800             SDL_TEXTEDITING: (edit: TSDL_TextEditingEvent);
   799             SDL_TEXTINPUT: (tedit: TSDL_TextInputEvent);
   801             SDL_TEXTINPUT: (text: TSDL_TextInputEvent);
   800             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   802             SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent);
   801             SDL_MOUSEBUTTONDOWN,
   803             SDL_MOUSEBUTTONDOWN,
   802             SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent);
   804             SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent);
   803             SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent);
   805             SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent);
   804             SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent);
   806             SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent);
  1029 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName;
  1031 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): Boolean; cdecl; external SDLLibName;
  1030 
  1032 
  1031 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
  1033 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName;
  1032 function  SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName;
  1034 function  SDL_SetHint(name, value: PChar): Boolean; cdecl; external SDLLibName;
  1033 procedure SDL_StartTextInput; cdecl; external SDLLibName;
  1035 procedure SDL_StartTextInput; cdecl; external SDLLibName;
       
  1036 procedure SDL_StopTextInput; cdecl; external SDLLibName;
  1034 
  1037 
  1035 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName;
  1038 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: TSDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName;
  1036 
  1039 
  1037 function  SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; cdecl; external SDLLibName;
  1040 function  SDL_AllocFormat(format: LongWord): PSDL_PixelFormat; cdecl; external SDLLibName;
  1038 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName;
  1041 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName;