13 "WindowManager initialized");
24 "WindowManager destroyed");
31 "Window with title '{}' already exists", create_info.
title);
46 if (window->get_create_info().register_for_processing) {
51 "Created window '{}' - total: {}", create_info.
title,
m_windows.size());
66 const std::string title = window->get_create_info().title;
69 auto it = std::ranges::find(
m_windows, window);
73 "Destroyed window '{}' - remaining: {}", title,
m_windows.size());
89 std::vector<std::shared_ptr<Window>> ptrs;
114 [](
const auto& w) {
return w->should_close(); });
119 size_t destroyed_count = 0;
121 std::vector<std::shared_ptr<Window>> to_destroy;
123 if (window->should_close()) {
124 to_destroy.push_back(window);
128 for (
auto& window : to_destroy) {
133 if (destroyed_count > 0) {
135 "Destroyed {} closed window(s)", destroyed_count);
138 return destroyed_count;
151 "SDL backend not implemented");
156 "Native backend not implemented");
161 "Unknown windowing backend: {}",
169 const auto& title = window->get_create_info().title;
190 std::function<
void()> hook)
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_PRINT(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
static std::string get_platform()
Gets the current GLFW platform (Wayland, X11, etc.)
static void terminate()
Terminates the GLFW library if initialized and no windows remain.
std::shared_ptr< Window > get_window(size_t index) const
Gets window by index.
bool process()
Process windows for one frame.
std::mutex m_hooks_mutex
Mutex for protecting m_windows and m_window_lookup.
std::vector< std::shared_ptr< Window > > get_windows() const
Gets all active windows.
std::vector< std::shared_ptr< Window > > m_windows
std::shared_ptr< Window > find_window(const std::string &title) const
Finds window by title.
WindowManager(const GlobalGraphicsConfig &config)
Constructs WindowManager with global graphics config.
std::shared_ptr< Window > create_window_internal(const WindowCreateInfo &create_info)
Factory for creating backend-specific windows.
bool any_window_should_close() const
Checks if any window should close.
void register_frame_hook(const std::string &name, std::function< void()> hook)
Register a hook that runs every frame.
size_t destroy_closed_windows()
Destroys all windows that should close.
void destroy_window(const std::shared_ptr< Window > &window)
Destroys a window by pointer.
void remove_from_lookup(const std::shared_ptr< Window > &window)
Removes window from lookup table.
std::shared_ptr< Window > create_window(const WindowCreateInfo &create_info)
Creates a new window.
GlobalGraphicsConfig m_config
std::unordered_map< std::string, std::function< void()> > m_frame_hooks
Calls all registered frame hooks.
std::unordered_map< std::string, std::weak_ptr< Window > > m_window_lookup
bool destroy_window_by_title(const std::string &title)
Destroys a window by title.
std::vector< std::shared_ptr< Window > > m_processing_windows
size_t window_count() const
Gets number of active windows.
void unregister_frame_hook(const std::string &name)
Unregister a previously registered frame hook.
@ WindowingSubsystem
Windowing system operations (GLFW, SDL)
@ Core
Core engine, backend, subsystems.
GraphicsSurfaceInfo surface_info
System-wide configuration for visual stream processing.
@ SDL
SDL2 (alternative, if implemented)
@ GLFW
GLFW3 (default, cross-platform)
@ NATIVE
Platform-native (Win32/X11/Cocoa, if implemented)
GlfwPreInitConfig glfw_preinit_config
Pre-initialization configuration for GLFW.
WindowingBackend windowing_backend
Selected windowing backend.
GraphicsApi requested_api
Selected graphics API for rendering.
std::string title
Window title/identifier.
uint32_t width
Initial window dimensions.
Configuration for creating a single window instance.