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_riscosvideo.c | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/riscos/SDL_riscosvideo.c')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/riscos/SDL_riscosvideo.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosvideo.c b/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosvideo.c new file mode 100644 index 0000000..1f556d2 --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosvideo.c | |||
| @@ -0,0 +1,130 @@ | |||
| 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_sysvideo.h" | ||
| 26 | #include "../SDL_pixels_c.h" | ||
| 27 | #include "../../events/SDL_events_c.h" | ||
| 28 | #include "../../events/SDL_keyboard_c.h" | ||
| 29 | #include "../../events/SDL_mouse_c.h" | ||
| 30 | |||
| 31 | #include "SDL_riscosvideo.h" | ||
| 32 | #include "SDL_riscosevents_c.h" | ||
| 33 | #include "SDL_riscosframebuffer_c.h" | ||
| 34 | #include "SDL_riscosmouse.h" | ||
| 35 | #include "SDL_riscosmodes.h" | ||
| 36 | #include "SDL_riscoswindow.h" | ||
| 37 | #include "SDL_riscosmessagebox.h" | ||
| 38 | |||
| 39 | #define RISCOSVID_DRIVER_NAME "riscos" | ||
| 40 | |||
| 41 | // Initialization/Query functions | ||
| 42 | static bool RISCOS_VideoInit(SDL_VideoDevice *_this); | ||
| 43 | static void RISCOS_VideoQuit(SDL_VideoDevice *_this); | ||
| 44 | |||
| 45 | // RISC OS driver bootstrap functions | ||
| 46 | |||
| 47 | static void RISCOS_DeleteDevice(SDL_VideoDevice *device) | ||
| 48 | { | ||
| 49 | SDL_free(device->internal); | ||
| 50 | SDL_free(device); | ||
| 51 | } | ||
| 52 | |||
| 53 | static SDL_VideoDevice *RISCOS_CreateDevice(void) | ||
| 54 | { | ||
| 55 | SDL_VideoDevice *device; | ||
| 56 | SDL_VideoData *data; | ||
| 57 | |||
| 58 | // Initialize all variables that we clean on shutdown | ||
| 59 | device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); | ||
| 60 | if (!device) { | ||
| 61 | return NULL; | ||
| 62 | } | ||
| 63 | |||
| 64 | // Initialize internal data | ||
| 65 | data = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); | ||
| 66 | if (!data) { | ||
| 67 | SDL_free(device); | ||
| 68 | return NULL; | ||
| 69 | } | ||
| 70 | |||
| 71 | device->internal = data; | ||
| 72 | |||
| 73 | // Set the function pointers | ||
| 74 | device->VideoInit = RISCOS_VideoInit; | ||
| 75 | device->VideoQuit = RISCOS_VideoQuit; | ||
| 76 | device->PumpEvents = RISCOS_PumpEvents; | ||
| 77 | |||
| 78 | device->GetDisplayModes = RISCOS_GetDisplayModes; | ||
| 79 | device->SetDisplayMode = RISCOS_SetDisplayMode; | ||
| 80 | |||
| 81 | device->CreateSDLWindow = RISCOS_CreateWindow; | ||
| 82 | device->DestroyWindow = RISCOS_DestroyWindow; | ||
| 83 | |||
| 84 | device->CreateWindowFramebuffer = RISCOS_CreateWindowFramebuffer; | ||
| 85 | device->UpdateWindowFramebuffer = RISCOS_UpdateWindowFramebuffer; | ||
| 86 | device->DestroyWindowFramebuffer = RISCOS_DestroyWindowFramebuffer; | ||
| 87 | |||
| 88 | device->free = RISCOS_DeleteDevice; | ||
| 89 | |||
| 90 | // TODO: Support windowed mode | ||
| 91 | device->device_caps = VIDEO_DEVICE_CAPS_FULLSCREEN_ONLY; | ||
| 92 | |||
| 93 | return device; | ||
| 94 | } | ||
| 95 | |||
| 96 | VideoBootStrap RISCOS_bootstrap = { | ||
| 97 | RISCOSVID_DRIVER_NAME, "SDL RISC OS video driver", | ||
| 98 | RISCOS_CreateDevice, | ||
| 99 | RISCOS_ShowMessageBox, | ||
| 100 | false | ||
| 101 | }; | ||
| 102 | |||
| 103 | static bool RISCOS_VideoInit(SDL_VideoDevice *_this) | ||
| 104 | { | ||
| 105 | if (!RISCOS_InitEvents(_this)) { | ||
| 106 | return false; | ||
| 107 | } | ||
| 108 | |||
| 109 | if (!RISCOS_InitMouse(_this)) { | ||
| 110 | return false; | ||
| 111 | } | ||
| 112 | |||
| 113 | // Assume we have a mouse and keyboard | ||
| 114 | SDL_AddKeyboard(SDL_DEFAULT_KEYBOARD_ID, NULL, false); | ||
| 115 | SDL_AddMouse(SDL_DEFAULT_MOUSE_ID, NULL, false); | ||
| 116 | |||
| 117 | if (!RISCOS_InitModes(_this)) { | ||
| 118 | return false; | ||
| 119 | } | ||
| 120 | |||
| 121 | // We're done! | ||
| 122 | return true; | ||
| 123 | } | ||
| 124 | |||
| 125 | static void RISCOS_VideoQuit(SDL_VideoDevice *_this) | ||
| 126 | { | ||
| 127 | RISCOS_QuitEvents(_this); | ||
| 128 | } | ||
| 129 | |||
| 130 | #endif // SDL_VIDEO_DRIVER_RISCOS | ||
