WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
ImGuiLayer.h
Go to the documentation of this file.
1#pragma once
2
3// ---- ImGuiLayer (GUI subsystem lifecycle) ----------------------------------
4// Manages the Dear ImGui context, GLFW/OpenGL3 backends, DPI scaling,
5// font discovery, and font-atlas building/rebuilding.
6//
7// Following the Gregory "Engine Support" pattern this class encapsulates
8// the entire ImGui lifecycle with explicit init / shutdown phases.
9
10#include <vector>
11#include <string>
12
13struct GLFWwindow;
14struct FontEntry;
15struct UIState;
16class AppWindow;
17
19{
20public:
21 ImGuiLayer() = default;
22 ~ImGuiLayer() = default;
23
24 ImGuiLayer(const ImGuiLayer&) = delete;
25 ImGuiLayer& operator=(const ImGuiLayer&) = delete;
26
30 bool init(GLFWwindow* window, float dpiScale, UIState* uiState);
31
34 void discoverFonts(std::vector<FontEntry>& fonts, int& selectedFont);
35
37 void buildFontAtlas(const std::vector<FontEntry>& fonts,
38 int selectedFont,
39 float fontSize,
40 float dpiScale);
41
43 void rebuildFontAtlasIfDirty(bool& fontsDirty,
44 const std::vector<FontEntry>& fonts,
45 int selectedFont,
46 float fontSize,
47 float dpiScale);
48
50 void beginFrame();
51
54 void endFrame(const AppWindow& window);
55
57 void shutdown();
58};
void rebuildFontAtlasIfDirty(bool &fontsDirty, const std::vector< FontEntry > &fonts, int selectedFont, float fontSize, float dpiScale)
If the fontsDirty flag is set, rebuild the atlas and clear the flag.
void shutdown()
Shut down ImGui backends and destroy the context.
void discoverFonts(std::vector< FontEntry > &fonts, int &selectedFont)
ImGuiLayer & operator=(const ImGuiLayer &)=delete
void endFrame(const AppWindow &window)
~ImGuiLayer()=default
bool init(GLFWwindow *window, float dpiScale, UIState *uiState)
void beginFrame()
Start a new ImGui frame (backend NewFrame + ImGui::NewFrame).
ImGuiLayer()=default
ImGuiLayer(const ImGuiLayer &)=delete
void buildFontAtlas(const std::vector< FontEntry > &fonts, int selectedFont, float fontSize, float dpiScale)
Build (or rebuild) the font atlas from the currently selected font.
Font entry for the UI font selector.
Definition AppState.h:47
Mutable state for the UI layer: dialogs, fonts, log viewer, folder picker.
Definition AppState.h:110