Namespaces | |
| namespace | anonymous_namespace{ios_window_backend.mm} |
| namespace | anonymous_namespace{null_window_backend.cc} |
| namespace | anonymous_namespace{sdl2_window_backend.cc} |
| namespace | ios |
| namespace | native_menu |
Classes | |
| class | IOSWindowBackend |
| class | IWindowBackend |
| Abstract window backend interface. More... | |
| class | NullWindowBackend |
| Null implementation of the window backend for headless mode. More... | |
| struct | PatchInfo |
| class | SDL2WindowBackend |
| SDL2 implementation of the window backend interface. More... | |
| class | WasmPatchExport |
| class | WindowBackendFactory |
| Factory for creating window backends. More... | |
| struct | WindowConfig |
| Window configuration parameters. More... | |
| struct | WindowEvent |
| Platform-agnostic window event data. More... | |
| struct | WindowStatus |
| Window backend status information. More... | |
Typedefs | |
| using | KeyboardState = const Uint8* |
| using | GamepadHandle = SDL_GameController* |
| using | GamepadButton = SDL_GameControllerButton |
| using | GamepadAxis = SDL_GameControllerAxis |
Enumerations | |
| enum class | WindowEventType { None , Close , Resize , Minimized , Maximized , Restored , Shown , Hidden , Exposed , FocusGained , FocusLost , KeyDown , KeyUp , MouseMotion , MouseButtonDown , MouseButtonUp , MouseWheel , Quit , DropFile } |
| Window event types (platform-agnostic) More... | |
| enum class | WindowBackendType { SDL2 , SDL3 , GLFW , IOS , Null , Auto } |
| Backend type enumeration for factory. More... | |
Functions | |
| bool | PushWakeEvent () |
| Push an SDL user event that only wakes the frame loop. | |
| bool | IsWakeEvent (const SDL_Event &event) |
| True for an event pushed by PushWakeEvent(). | |
| SDL_Keycode | GetKeyFromEvent (const SDL_Event &event) |
| Get keyboard state from SDL event. | |
| SDL_Scancode | GetScancodeFromKey (SDL_Keycode key) |
| Get scancode from keycode. | |
| bool | IsKeyPressed (KeyboardState state, SDL_Scancode scancode) |
| Check if a key is pressed using the keyboard state. | |
| GamepadHandle | OpenGamepad (int index) |
| void | CloseGamepad (GamepadHandle gamepad) |
| bool | GetGamepadButton (GamepadHandle gamepad, SDL_GameControllerButton button) |
| int16_t | GetGamepadAxis (GamepadHandle gamepad, SDL_GameControllerAxis axis) |
| bool | IsGamepadConnected (int index) |
| SDL_Renderer * | CreateRenderer (SDL_Window *window) |
| Create a renderer with default settings. | |
| void | SetRenderVSync (SDL_Renderer *renderer, int interval) |
| Set vertical sync for the renderer. | |
| bool | RenderTexture (SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect) |
| Render a texture to the current render target. | |
| void | FreeSurface (SDL_Surface *surface) |
| Free/destroy a surface. | |
| SDL_Surface * | ConvertSurfaceFormat (SDL_Surface *surface, uint32_t format, uint32_t flags=0) |
| Convert a surface to a specific pixel format. | |
| SDL_Palette * | GetSurfacePalette (SDL_Surface *surface) |
| Get the palette attached to a surface. | |
| Uint32 | GetSurfaceFormat (SDL_Surface *surface) |
| Get the pixel format of a surface as Uint32. | |
| Uint32 | MapRGB (SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b) |
| Map an RGB color to the surface's pixel format. | |
| SDL_Surface * | CreateSurface (int width, int height, int depth, uint32_t format) |
| Create a surface using the appropriate API. | |
| int | GetSurfaceBitsPerPixel (SDL_Surface *surface) |
| Get bits per pixel from a surface. | |
| bool | EnsureSurfacePalette256 (SDL_Surface *surface) |
| Ensure the surface has a proper 256-color palette for indexed formats. | |
| int | GetSurfaceBytesPerPixel (SDL_Surface *surface) |
| Get bytes per pixel from a surface. | |
| bool | IsWindowCloseEvent (const SDL_Event &event) |
| Check if an event is a window close event Works correctly for both SDL2 (nested) and SDL3 (individual) events. | |
| bool | IsWindowResizeEvent (const SDL_Event &event) |
| Check if an event is a window resize event. | |
| bool | IsWindowMinimizedEvent (const SDL_Event &event) |
| Check if an event is a window minimize event. | |
| bool | IsWindowRestoredEvent (const SDL_Event &event) |
| Check if an event is a window restore event. | |
| int | GetWindowEventWidth (const SDL_Event &event) |
| Get window width from resize event data. | |
| int | GetWindowEventHeight (const SDL_Event &event) |
| Get window height from resize event data. | |
| bool | InitSucceeded (int result) |
| Check if SDL initialization succeeded. | |
| uint32_t | GetDefaultInitFlags () |
| Get recommended init flags. | |
| SDL_Surface * | CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) |
| Create an RGB surface. | |
| void | DestroySurface (SDL_Surface *surface) |
| Destroy a surface. | |
| int | GetRendererOutputSize (SDL_Renderer *renderer, int *w, int *h) |
| Get renderer output size. | |
| SDL_Surface * | ReadPixelsToSurface (SDL_Renderer *renderer, int width, int height, const SDL_Rect *rect) |
| Read pixels from renderer to a surface. | |
| SDL_Surface * | LoadBMP (const char *file) |
| Load a BMP file. | |
Variables | |
| constexpr auto | kEventKeyDown = SDL_KEYDOWN |
| constexpr auto | kEventKeyUp = SDL_KEYUP |
| constexpr auto | kEventMouseMotion = SDL_MOUSEMOTION |
| constexpr auto | kEventMouseButtonDown = SDL_MOUSEBUTTONDOWN |
| constexpr auto | kEventMouseButtonUp = SDL_MOUSEBUTTONUP |
| constexpr auto | kEventMouseWheel = SDL_MOUSEWHEEL |
| constexpr auto | kEventQuit = SDL_QUIT |
| constexpr auto | kEventDropFile = SDL_DROPFILE |
| constexpr auto | kEventWindowEvent = SDL_WINDOWEVENT |
| constexpr auto | kEventControllerDeviceAdded = SDL_CONTROLLERDEVICEADDED |
| constexpr auto | kEventControllerDeviceRemoved = SDL_CONTROLLERDEVICEREMOVED |
| constexpr auto | kKeyA = SDLK_a |
| constexpr auto | kKeyB = SDLK_b |
| constexpr auto | kKeyC = SDLK_c |
| constexpr auto | kKeyD = SDLK_d |
| constexpr auto | kKeyS = SDLK_s |
| constexpr auto | kKeyX = SDLK_x |
| constexpr auto | kKeyY = SDLK_y |
| constexpr auto | kKeyZ = SDLK_z |
| constexpr auto | kKeyReturn = SDLK_RETURN |
| constexpr auto | kKeyRShift = SDLK_RSHIFT |
| constexpr auto | kKeyUp = SDLK_UP |
| constexpr auto | kKeyDown = SDLK_DOWN |
| constexpr auto | kKeyLeft = SDLK_LEFT |
| constexpr auto | kKeyRight = SDLK_RIGHT |
| constexpr auto | kGamepadButtonA = SDL_CONTROLLER_BUTTON_A |
| constexpr auto | kGamepadButtonB = SDL_CONTROLLER_BUTTON_B |
| constexpr auto | kGamepadButtonX = SDL_CONTROLLER_BUTTON_X |
| constexpr auto | kGamepadButtonY = SDL_CONTROLLER_BUTTON_Y |
| constexpr auto | kGamepadButtonBack = SDL_CONTROLLER_BUTTON_BACK |
| constexpr auto | kGamepadButtonStart = SDL_CONTROLLER_BUTTON_START |
| constexpr auto | kGamepadButtonLeftShoulder = SDL_CONTROLLER_BUTTON_LEFTSHOULDER |
| constexpr auto | kGamepadButtonRightShoulder |
| constexpr auto | kGamepadButtonDpadUp = SDL_CONTROLLER_BUTTON_DPAD_UP |
| constexpr auto | kGamepadButtonDpadDown = SDL_CONTROLLER_BUTTON_DPAD_DOWN |
| constexpr auto | kGamepadButtonDpadLeft = SDL_CONTROLLER_BUTTON_DPAD_LEFT |
| constexpr auto | kGamepadButtonDpadRight = SDL_CONTROLLER_BUTTON_DPAD_RIGHT |
| constexpr auto | kGamepadAxisLeftX = SDL_CONTROLLER_AXIS_LEFTX |
| constexpr auto | kGamepadAxisLeftY = SDL_CONTROLLER_AXIS_LEFTY |
| using yaze::platform::KeyboardState = const Uint8* |
Definition at line 32 of file sdl_compat.h.
| using yaze::platform::GamepadHandle = SDL_GameController* |
Definition at line 195 of file sdl_compat.h.
| using yaze::platform::GamepadButton = SDL_GameControllerButton |
Definition at line 248 of file sdl_compat.h.
| using yaze::platform::GamepadAxis = SDL_GameControllerAxis |
Definition at line 249 of file sdl_compat.h.
|
strong |
|
strong |
| bool yaze::platform::PushWakeEvent | ( | ) |
Push an SDL user event that only wakes the frame loop.
Thread-safe (SDL_PushEvent). Defined by whichever of sdl2_window_backend.cc or sdl3_window_backend.cc this build compiles; one of them is always compiled. Kept as free functions so the wake code lives in the SDL backend sources without changing the backend class headers.
Definition at line 39 of file sdl2_window_backend.cc.
Referenced by yaze::platform::IWindowBackend::WakeEventLoop().
| bool yaze::platform::IsWakeEvent | ( | const SDL_Event & | event | ) |
True for an event pushed by PushWakeEvent().
The frame loop skips these: they carry no input and must not reset the idle timer or reach the emulator input manager.
Definition at line 48 of file sdl2_window_backend.cc.
Referenced by yaze::Controller::OnInput().
|
inline |
Get keyboard state from SDL event.
| event | The SDL event |
Definition at line 115 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL2InputBackend::ProcessEvent(), yaze::emu::input::SDL3InputBackend::ProcessEvent(), and yaze::emu::ui::RenderKeyboardConfig().
|
inline |
Get scancode from keycode.
| key | The keycode |
Definition at line 128 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL2InputBackend::Poll().
|
inline |
Check if a key is pressed using the keyboard state.
| state | The keyboard state from SDL_GetKeyboardState |
| scancode | The scancode to check |
Definition at line 142 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::Poll(), and yaze::emu::ui::RenderEmulatorInterface().
|
inline |
Definition at line 197 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::HandleGamepadEvent(), yaze::emu::input::SDL3InputBackend::Initialize(), and yaze::emu::input::SDL3InputBackend::SetConfig().
|
inline |
Definition at line 204 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::HandleGamepadEvent(), yaze::emu::input::SDL3InputBackend::SetConfig(), and yaze::emu::input::SDL3InputBackend::Shutdown().
|
inline |
Definition at line 209 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
inline |
Definition at line 214 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
inline |
Definition at line 219 of file sdl_compat.h.
|
inline |
Create a renderer with default settings.
SDL2: SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED) SDL3: SDL_CreateRenderer(window, nullptr)
Definition at line 279 of file sdl_compat.h.
Referenced by yaze::gfx::SDL2Renderer::Initialize().
|
inline |
Set vertical sync for the renderer.
SDL2: SDL_RenderSetVSync(renderer, interval) (SDL 2.0.18+) SDL3: SDL_SetRenderVSync(renderer, interval)
Without vsync the SDL2 loop on Linux/Windows ran uncapped apart from a 1 ms delay, which kept a core busy even when nothing changed.
Definition at line 307 of file sdl_compat.h.
Referenced by yaze::gfx::SDL2Renderer::Initialize().
|
inline |
Render a texture to the current render target.
SDL2: SDL_RenderCopy(renderer, texture, srcrect, dstrect) SDL3: SDL_RenderTexture(renderer, texture, srcrect, dstrect)
Note: This version handles the int to float conversion for SDL3.
Definition at line 328 of file sdl_compat.h.
Referenced by yaze::gfx::SDL2Renderer::RenderCopy().
|
inline |
Free/destroy a surface.
SDL2: SDL_FreeSurface(surface) SDL3: SDL_DestroySurface(surface)
Definition at line 367 of file sdl_compat.h.
|
inline |
Convert a surface to a specific pixel format.
SDL2: SDL_ConvertSurfaceFormat(surface, format, flags) SDL3: SDL_ConvertSurface(surface, format)
Definition at line 383 of file sdl_compat.h.
Referenced by yaze::gfx::MetalRenderer::UpdateTexture(), and yaze::gfx::SDL2Renderer::UpdateTexture().
|
inline |
Get the palette attached to a surface.
Definition at line 398 of file sdl_compat.h.
Referenced by yaze::editor::anonymous_namespace{tile_object_handler.cc}::ApplyRoomPaletteToGhost(), yaze::gfx::Bitmap::ApplyStoredPalette(), yaze::editor::GraphicsScratchView::CaptureSheet(), yaze::gfx::Bitmap::CopySurfaceState(), yaze::editor::PixelEditorPanel::DisplayPalette(), yaze::editor::DrawCatalogTileBrowser(), EnsureSurfacePalette256(), yaze::zelda3::PaletteDebugger::LogSurfaceState(), yaze::gfx::Arena::ProcessTextureQueue(), yaze::gfx::Bitmap::ReadColor(), yaze::editor::RoomGraphicsContent::RefreshSheetPreviews(), yaze::zelda3::Room::RenderRoomGraphics(), yaze::zelda3::PaletteDebugger::SamplePixelAt(), yaze::editor::SetGraphicsPreviewPalette(), yaze::gfx::Bitmap::SetPalette(), yaze::gfx::Bitmap::SetPaletteWithTransparent(), and yaze::editor::usage_preview::SnapshotBitmap().
|
inline |
Get the pixel format of a surface as Uint32.
Note: SDL2 uses Uint32 for pixel format, SDL3 uses SDL_PixelFormat enum. This function returns Uint32 for cross-version compatibility.
Definition at line 414 of file sdl_compat.h.
Referenced by yaze::zelda3::PaletteDebugger::LogSurfaceState().
|
inline |
Map an RGB color to the surface's pixel format.
Definition at line 427 of file sdl_compat.h.
Referenced by yaze::gfx::Bitmap::WriteColor().
|
inline |
Create a surface using the appropriate API.
Definition at line 445 of file sdl_compat.h.
Referenced by yaze::gfx::Arena::AllocateSurface().
|
inline |
Get bits per pixel from a surface.
SDL2: surface->format->BitsPerPixel SDL3: SDL_GetPixelFormatDetails(surface->format)->bits_per_pixel
Definition at line 461 of file sdl_compat.h.
Referenced by EnsureSurfacePalette256(), and yaze::gui::CanvasContextMenu::RenderBitmapOperationsMenu().
|
inline |
Ensure the surface has a proper 256-color palette for indexed formats.
For 8-bit indexed surfaces, this creates and attaches a 256-color palette if one doesn't exist or if the existing palette is too small.
| surface | The surface to check/fix |
Definition at line 482 of file sdl_compat.h.
References GetSurfaceBitsPerPixel(), and GetSurfacePalette().
Referenced by yaze::gfx::Bitmap::Create(), and yaze::gfx::Bitmap::SetPalette().

