diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmouse.c | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmouse.c')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmouse.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmouse.c b/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmouse.c new file mode 100644 index 0000000..d67e7c8 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmouse.c | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_VIDEO_DRIVER_RISCOS | ||
| 24 | |||
| 25 | #include "SDL_riscosvideo.h" | ||
| 26 | #include "SDL_riscosmouse.h" | ||
| 27 | #include "../../events/SDL_mouse_c.h" | ||
| 28 | |||
| 29 | #include <kernel.h> | ||
| 30 | |||
| 31 | static SDL_Cursor *RISCOS_CreateDefaultCursor(void) | ||
| 32 | { | ||
| 33 | SDL_Cursor *cursor = SDL_calloc(1, sizeof(*cursor)); | ||
| 34 | if (cursor) { | ||
| 35 | // NULL is used to indicate the default cursor | ||
| 36 | cursor->internal = NULL; | ||
| 37 | } | ||
| 38 | |||
| 39 | return cursor; | ||
| 40 | } | ||
| 41 | |||
| 42 | static void RISCOS_FreeCursor(SDL_Cursor *cursor) | ||
| 43 | { | ||
| 44 | SDL_free(cursor); | ||
| 45 | } | ||
| 46 | |||
| 47 | static bool RISCOS_ShowCursor(SDL_Cursor *cursor) | ||
| 48 | { | ||
| 49 | if (cursor) { | ||
| 50 | // Turn the mouse pointer on | ||
| 51 | _kernel_osbyte(106, 1, 0); | ||
| 52 | } else { | ||
| 53 | // Turn the mouse pointer off | ||
| 54 | _kernel_osbyte(106, 0, 0); | ||
| 55 | } | ||
| 56 | |||
| 57 | return true; | ||
| 58 | } | ||
| 59 | |||
| 60 | bool RISCOS_InitMouse(SDL_VideoDevice *_this) | ||
| 61 | { | ||
| 62 | SDL_Mouse *mouse = SDL_GetMouse(); | ||
| 63 | |||
| 64 | // mouse->CreateCursor = RISCOS_CreateCursor; | ||
| 65 | // mouse->CreateSystemCursor = RISCOS_CreateSystemCursor; | ||
| 66 | mouse->ShowCursor = RISCOS_ShowCursor; | ||
| 67 | mouse->FreeCursor = RISCOS_FreeCursor; | ||
| 68 | // mouse->WarpMouse = RISCOS_WarpMouse; | ||
| 69 | // mouse->WarpMouseGlobal = RISCOS_WarpMouseGlobal; | ||
| 70 | // mouse->SetRelativeMouseMode = RISCOS_SetRelativeMouseMode; | ||
| 71 | // mouse->CaptureMouse = RISCOS_CaptureMouse; | ||
| 72 | // mouse->GetGlobalMouseState = RISCOS_GetGlobalMouseState; | ||
| 73 | |||
| 74 | SDL_SetDefaultCursor(RISCOS_CreateDefaultCursor()); | ||
| 75 | |||
| 76 | return true; | ||
| 77 | } | ||
| 78 | |||
| 79 | #endif // SDL_VIDEO_DRIVER_RISCOS | ||
