Atlas - SDL_riscosvideo.c
Home / ext / SDL / src / video / riscos Lines: 1 | Size: 3672 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 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 42static bool RISCOS_VideoInit(SDL_VideoDevice *_this); 43static void RISCOS_VideoQuit(SDL_VideoDevice *_this); 44 45// RISC OS driver bootstrap functions 46 47static void RISCOS_DeleteDevice(SDL_VideoDevice *device) 48{ 49 SDL_free(device->internal); 50 SDL_free(device); 51} 52 53static 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 96VideoBootStrap RISCOS_bootstrap = { 97 RISCOSVID_DRIVER_NAME, "SDL RISC OS video driver", 98 RISCOS_CreateDevice, 99 RISCOS_ShowMessageBox, 100 false 101}; 102 103static 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); 115 SDL_AddMouse(SDL_DEFAULT_MOUSE_ID, NULL); 116 117 if (!RISCOS_InitModes(_this)) { 118 return false; 119 } 120 121 // We're done! 122 return true; 123} 124 125static void RISCOS_VideoQuit(SDL_VideoDevice *_this) 126{ 127 RISCOS_QuitEvents(_this); 128} 129 130#endif // SDL_VIDEO_DRIVER_RISCOS 131[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.