WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
AppWindow.h
Go to the documentation of this file.
1#pragma once
2
3// ---- AppWindow (platform-abstraction layer) --------------------------------
4// Owns the GLFW window lifecycle: creation, OpenGL loader (glad), window icon,
5// DPI scale, event polling, buffer swap, and destruction.
6//
7// Follows the Gregory "Engine Support" pattern: a thin wrapper over the
8// platform windowing API that the rest of the application programs against.
9
10struct GLFWwindow;
11
13{
14public:
15 AppWindow() = default;
16 ~AppWindow();
17
18 AppWindow(const AppWindow&) = delete;
19 AppWindow& operator=(const AppWindow&) = delete;
20
23 bool init(int width, int height, const char* title);
24
26 void setIcon(const char* fallbackPath);
27
29 float queryDpiScale() const;
30
32 void pollEvents();
33
35 void swapBuffers();
36
38 [[nodiscard]] bool shouldClose() const;
39
41 void requestClose();
42
44 void framebufferSize(int& w, int& h) const;
45
47 [[nodiscard]] GLFWwindow* handle() const noexcept { return m_window; }
48
49private:
50 GLFWwindow* m_window = nullptr;
51
52 static void errorCallback(int error, const char* description);
53};
AppWindow & operator=(const AppWindow &)=delete
void pollEvents()
Poll platform events (must be called once per frame).
void setIcon(const char *fallbackPath)
Load and set the window icon from a PNG file.
Definition AppWindow.cpp:70
float queryDpiScale() const
Query the monitor content-scale (DPI).
Definition AppWindow.cpp:97
AppWindow()=default
void requestClose()
Signal the window to close.
static void errorCallback(int error, const char *description)
Definition AppWindow.cpp:17
void framebufferSize(int &w, int &h) const
Retrieve the framebuffer size in pixels.
bool init(int width, int height, const char *title)
Definition AppWindow.cpp:34
AppWindow(const AppWindow &)=delete
GLFWwindow * handle() const noexcept
Raw GLFW handle — needed by ImGui backends and CustomTitleBar.
Definition AppWindow.h:47
GLFWwindow * m_window
Definition AppWindow.h:50
void swapBuffers()
Swap the front/back framebuffers.
bool shouldClose() const
Returns true when the user (or code) has requested the window to close.