hedgewars/SDLh.pas
changeset 2586 204e6b2885bc
parent 2579 e5e4ebf528b5
child 2590 e7e87e3c67db
equal deleted inserted replaced
2585:0899ce8ad77f 2586:204e6b2885bc
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 
    18 
    19 unit SDLh;
    19 unit SDLh;
    20 interface
    20 interface
       
    21 
       
    22 {$INCLUDE options.inc}
    21 
    23 
    22 {$IFDEF LINUX or FREEBSD}
    24 {$IFDEF LINUX or FREEBSD}
    23 {$DEFINE UNIX}
    25 {$DEFINE UNIX}
    24 {$ENDIF}
    26 {$ENDIF}
    25 
    27 
   124 	SDL_QUITEV = 12;
   126 	SDL_QUITEV = 12;
   125 {$ENDIF}
   127 {$ENDIF}
   126 {*end sdl_event binding*}
   128 {*end sdl_event binding*}
   127 
   129 
   128 
   130 
   129 //if little endian 
   131 {$IFDEF ENDIAN_LITTLE}
   130 	RMask = $000000FF;
   132 	RMask = $000000FF;
   131 	GMask = $0000FF00;
   133 	GMask = $0000FF00;
   132 	BMask = $00FF0000;
   134 	BMask = $00FF0000;
   133 	AMask = $FF000000;
   135 	AMask = $FF000000;
   134 //else 	
   136 {$ELSE}
   135 //	RMask = $FF000000;
   137 	RMask = $FF000000;
   136 //	GMask = $00FF0000;
   138 	GMask = $00FF0000;
   137 //	BMask = $0000FF00;
   139 	BMask = $0000FF00;
   138 //	AMask = $000000FF;
   140 	AMask = $000000FF;
   139 //endif
   141 {$ENDIF}
   140 
   142 
   141 
   143 
   142 type PSDL_Rect = ^TSDL_Rect;
   144 type PSDL_Rect = ^TSDL_Rect;
   143 	TSDL_Rect = record
   145 	TSDL_Rect = record
   144 {$IFDEF SDL13}
   146 {$IFDEF SDL13}
   279 		SDL_GL_ACCELERATED_VISUAL,
   281 		SDL_GL_ACCELERATED_VISUAL,
   280 		SDL_GL_RETAINED_BACKING,
   282 		SDL_GL_RETAINED_BACKING,
   281 		SDL_GL_CONTEXT_MAJOR_VERSION,
   283 		SDL_GL_CONTEXT_MAJOR_VERSION,
   282 		SDL_GL_CONTEXT_MINOR_VERSION
   284 		SDL_GL_CONTEXT_MINOR_VERSION
   283 		);
   285 		);
       
   286 	
   284 
   287 
   285 {$IFDEF SDL13}
   288 {$IFDEF SDL13}
   286      TSDL_MouseMotionEvent = record
   289 	TSDL_ArrayByteOrder = (  // array component order, low byte -> high byte 
       
   290 		SDL_ARRAYORDER_NONE,
       
   291 		SDL_ARRAYORDER_RGB,
       
   292 		SDL_ARRAYORDER_RGBA,
       
   293 		SDL_ARRAYORDER_ARGB,
       
   294 		SDL_ARRAYORDER_BGR,
       
   295 		SDL_ARRAYORDER_BGRA,
       
   296 		SDL_ARRAYORDER_ABGR
       
   297 		);
       
   298 
       
   299 	TSDL_MouseMotionEvent = record
   287                              type_: byte;
   300                              type_: byte;
   288                              which: byte;
   301                              which: byte;
   289                              state: byte;
   302                              state: byte;
   290                              x    : LongInt;
   303                              x    : LongInt;
   291                              y    : LongInt;
   304                              y    : LongInt;
   321 			which: Byte;
   334 			which: Byte;
   322 			button: Byte;
   335 			button: Byte;
   323 			state: Byte;
   336 			state: Byte;
   324 			end;
   337 			end;
   325 	 
   338 	 
   326 	 PSDL_Event = ^TSDL_Event;
   339 	PSDL_Event = ^TSDL_Event;
   327      TSDL_Event = record
   340 	TSDL_Event = record
   328                   case Byte of
   341                   case Byte of
   329 {$IFDEF SDL13}
   342 {$IFDEF SDL13}
   330 			//doublecheck the type of WINDOWEVENT TEXTINPUT
   343 			//doublecheck the type of WINDOWEVENT TEXTINPUT
   331 			SDL_NOEVENT: (type_: byte);
   344 			SDL_NOEVENT: (type_: byte);
   332 			SDL_WINDOWEVENT: (active: TSDL_ActiveEvent);
   345 			SDL_WINDOWEVENT: (active: TSDL_ActiveEvent);
   401 function  SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   414 function  SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   402 function  SDL_GetMouseState(index: LongInt; x, y: PLongInt): Byte; cdecl; external SDLLibName;
   415 function  SDL_GetMouseState(index: LongInt; x, y: PLongInt): Byte; cdecl; external SDLLibName;
   403 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   416 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   404 function  SDL_GetRelativeMouseState(index: LongInt; x, y: PLongInt): Byte; cdecl; external SDLLibName;
   417 function  SDL_GetRelativeMouseState(index: LongInt; x, y: PLongInt): Byte; cdecl; external SDLLibName;
   405 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   418 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
       
   419 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   406 {$ELSE}
   420 {$ELSE}
   407 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   421 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   408 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   422 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   409 {$ENDIF}
   423 {$ENDIF}
   410 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   424 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;