MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::GLFWSingleton Class Reference

Singleton utility for managing global GLFW initialization and termination. More...

#include <GlfwSingleton.hpp>

+ Collaboration diagram for MayaFlux::Core::GLFWSingleton:

Static Public Member Functions

static bool initialize ()
 Initializes the GLFW library if not already initialized.
 
static void terminate ()
 Terminates the GLFW library if initialized and no windows remain.
 
static void configure (const GlfwPreInitConfig &config)
 Configures GLFW with pre-initialization hints.
 
static void mark_window_created ()
 Increments the count of active GLFW windows.
 
static void mark_window_destroyed ()
 Decrements the count of active GLFW windows.
 
static std::vector< MonitorInfoenumerate_monitors ()
 Enumerates all connected monitors and their information.
 
static MonitorInfo get_primary_monitor ()
 Retrieves information about the primary monitor.
 
static MonitorInfo get_monitor (int32_t id)
 Retrieves information about a specific monitor by ID.
 
static void set_error_callback (std::function< void(int, const char *)> callback)
 Sets a custom error callback for GLFW errors.
 
static bool is_initialized ()
 Checks if GLFW has been initialized.
 
static uint32_t get_window_count ()
 Gets the current count of active GLFW windows.
 
static std::string get_platform ()
 Gets the current GLFW platform (Wayland, X11, etc.)
 
static bool is_wayland ()
 Checks if running on Wayland.
 
static std::vector< const char * > get_required_instance_extensions ()
 Retrieves the list of required Vulkan instance extensions for GLFW.
 

Static Private Attributes

static bool s_initialized {}
 Tracks whether GLFW has been initialized.
 
static uint32_t s_window_count {}
 Number of currently active GLFW windows.
 
static std::function< void(int, const char *)> s_error_callback
 Internal GLFW error callback that forwards to the user-defined callback if set.
 
static bool s_configured {}
 
static GlfwPreInitConfig s_preinit_config {}
 

Detailed Description

Singleton utility for managing global GLFW initialization and termination.

GLFWSingleton ensures that the GLFW library is initialized exactly once per process, and is properly terminated when no more windows are in use. This prevents redundant initialization and resource leaks, and provides a safe, centralized mechanism for managing the GLFW global state.

Usage:

This class is not intended to be instantiated; all methods and state are static.

Definition at line 25 of file GlfwSingleton.hpp.


The documentation for this class was generated from the following files: