572 PSDL_Event = ^TSDL_Event; |
572 PSDL_Event = ^TSDL_Event; |
573 TSDL_Event = record |
573 TSDL_Event = record |
574 {$IFDEF SDL13} |
574 {$IFDEF SDL13} |
575 case LongInt of |
575 case LongInt of |
576 SDL_FIRSTEVENT: (type_: LongInt); |
576 SDL_FIRSTEVENT: (type_: LongInt); |
577 SDL_WINDOWEVENT: (wevent: TSDL_WindowEvent); |
577 SDL_WINDOWEVENT: (window: TSDL_WindowEvent); |
578 SDL_KEYDOWN, |
578 SDL_KEYDOWN, |
579 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
579 SDL_KEYUP: (key: TSDL_KeyboardEvent); |
580 SDL_TEXTEDITING, |
580 SDL_TEXTEDITING, |
581 SDL_TEXTINPUT: (txtin: byte); |
581 SDL_TEXTINPUT: (edit: byte); |
582 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
582 SDL_MOUSEMOTION: (motion: TSDL_MouseMotionEvent); |
583 SDL_MOUSEBUTTONDOWN, |
583 SDL_MOUSEBUTTONDOWN, |
584 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
584 SDL_MOUSEBUTTONUP: (button: TSDL_MouseButtonEvent); |
585 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); |
585 SDL_MOUSEWHEEL: (wheel: TSDL_MouseWheelEvent); |
586 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
586 SDL_JOYAXISMOTION: (jaxis: TSDL_JoyAxisEvent); |
|
587 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
587 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
588 SDL_JOYHATMOTION: (jhat: TSDL_JoyHatEvent); |
588 SDL_JOYBALLMOTION: (jball: TSDL_JoyBallEvent); |
|
589 SDL_JOYBUTTONDOWN, |
589 SDL_JOYBUTTONDOWN, |
590 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
590 SDL_JOYBUTTONUP: (jbutton: TSDL_JoyButtonEvent); |
591 SDL_QUITEV: (quit: TSDL_QuitEvent); |
591 SDL_QUITEV: (quit: TSDL_QuitEvent); |
592 SDL_USEREVENT: (user: TSDL_UserEvent); |
592 SDL_USEREVENT: (user: TSDL_UserEvent); |
593 //TODO: implement other events |
593 //TODO: implement other events |
778 function SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName; |
778 function SDL_SelectMouse(index: LongInt): LongInt; cdecl; external SDLLibName; |
779 function SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
779 function SDL_GetRelativeMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
780 function SDL_GetNumMice: LongInt; cdecl; external SDLLibName; |
780 function SDL_GetNumMice: LongInt; cdecl; external SDLLibName; |
781 function SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName; |
781 function SDL_PixelFormatEnumToMasks(format: TSDL_ArrayByteOrder; bpp: PLongInt; Rmask, Gmask, Bmask, Amask: PLongInt): boolean; cdecl; external SDLLibName; |
782 |
782 |
783 function SDL_AllocFormat(format: Longword): PSDL_PixelFormat; cdecl; external SDLLibName; |
|
784 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); cdecl; external SDLLibName; |
|
785 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
783 procedure SDL_WarpMouseInWindow(window: PSDL_Window; x, y: LongInt); cdecl; external SDLLibName; |
786 |
784 {$ENDIF} |
787 procedure SDL_WarpMouse(x, y: Word); |
785 |
788 {$ELSE} |
|
789 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName; |
|
790 |
|
791 function SDL_AllocFormat(format: Longword): PSDL_PixelFormat; |
|
792 //procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); |
|
793 {$ENDIF} |
|
794 |
|
795 function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF}; |
|
796 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
786 function SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName; |
797 function SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName; |
787 function SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName; |
798 |
788 |
799 procedure SDL_PumpEvents; cdecl; external SDLLibName; |
789 procedure SDL_PumpEvents; cdecl; external SDLLibName; |
800 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
790 function SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName; |
832 procedure SDL_JoystickClose(joy: PSDL_Joystick); cdecl; external SDLLibName; |
822 procedure SDL_JoystickClose(joy: PSDL_Joystick); cdecl; external SDLLibName; |
833 |
823 |
834 function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName; |
824 function SDL_putenv(const text: PChar): LongInt; cdecl; external SDLLibName; |
835 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName; |
825 function SDL_getenv(const text: PChar): PChar; cdecl; external SDLLibName; |
836 |
826 |
|
827 {* Compatibility between SDL-1.2 and SDL-1.3 *} |
|
828 procedure SDL_WarpMouse(x, y: Word); {$IFNDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
829 function SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName {$IFDEF SDL13} name 'SDL_GetKeyboardState'{$ENDIF}; |
|
830 function SDL_AllocFormat(format: Longword): PSDL_PixelFormat; {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
831 procedure SDL_FreeFormat(pixelformat: PSDL_PixelFormat); {$IFDEF SDL13}cdecl; external SDLLibName;{$ENDIF} |
|
832 |
837 {* OpenGL *} |
833 {* OpenGL *} |
838 {$IFDEF DARWIN} |
834 {$IFDEF DARWIN} |
839 function CGLGetCurrentContext(): Pointer; cdecl; external 'OpenGL'; |
835 function CGLGetCurrentContext(): Pointer; cdecl; external 'OpenGL'; |
840 procedure CGLSetParameter(context: Pointer; option: LongInt; value: Pointer); cdecl; external 'OpenGL'; |
836 procedure CGLSetParameter(context: Pointer; option: LongInt; value: Pointer); cdecl; external 'OpenGL'; |
841 {$ENDIF} |
837 {$ENDIF} |
842 |
838 |
843 (* SDL_TTF *) |
839 (* SDL_ttf *) |
844 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName; |
840 function TTF_Init: LongInt; cdecl; external SDL_TTFLibName; |
845 procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
841 procedure TTF_Quit; cdecl; external SDL_TTFLibName; |
846 |
842 |
847 function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName; |
843 function TTF_SizeUTF8(font: PTTF_Font; const text: PChar; out w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName; |
848 |
844 |
917 |
913 |
918 implementation |
914 implementation |
919 uses uVariables; |
915 uses uVariables; |
920 |
916 |
921 {$IFDEF SDL13} |
917 {$IFDEF SDL13} |
|
918 // this needs to be reimplemented because in SDL_compat.c the window is the one created in the SDL_SetVideoMode |
|
919 // compatible function, but we use SDL_CreateWindow, so the window would be NULL |
922 procedure SDL_WarpMouse(x, y: Word); |
920 procedure SDL_WarpMouse(x, y: Word); |
923 begin |
921 begin |
924 SDL_WarpMouseInWindow(SDLwindow, x, y); |
922 SDL_WarpMouseInWindow(SDLwindow, x, y); |
925 end; |
923 end; |
926 {$ELSE} |
924 {$ELSE} |