yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
null_window_backend.h
Go to the documentation of this file.
1// null_window_backend.h - Null Window Backend Implementation (Headless)
2
3#ifndef YAZE_APP_PLATFORM_NULL_WINDOW_BACKEND_H_
4#define YAZE_APP_PLATFORM_NULL_WINDOW_BACKEND_H_
5
7
8#include <memory>
9#include <string>
10
11#include "absl/status/status.h"
12
13namespace yaze {
14namespace platform {
15
23 public:
24 NullWindowBackend() = default;
25 ~NullWindowBackend() override = default;
26
27 // =========================================================================
28 // IWindowBackend Implementation
29 // =========================================================================
30
31 absl::Status Initialize(const WindowConfig& config) override;
32 absl::Status Shutdown() override;
33 bool IsInitialized() const override { return initialized_; }
34
35 bool PollEvent(WindowEvent& out_event) override;
36 void ProcessNativeEvent(void* native_event) override;
37
38 WindowStatus GetStatus() const override;
39 bool IsActive() const override { return active_; }
40 void SetActive(bool active) override { active_ = active; }
41
42 void GetSize(int* width, int* height) const override;
43 void SetSize(int width, int height) override;
44 std::string GetTitle() const override { return "Headless"; }
45 void SetTitle(const std::string& title) override {}
46
47 void ShowWindow() override {}
48 void HideWindow() override {}
49
50 bool InitializeRenderer(gfx::IRenderer* renderer) override;
51 SDL_Window* GetNativeWindow() override { return nullptr; }
52
53 absl::Status InitializeImGui(gfx::IRenderer* renderer) override;
54 void ShutdownImGui() override;
55 void NewImGuiFrame() override;
56 void RenderImGui(gfx::IRenderer* renderer) override;
57
58 uint32_t GetAudioDevice() const override { return 0; }
59 std::shared_ptr<int16_t> GetAudioBuffer() const override { return nullptr; }
60
61 std::string GetBackendName() const override { return "Null"; }
62 int GetSDLVersion() const override { return 0; }
63
64 private:
65 bool initialized_ = false;
66 bool active_ = true;
67 bool imgui_initialized_ = false;
68 int width_ = 1280;
69 int height_ = 720;
70};
71
72} // namespace platform
73} // namespace yaze
74
75#endif // YAZE_APP_PLATFORM_NULL_WINDOW_BACKEND_H_
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Abstract window backend interface.
Definition iwindow.h:116
Null implementation of the window backend for headless mode.
void SetTitle(const std::string &title) override
Set window title.
void SetActive(bool active) override
Set window active state.
~NullWindowBackend() override=default
bool PollEvent(WindowEvent &out_event) override
Poll and process pending events.
void HideWindow() override
Hide the window.
bool IsActive() const override
Check if window is still active (not closed)
absl::Status Shutdown() override
Shutdown the window backend and release resources.
absl::Status Initialize(const WindowConfig &config) override
Initialize the window backend with configuration.
uint32_t GetAudioDevice() const override
Get audio device ID (for legacy audio buffer management)
bool InitializeRenderer(gfx::IRenderer *renderer) override
Initialize renderer for this window.
std::string GetTitle() const override
Get window title.
bool IsInitialized() const override
Check if the backend is initialized.
SDL_Window * GetNativeWindow() override
Get the underlying SDL_Window pointer for ImGui integration.
WindowStatus GetStatus() const override
Get current window status.
std::string GetBackendName() const override
Get backend name for debugging/logging.
void SetSize(int width, int height) override
Set window dimensions.
void NewImGuiFrame() override
Start a new ImGui frame.
void RenderImGui(gfx::IRenderer *renderer) override
Render ImGui draw data (and viewports if enabled)
int GetSDLVersion() const override
Get SDL version being used.
void ShutdownImGui() override
Shutdown ImGui backends.
void GetSize(int *width, int *height) const override
Get window dimensions.
std::shared_ptr< int16_t > GetAudioBuffer() const override
Get audio buffer (for legacy audio management)
void ShowWindow() override
Show the window.
void ProcessNativeEvent(void *native_event) override
Process a native SDL event (for ImGui integration)
absl::Status InitializeImGui(gfx::IRenderer *renderer) override
Initialize ImGui backends for this window/renderer combo.
Window configuration parameters.
Definition iwindow.h:24
Platform-agnostic window event data.
Definition iwindow.h:65
Window backend status information.
Definition iwindow.h:98