MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ GlfwWindow() [1/3]

MayaFlux::Core::GlfwWindow::GlfwWindow ( const WindowCreateInfo create_info,
const GraphicsSurfaceInfo surface_info,
GlobalGraphicsConfig::GraphicsApi  api,
GlfwPreInitConfig  pre_init_config = {} 
)

Creates a window with the given configuration.

Parameters
create_infoWindow creation parameters
surface_infoGraphics surface parameters
apiRequested graphics API
pre_init_configOptional pre-initialization configuration

Definition at line 18 of file GlfwWindow.cpp.

20 : m_create_info(create_info)
21{
22 GLFWSingleton::configure(pre_init_config);
23
25 error<std::runtime_error>(Journal::Component::Core, Journal::Context::WindowingSubsystem, std::source_location::current(),
26 "Failed to initialize GLFW for window creation");
27 }
28
29 configure_window_hints(surface_info, api);
30
31 GLFWmonitor* monitor = nullptr;
32 if (create_info.fullscreen) {
33 if (create_info.monitor_id >= 0) {
34 int count {};
35 std::span<GLFWmonitor*> monitors(glfwGetMonitors(&count), count);
36 if (create_info.monitor_id < count) {
37 monitor = monitors[create_info.monitor_id];
38 }
39 } else {
40 monitor = glfwGetPrimaryMonitor();
41 }
42 }
43
44 m_window = glfwCreateWindow(
45 create_info.width,
46 create_info.height,
47 create_info.title.c_str(),
48 monitor,
49 nullptr);
50
51 if (!m_window) {
52 error<std::runtime_error>(Journal::Component::Core, Journal::Context::WindowingSubsystem, std::source_location::current(),
53 "Failed to create GLFW window: {}", create_info.title);
54 }
55
56 glfwSetWindowUserPointer(m_window, this);
58
59 int w {}, h {};
60 glfwGetWindowSize(m_window, &w, &h);
63 m_state.is_visible = false;
64
66
68 "Created window '{}' ({}x{})", create_info.title, w, h);
69}
#define MF_INFO(comp, ctx,...)
static void mark_window_created()
Increments the count of active GLFW windows.
static bool initialize()
Initializes the GLFW library if not already initialized.
static void configure(const GlfwPreInitConfig &config)
Configures GLFW with pre-initialization hints.
WindowCreateInfo m_create_info
void configure_window_hints(const GraphicsSurfaceInfo &surface_info, GlobalGraphicsConfig::GraphicsApi api) const
@ WindowingSubsystem
Windowing system operations (GLFW, SDL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Core::GLFWSingleton::configure(), configure_window_hints(), MayaFlux::Journal::Core, MayaFlux::Core::WindowState::current_height, MayaFlux::Core::WindowState::current_width, MayaFlux::Core::WindowCreateInfo::fullscreen, MayaFlux::Core::WindowCreateInfo::height, MayaFlux::Core::GLFWSingleton::initialize(), MayaFlux::Core::WindowState::is_visible, m_state, m_window, MayaFlux::Core::GLFWSingleton::mark_window_created(), MF_INFO, MayaFlux::Core::WindowCreateInfo::monitor_id, setup_callbacks(), MayaFlux::Core::WindowCreateInfo::title, MayaFlux::Core::WindowCreateInfo::width, and MayaFlux::Journal::WindowingSubsystem.

+ Here is the call graph for this function: