SDL2 implementation of the window backend interface. More...
#include <sdl2_window_backend.h>


Public Member Functions | |
| SDL2WindowBackend ()=default | |
| ~SDL2WindowBackend () override | |
| absl::Status | Initialize (const WindowConfig &config) override |
| Initialize the window backend with configuration. | |
| absl::Status | Shutdown () override |
| Shutdown the window backend and release resources. | |
| bool | IsInitialized () const override |
| Check if the backend is initialized. | |
| bool | PollEvent (WindowEvent &out_event) override |
| Poll and process pending events. | |
| void | ProcessNativeEvent (void *native_event) override |
| Process a native SDL event (for ImGui integration) | |
| WindowStatus | GetStatus () const override |
| Get current window status. | |
| bool | IsActive () const override |
| Check if window is still active (not closed) | |
| void | SetActive (bool active) override |
| Set window active state. | |
| void | GetSize (int *width, int *height) const override |
| Get window dimensions. | |
| void | SetSize (int width, int height) override |
| Set window dimensions. | |
| std::string | GetTitle () const override |
| Get window title. | |
| void | SetTitle (const std::string &title) override |
| Set window title. | |
| bool | InitializeRenderer (gfx::IRenderer *renderer) override |
| Initialize renderer for this window. | |
| SDL_Window * | GetNativeWindow () override |
| Get the underlying SDL_Window pointer for ImGui integration. | |
| absl::Status | InitializeImGui (gfx::IRenderer *renderer) override |
| Initialize ImGui backends for this window/renderer combo. | |
| void | ShutdownImGui () override |
| Shutdown ImGui backends. | |
| void | NewImGuiFrame () override |
| Start a new ImGui frame. | |
| void | RenderImGui (gfx::IRenderer *renderer) override |
| Render ImGui draw data (and viewports if enabled) | |
| uint32_t | GetAudioDevice () const override |
| Get audio device ID (for legacy audio buffer management) | |
| std::shared_ptr< int16_t > | GetAudioBuffer () const override |
| Get audio buffer (for legacy audio management) | |
| std::string | GetBackendName () const override |
| Get backend name for debugging/logging. | |
| int | GetSDLVersion () const override |
| Get SDL version being used. | |
Public Member Functions inherited from yaze::platform::IWindowBackend | |
| virtual | ~IWindowBackend ()=default |
Private Member Functions | |
| WindowEvent | ConvertSDL2Event (const SDL_Event &sdl_event) |
| void | UpdateModifierState () |
Private Attributes | |
| std::unique_ptr< SDL_Window, util::SDL_Deleter > | window_ |
| bool | initialized_ = false |
| bool | active_ = true |
| bool | is_resizing_ = false |
| bool | imgui_initialized_ = false |
| bool | key_shift_ = false |
| bool | key_ctrl_ = false |
| bool | key_alt_ = false |
| bool | key_super_ = false |
| SDL_AudioDeviceID | audio_device_ = 0 |
| std::shared_ptr< int16_t > | audio_buffer_ |
SDL2 implementation of the window backend interface.
Wraps SDL2 window management, event handling, and ImGui integration for the main YAZE application window.
Definition at line 24 of file sdl2_window_backend.h.
|
default |
|
override |
Definition at line 31 of file sdl2_window_backend.cc.
References initialized_, and Shutdown().

|
overridevirtual |
Initialize the window backend with configuration.
| config | Window configuration parameters |
Implements yaze::platform::IWindowBackend.
Definition at line 37 of file sdl2_window_backend.cc.
References active_, audio_buffer_, yaze::platform::WindowConfig::display_scale, yaze::platform::WindowConfig::fullscreen, yaze::platform::WindowConfig::height, yaze::platform::WindowConfig::high_dpi, initialized_, LOG_INFO, LOG_WARN, yaze::platform::WindowConfig::maximized, yaze::platform::WindowConfig::resizable, RETURN_IF_ERROR, Shutdown(), yaze::platform::WindowConfig::title, yaze::platform::WindowConfig::width, and window_.