|
inline |
Get bytes per pixel from a surface.
SDL2: surface->format->BytesPerPixel SDL3: SDL_GetPixelFormatDetails(surface->format)->bytes_per_pixel
Definition at line 536 of file sdl_compat.h.
Referenced by yaze::gui::CanvasContextMenu::RenderBitmapOperationsMenu().
|
inline |
Check if an event is a window close event Works correctly for both SDL2 (nested) and SDL3 (individual) events.
Definition at line 607 of file sdl_compat.h.
|
inline |
Check if an event is a window resize event.
Definition at line 619 of file sdl_compat.h.
|
inline |
Check if an event is a window minimize event.
Definition at line 633 of file sdl_compat.h.
|
inline |
Check if an event is a window restore event.
Definition at line 645 of file sdl_compat.h.
|
inline |
Get window width from resize event data.
Definition at line 657 of file sdl_compat.h.
|
inline |
Get window height from resize event data.
Definition at line 664 of file sdl_compat.h.
|
inline |
Check if SDL initialization succeeded.
SDL2: Returns 0 on success SDL3: Returns true (non-zero) on success
Definition at line 678 of file sdl_compat.h.
|
inline |
Get recommended init flags.
SDL3 removed SDL_INIT_TIMER (timer is always available).
Definition at line 693 of file sdl_compat.h.
|
inline |
Create an RGB surface.
Definition at line 708 of file sdl_compat.h.
|
inline |
Destroy a surface.
Definition at line 725 of file sdl_compat.h.
|
inline |
Get renderer output size.
Definition at line 740 of file sdl_compat.h.
|
inline |
Read pixels from renderer to a surface.
SDL3: Returns a new surface SDL2: We manually create surface and read into it to match SDL3 behavior
Definition at line 754 of file sdl_compat.h.
|
inline |
Load a BMP file.
Definition at line 777 of file sdl_compat.h.
|
constexpr |
Definition at line 53 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL2InputBackend::ProcessEvent(), yaze::emu::input::SDL3InputBackend::ProcessEvent(), and yaze::emu::ui::RenderKeyboardConfig().
|
constexpr |
Definition at line 54 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL2InputBackend::ProcessEvent(), and yaze::emu::input::SDL3InputBackend::ProcessEvent().
|
constexpr |
Definition at line 55 of file sdl_compat.h.
|
constexpr |
Definition at line 56 of file sdl_compat.h.
|
constexpr |
Definition at line 57 of file sdl_compat.h.
|
constexpr |
Definition at line 58 of file sdl_compat.h.
|
constexpr |
Definition at line 59 of file sdl_compat.h.
|
constexpr |
Definition at line 60 of file sdl_compat.h.
|
constexpr |
Definition at line 63 of file sdl_compat.h.
|
constexpr |
Definition at line 64 of file sdl_compat.h.
|
constexpr |
Definition at line 65 of file sdl_compat.h.
|
constexpr |
Definition at line 90 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 91 of file sdl_compat.h.
|
constexpr |
Definition at line 92 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 93 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 94 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 95 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 96 of file sdl_compat.h.
|
constexpr |
Definition at line 97 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 98 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 99 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 100 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 101 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 102 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 103 of file sdl_compat.h.
Referenced by yaze::emu::input::ApplyDefaultKeyBindings().
|
constexpr |
Definition at line 251 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 252 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 253 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 254 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 255 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 256 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 257 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 258 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 260 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 261 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 262 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 263 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 265 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().
|
constexpr |
Definition at line 266 of file sdl_compat.h.
Referenced by yaze::emu::input::SDL3InputBackend::PollGamepad().