hedgewars/SDLh.pas
changeset 2714 c85ffe57d971
parent 2701 3a8560c00f78
child 2716 b9ca1bfca24f
equal deleted inserted replaced
2713:71250942e95b 2714:c85ffe57d971
   325 
   325 
   326 
   326 
   327 {* SDL_Event type definition *}
   327 {* SDL_Event type definition *}
   328 
   328 
   329 {$IFDEF SDL13}
   329 {$IFDEF SDL13}
   330 	TSDL_WindowID = LongInt;
   330 	//UPDATE TSDL_Window AND TSDL_Texture before usage!!!
   331 	TSDL_TextureID = LongInt;
   331 	PSDL_Window = ^TSDL_Window;
       
   332 	TSDL_Window = LongInt; //not true anymore
       
   333 		
       
   334 	PSDL_Texture = ^TSDL_Texture;
       
   335 	TSDL_Texture = LongInt; //not true anymore
   332 	
   336 	
   333 	TSDL_WindowEvent = record
   337 	TSDL_WindowEvent = record
   334 		type_: byte;
   338 		type_: byte;
   335 		gain: byte;
   339 		gain: byte;
   336 		state: byte;
   340 		state: byte;
   337 		windowID: TSDL_WindowID;
   341 		windowID: LongInt;
   338 		data1, data2: LongInt;
   342 		data1, data2: LongInt;
   339 		end;
   343 		end;
   340 
   344 
   341 // implement SDL_TextEditingEvent + SDL_TextInputEvent for sdl13
   345 // implement SDL_TextEditingEvent + SDL_TextInputEvent for sdl13
   342 {$ELSE}
   346 {$ELSE}
       
   347 	//these two are present in sdl1.3 but only for backward compatibility
   343 	TSDL_ActiveEvent = record
   348 	TSDL_ActiveEvent = record
   344 		type_: byte;
   349 		type_: byte;
   345 		gain: byte;
   350 		gain: byte;
   346 		state: byte;
   351 		state: byte;
   347 		end;
   352 		end;
       
   353 
       
   354 	TSDL_ResizeEvent = record
       
   355 		type_: Byte;
       
   356 		w, h: LongInt;
       
   357 		end;
   348 {$ENDIF}
   358 {$ENDIF}
   349 
   359 
   350 	TSDL_MouseMotionEvent = record
   360 	TSDL_MouseMotionEvent = record
   351 		type_: byte;
   361 		type_: byte;
   352 		which: byte;
   362 		which: byte;
   353 		state: byte;
   363 		state: byte;
   354 {$IFDEF SDL13}
   364 {$IFDEF SDL13}
       
   365 		windowID: LongInt;
   355 		x, y, xrel, yrel : LongInt;
   366 		x, y, xrel, yrel : LongInt;
   356 		pressure, pressure_max, pressure_min,
   367 		pressure, pressure_max, pressure_min,
   357 		rotation, tilt, cursor: LongInt; 
   368 		rotation, tilt, cursor: LongInt; 
   358 {$ELSE}
   369 {$ELSE}
   359 		x, y, xrel, yrel : word;
   370 		x, y, xrel, yrel : word;
   361 		end;
   372 		end;
   362 
   373 
   363 	TSDL_KeyboardEvent = record
   374 	TSDL_KeyboardEvent = record
   364 		type_: Byte;
   375 		type_: Byte;
   365 {$IFDEF SDL13}
   376 {$IFDEF SDL13}
   366 		windowID: TSDL_WindowID;
   377 		windowID: LongInt;
   367 {$ENDIF}
   378 {$ENDIF}
   368 		which: Byte;
   379 		which: Byte;
   369 		state: Byte;
   380 		state: Byte;
   370 		keysym: TSDL_KeySym;
   381 		keysym: TSDL_KeySym;
   371 		end;
   382 		end;
   374 		_type,
   385 		_type,
   375 		which,
   386 		which,
   376 		button,
   387 		button,
   377 		state: byte;
   388 		state: byte;
   378 {$IFDEF SDL13}
   389 {$IFDEF SDL13}
       
   390 		windowID: LongInt;
   379 		x, y: LongInt;
   391 		x, y: LongInt;
   380 {$ELSE}
   392 {$ELSE}
   381 		x, y: word;
   393 		x, y: word;
   382 {$ENDIF}
   394 {$ENDIF}
   383 		end;
   395 		end;
   384 
   396 
   385 {$IFDEF SDL13}
   397 {$IFDEF SDL13}
   386 	TSDL_MouseWheelEvent = record
   398 	TSDL_MouseWheelEvent = record
   387 		type_: Byte;
   399 		type_: Byte;
   388 		windowID: TSDL_WindowID;
   400 		windowID: LongInt;
   389 		which: Byte;
   401 		which: Byte;
   390 		x, y: LongInt;
   402 		x, y: LongInt;
   391 		end;
   403 		end;
   392 {$ENDIF}
   404 {$ENDIF}
   393 
   405 
   428 		end;
   440 		end;
   429 
   441 
   430 	TSDL_QuitEvent = record
   442 	TSDL_QuitEvent = record
   431                 type_: Byte;
   443                 type_: Byte;
   432                 end;
   444                 end;
   433 
       
   434 {$IFNDEF SDL13}
       
   435 	TSDL_ResizeEvent = record
       
   436 		type_: Byte;
       
   437 		w, h: LongInt;
       
   438 		end;
       
   439 {$ENDIF}
       
   440 
   445 
   441 	PSDL_Event = ^TSDL_Event;
   446 	PSDL_Event = ^TSDL_Event;
   442 	TSDL_Event = record
   447 	TSDL_Event = record
   443 		case Byte of
   448 		case Byte of
   444 			SDL_NOEVENT: (type_: byte);
   449 			SDL_NOEVENT: (type_: byte);
   624 
   629 
   625 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   630 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
   626 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   631 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
   627 
   632 
   628 {$IFDEF SDL13}
   633 {$IFDEF SDL13}
   629 function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): TSDL_WindowID; cdecl; external SDLLibName;
       
   630 function  SDL_CreateRenderer(windowID: TSDL_WindowID; index, flags: LongInt): LongInt; cdecl; external SDLLibName;
       
   631 function  SDL_SetRenderDrawColor(r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
       
   632 function  SDL_RenderFill(rect: PSDL_Rect): LongInt;
   634 function  SDL_RenderFill(rect: PSDL_Rect): LongInt;
   633 function  SDL_RenderFillRect(rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   635 function  SDL_RenderFillRect(rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
   634 function  SDL_RenderClear: LongInt; cdecl; external SDLLibName;
   636 function  SDL_RenderClear: LongInt; cdecl; external SDLLibName;
   635 procedure SDL_RenderPresent; cdecl; external SDLLibName;
   637 procedure SDL_RenderPresent; cdecl; external SDLLibName;
   636 function  SDL_RenderCopy(textureID: TSDL_TextureID; srcrect, dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
       
   637 procedure SDL_VideoQuit; cdecl; external SDLLibName;
   638 procedure SDL_VideoQuit; cdecl; external SDLLibName;
   638 
   639 
   639 function  SDL_CreateTextureFromSurface(format: LongInt; surface: PSDL_Surface): TSDL_TextureID; cdecl; external SDLLibName;
       
   640 procedure SDL_DestroyTexture(textureID: TSDL_TextureID); cdecl; external SDLLibName;
       
   641 
       
   642 function  SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
       
   643 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   640 function  SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName;
   644 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   641 function  SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   645 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   642 function  SDL_GetNumMice: LongInt; cdecl; external SDLLibName;
   646 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   643 function  SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName;
   647 {$ELSE}
   644 {$ENDIF}
   648 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
   645 
   649 {$ENDIF}
   646 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF};
   650 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   647 function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
   651 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   648 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
   652 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
   649 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
   653 
   650 
   654 procedure SDL_PumpEvents; cdecl; external SDLLibName;
   651 procedure SDL_PumpEvents; cdecl; external SDLLibName;
   665 function  SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP';
   662 function  SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP';
   666 function  SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV';
   663 function  SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV';
   667 
   664 
   668 function  SDL_GL_SetAttribute(attr: TSDL_GLattr; value: LongInt): LongInt; cdecl; external SDLLibName;
   665 function  SDL_GL_SetAttribute(attr: TSDL_GLattr; value: LongInt): LongInt; cdecl; external SDLLibName;
   669 procedure SDL_GL_SwapBuffers(); cdecl; external SDLLibName;
   666 procedure SDL_GL_SwapBuffers(); cdecl; external SDLLibName;
   670 
       
   671 {$IFDEF IPHONEOS}
       
   672 function  SDL_iPhoneKeyboardShow(windowID: LongInt): LongInt; cdecl; external SDLLibName;
       
   673 function  SDL_iPhoneKeyboardHide(windowID: LongInt): LongInt; cdecl; external SDLLibName;
       
   674 function  SDL_iPhoneKeyboardIsShown(windowID: LongInt): boolean; cdecl; external SDLLibName;
       
   675 function  SDL_iPhoneKeyboardToggle(windowID: LongInt): LongInt; cdecl; external SDLLibName;
       
   676 {$ENDIF}
       
   677 
   667 
   678 function  SDL_NumJoysticks: LongInt; cdecl; external SDLLibName;
   668 function  SDL_NumJoysticks: LongInt; cdecl; external SDLLibName;
   679 function  SDL_JoystickName(idx: LongInt): PChar; cdecl; external SDLLibName;
   669 function  SDL_JoystickName(idx: LongInt): PChar; cdecl; external SDLLibName;
   680 function  SDL_JoystickOpen(idx: LongInt): PSDL_Joystick; cdecl; external SDLLibName;
   670 function  SDL_JoystickOpen(idx: LongInt): PSDL_Joystick; cdecl; external SDLLibName;
   681 function  SDL_JoystickOpened(idx: LongInt): LongInt; cdecl; external SDLLibName;
   671 function  SDL_JoystickOpened(idx: LongInt): LongInt; cdecl; external SDLLibName;