|
MetaImGUI 1.0.0
ImGui Application Template for C++20
|
Manages GLFW window creation, lifecycle, and input handling. More...
#include <WindowManager.h>
Public Member Functions | |
| WindowManager (std::string title, int width, int height) | |
| Construct a new Window Manager. | |
| ~WindowManager () | |
| WindowManager (const WindowManager &)=delete | |
| WindowManager & | operator= (const WindowManager &)=delete |
| WindowManager (WindowManager &&)=delete | |
| WindowManager & | operator= (WindowManager &&)=delete |
| bool | Initialize () |
| Initialize the window and GLFW. | |
| void | Shutdown () |
| Shutdown and cleanup the window. | |
| bool | ShouldClose () const |
| Check if the window should close. | |
| void | PollEvents () |
| Poll for input events. | |
| void | BeginFrame () |
| Prepare the window for a new frame. | |
| void | EndFrame () |
| Present the rendered frame. | |
| void | GetFramebufferSize (int &width, int &height) const |
| Get the current framebuffer size. | |
| void | GetWindowSize (int &width, int &height) const |
| Get the current window size. | |
| GLFWwindow * | GetNativeWindow () const |
| Get the GLFW window pointer (for ImGui integration) | |
| void | RequestClose () |
| Request the window to close. | |
| void | SetFramebufferSizeCallback (std::function< void(int, int)> callback) |
| Set framebuffer size callback. | |
| void | SetKeyCallback (std::function< void(int, int, int, int)> callback) |
| Set key input callback. | |
| void | SetWindowCloseCallback (std::function< void()> callback) |
| Set window close callback. | |
| void | CancelClose () |
| Cancel a close request (clears the should close flag) | |
| void | SetContextLossCallback (std::function< bool()> callback) |
| Set context loss callback. | |
| bool | ValidateContext () |
| Check if context is valid and attempt recovery if not. | |
Manages GLFW window creation, lifecycle, and input handling.
WindowManager encapsulates all GLFW-specific operations, providing a clean interface for window management without exposing GLFW details to the application.
Definition at line 35 of file WindowManager.h.
| MetaImGUI::WindowManager::WindowManager | ( | std::string | title, |
| int | width, | ||
| int | height | ||
| ) |
Construct a new Window Manager.
| title | Window title |
| width | Initial window width |
| height | Initial window height |
Definition at line 33 of file WindowManager.cpp.
| MetaImGUI::WindowManager::~WindowManager | ( | ) |
Definition at line 36 of file WindowManager.cpp.
References Shutdown().
|
delete |
|
delete |
| void MetaImGUI::WindowManager::BeginFrame | ( | ) |
Prepare the window for a new frame.
Definition at line 131 of file WindowManager.cpp.
References GL_CONTEXT_LOST, LOG_ERROR, LOG_WARNING, and ValidateContext().
| void MetaImGUI::WindowManager::CancelClose | ( | ) |
Cancel a close request (clears the should close flag)
Definition at line 221 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::EndFrame | ( | ) |
Present the rendered frame.
Definition at line 161 of file WindowManager.cpp.
References LOG_ERROR, and ValidateContext().
| void MetaImGUI::WindowManager::GetFramebufferSize | ( | int & | width, |
| int & | height | ||
| ) | const |
Get the current framebuffer size.
| width | Output: framebuffer width |
| height | Output: framebuffer height |
Definition at line 176 of file WindowManager.cpp.
|
inline |
Get the GLFW window pointer (for ImGui integration)
Definition at line 102 of file WindowManager.h.
| void MetaImGUI::WindowManager::GetWindowSize | ( | int & | width, |
| int & | height | ||
| ) | const |
Get the current window size.
| width | Output: window width |
| height | Output: window height |
Definition at line 185 of file WindowManager.cpp.
| bool MetaImGUI::WindowManager::Initialize | ( | ) |
Initialize the window and GLFW.
Definition at line 40 of file WindowManager.cpp.
|
delete |
|
delete |
| void MetaImGUI::WindowManager::PollEvents | ( | ) |
Poll for input events.
Definition at line 127 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::RequestClose | ( | ) |
Request the window to close.
Definition at line 194 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::SetContextLossCallback | ( | std::function< bool()> | callback | ) |
Set context loss callback.
| callback | Function to call when OpenGL context is lost (for recovery) |
Definition at line 227 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::SetFramebufferSizeCallback | ( | std::function< void(int, int)> | callback | ) |
Set framebuffer size callback.
| callback | Function to call when framebuffer size changes |
Definition at line 200 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::SetKeyCallback | ( | std::function< void(int, int, int, int)> | callback | ) |
Set key input callback.
| callback | Function to call when key is pressed |
Definition at line 207 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::SetWindowCloseCallback | ( | std::function< void()> | callback | ) |
Set window close callback.
| callback | Function to call when window close is requested |
Definition at line 214 of file WindowManager.cpp.
| bool MetaImGUI::WindowManager::ShouldClose | ( | ) | const |
Check if the window should close.
Definition at line 123 of file WindowManager.cpp.
| void MetaImGUI::WindowManager::Shutdown | ( | ) |
Shutdown and cleanup the window.
Definition at line 109 of file WindowManager.cpp.
Referenced by ~WindowManager().
| bool MetaImGUI::WindowManager::ValidateContext | ( | ) |
Check if context is valid and attempt recovery if not.
Definition at line 231 of file WindowManager.cpp.
References GL_CONTEXT_LOST, and LOG_WARNING.
Referenced by BeginFrame(), and EndFrame().