|
overridevirtual |
Shutdown the window backend and release resources.
Implements yaze::platform::IWindowBackend.
Definition at line 112 of file sdl2_window_backend.cc.
References audio_device_, yaze::gfx::Arena::Get(), imgui_initialized_, initialized_, LOG_INFO, yaze::gfx::Arena::Shutdown(), ShutdownImGui(), and window_.
Referenced by Initialize(), and ~SDL2WindowBackend().

|
inlineoverridevirtual |
Check if the backend is initialized.
Implements yaze::platform::IWindowBackend.
Definition at line 35 of file sdl2_window_backend.h.
References initialized_.
|
overridevirtual |
Poll and process pending events.
| out_event | Output parameter for the next event |
Implements yaze::platform::IWindowBackend.
Definition at line 148 of file sdl2_window_backend.cc.
References ConvertSDL2Event(), yaze::platform::WindowEvent::has_native_event, imgui_initialized_, and yaze::platform::WindowEvent::native_event.

|
overridevirtual |
Process a native SDL event (for ImGui integration)
| native_event | Pointer to native SDL_Event |
Implements yaze::platform::IWindowBackend.
Definition at line 165 of file sdl2_window_backend.cc.
References imgui_initialized_.
|
overridevirtual |
Get current window status.
Implements yaze::platform::IWindowBackend.
Definition at line 309 of file sdl2_window_backend.cc.
References active_, yaze::platform::WindowStatus::height, yaze::platform::WindowStatus::is_active, yaze::platform::WindowStatus::is_focused, yaze::platform::WindowStatus::is_fullscreen, yaze::platform::WindowStatus::is_maximized, yaze::platform::WindowStatus::is_minimized, yaze::platform::WindowStatus::is_resizing, is_resizing_, yaze::platform::WindowStatus::width, and window_.
|
inlineoverridevirtual |
Check if window is still active (not closed)
Implements yaze::platform::IWindowBackend.
Definition at line 41 of file sdl2_window_backend.h.
References active_.
|
inlineoverridevirtual |
Set window active state.
Implements yaze::platform::IWindowBackend.
Definition at line 42 of file sdl2_window_backend.h.
References active_.
|
overridevirtual |
Get window dimensions.
Implements yaze::platform::IWindowBackend.
Definition at line 328 of file sdl2_window_backend.cc.
References window_.
|
overridevirtual |
Set window dimensions.
Implements yaze::platform::IWindowBackend.
Definition at line 337 of file sdl2_window_backend.cc.
References window_.
|
overridevirtual |
Get window title.
Implements yaze::platform::IWindowBackend.
Definition at line 343 of file sdl2_window_backend.cc.
References window_.
|
overridevirtual |
Set window title.
Implements yaze::platform::IWindowBackend.
Definition at line 351 of file sdl2_window_backend.cc.
References window_.
|
overridevirtual |
Initialize renderer for this window.
| renderer | The renderer to initialize |
Implements yaze::platform::IWindowBackend.
Definition at line 357 of file sdl2_window_backend.cc.
References yaze::gfx::IRenderer::GetBackendRenderer(), yaze::gfx::IRenderer::Initialize(), and window_.

|
inlineoverridevirtual |
Get the underlying SDL_Window pointer for ImGui integration.
Implements yaze::platform::IWindowBackend.
Definition at line 50 of file sdl2_window_backend.h.
References window_.
|
overridevirtual |
Initialize ImGui backends for this window/renderer combo.
| renderer | The renderer (for backend-specific init) |
Implements yaze::platform::IWindowBackend.
Definition at line 370 of file sdl2_window_backend.cc.
References yaze::gui::ColorsYaze(), yaze::gfx::IRenderer::GetBackendRenderer(), imgui_initialized_, yaze::LoadPackageFonts(), LOG_INFO, RETURN_IF_ERROR, and window_.

|
overridevirtual |
Shutdown ImGui backends.
Implements yaze::platform::IWindowBackend.
Definition at line 423 of file sdl2_window_backend.cc.
References imgui_initialized_, and LOG_INFO.
Referenced by Shutdown().
|
overridevirtual |
Start a new ImGui frame.
Implements yaze::platform::IWindowBackend.
Definition at line 438 of file sdl2_window_backend.cc.
References imgui_initialized_.
|
overridevirtual |
Render ImGui draw data (and viewports if enabled)
| renderer | The renderer to use for drawing (needed to get backend renderer) |
Implements yaze::platform::IWindowBackend.
Definition at line 450 of file sdl2_window_backend.cc.
References yaze::gfx::IRenderer::GetBackendRenderer(), and imgui_initialized_.

|
inlineoverridevirtual |
Get audio device ID (for legacy audio buffer management)
Implements yaze::platform::IWindowBackend.
Definition at line 57 of file sdl2_window_backend.h.
References audio_device_.
|
inlineoverridevirtual |
Get audio buffer (for legacy audio management)
Implements yaze::platform::IWindowBackend.
Definition at line 58 of file sdl2_window_backend.h.
References audio_buffer_.
|
inlineoverridevirtual |
Get backend name for debugging/logging.
Implements yaze::platform::IWindowBackend.
Definition at line 62 of file sdl2_window_backend.h.
|
inlineoverridevirtual |
Get SDL version being used.
Implements yaze::platform::IWindowBackend.
Definition at line 63 of file sdl2_window_backend.h.
|
private |
Definition at line 171 of file sdl2_window_backend.cc.
References active_, yaze::platform::Close, yaze::platform::DropFile, yaze::platform::Exposed, yaze::platform::FocusGained, yaze::platform::FocusLost, g_window_is_resizing, yaze::platform::Hidden, is_resizing_, key_alt_, key_ctrl_, key_shift_, key_super_, yaze::platform::KeyDown, yaze::platform::KeyUp, yaze::platform::Maximized, yaze::platform::Minimized, yaze::platform::MouseButtonDown, yaze::platform::MouseButtonUp, yaze::platform::MouseMotion, yaze::platform::MouseWheel, yaze::platform::None, yaze::platform::Quit, yaze::platform::Resize, yaze::platform::Restored, yaze::platform::Shown, yaze::platform::WindowEvent::type, and UpdateModifierState().
Referenced by PollEvent().

|
private |
Definition at line 301 of file sdl2_window_backend.cc.
References key_alt_, key_ctrl_, key_shift_, and key_super_.
Referenced by ConvertSDL2Event().
|
private |
Definition at line 72 of file sdl2_window_backend.h.
Referenced by GetNativeWindow(), GetSize(), GetStatus(), GetTitle(), Initialize(), InitializeImGui(), InitializeRenderer(), SetSize(), SetTitle(), and Shutdown().
|
private |
Definition at line 73 of file sdl2_window_backend.h.
Referenced by Initialize(), IsInitialized(), Shutdown(), and ~SDL2WindowBackend().
|
private |
Definition at line 74 of file sdl2_window_backend.h.
Referenced by ConvertSDL2Event(), GetStatus(), Initialize(), IsActive(), and SetActive().
|
private |
Definition at line 75 of file sdl2_window_backend.h.
Referenced by ConvertSDL2Event(), and GetStatus().
|
private |
Definition at line 76 of file sdl2_window_backend.h.
Referenced by InitializeImGui(), NewImGuiFrame(), PollEvent(), ProcessNativeEvent(), RenderImGui(), Shutdown(), and ShutdownImGui().
|
private |
Definition at line 79 of file sdl2_window_backend.h.
Referenced by ConvertSDL2Event(), and UpdateModifierState().
|
private |
Definition at line 80 of file sdl2_window_backend.h.
Referenced by ConvertSDL2Event(), and UpdateModifierState().
|
private |
Definition at line 81 of file sdl2_window_backend.h.
Referenced by ConvertSDL2Event(), and UpdateModifierState().
|
private |
Definition at line 82 of file sdl2_window_backend.h.
Referenced by ConvertSDL2Event(), and UpdateModifierState().
|
private |
Definition at line 85 of file sdl2_window_backend.h.
Referenced by GetAudioDevice(), and Shutdown().
|
private |
Definition at line 86 of file sdl2_window_backend.h.
Referenced by GetAudioBuffer(), and Initialize().