MetaImGUI 1.0.0
ImGui Application Template for C++20
Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1/*
2 MetaImGUI
3 Copyright (C) 2026 A P Nicholson
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>.
17*/
18
19#pragma once
20
21#include <memory>
22#include <mutex>
23#include <string>
24
25// Forward declarations
26namespace MetaImGUI {
27class WindowManager;
28class UIRenderer;
29class UpdateChecker;
30class ConfigManager;
31class DialogManager;
32class ISSTracker;
33struct UpdateInfo;
34} // namespace MetaImGUI
35
36namespace MetaImGUI {
37
71public:
74
75 // Disable copy and move
76 Application(const Application&) = delete;
80
97 bool Initialize();
98
112 void Run();
113
129 void Shutdown();
130
135 [[nodiscard]] bool ShouldClose() const;
136
137private:
138 // Subsystem managers
139 std::unique_ptr<WindowManager> m_windowManager;
140 std::unique_ptr<UIRenderer> m_uiRenderer;
141 std::unique_ptr<UpdateChecker> m_updateChecker;
142 std::unique_ptr<ConfigManager> m_configManager;
143 std::unique_ptr<DialogManager> m_dialogManager;
144 std::unique_ptr<ISSTracker> m_issTracker;
145
146 // Application state
147 bool m_initialized = false;
148 bool m_showAboutWindow = false;
149 bool m_showDemoWindow = false;
150 bool m_showUpdateNotification = false;
151 bool m_updateCheckInProgress = false;
152 bool m_showExitDialog = false;
153 bool m_showISSTracker = false;
154
155 // Update checking
156 std::unique_ptr<UpdateInfo> m_latestUpdateInfo;
157
158 // Thread-safe handoff of update results from worker thread to main thread
159 std::mutex m_updateResultMutex;
160 std::unique_ptr<UpdateInfo> m_pendingUpdateResult;
161
162 // Status bar state
163 std::string m_statusMessage;
164 float m_lastFrameTime = 0.0f;
165
166 // Private methods
167 void ProcessInput();
168 void Render();
169 void CheckForUpdates();
170 void OnUpdateCheckComplete(const UpdateInfo& updateInfo);
171
172 // Context recovery
173 bool OnContextLoss();
174
175 // Input callbacks
176 void OnFramebufferSizeChanged(int width, int height);
177 void OnKeyPressed(int key, int scancode, int action, int mods);
178 void OnWindowCloseRequested();
179
180 // UI event handlers
181 void OnExitRequested();
182 void OnToggleDemoWindow();
183 void OnCheckUpdatesRequested();
184 void OnShowAboutRequested();
185 void OnShowInputDialogRequested();
186 void OnToggleISSTracker();
187
188 // Window size constants
189 static constexpr int DEFAULT_WIDTH = 1200;
190 static constexpr int DEFAULT_HEIGHT = 800;
191 static constexpr const char* WINDOW_TITLE = "MetaImGUI - ImGui Application Template";
192};
193
194} // namespace MetaImGUI
Main application class that orchestrates the application lifecycle.
Definition Application.h:70
void Shutdown()
Shutdown the application and cleanup resources.
bool ShouldClose() const
Check if the application should close.
Application(Application &&)=delete
bool Initialize()
Initialize the application and all subsystems.
Application(const Application &)=delete
Application & operator=(const Application &)=delete
void Run()
Run the main application loop.
Application & operator=(Application &&)=delete
Configuration manager for persistent application settings.
Manager for common UI dialogs.
ISS Tracker that fetches ISS position data asynchronously.
Definition ISSTracker.h:51
Handles all ImGui rendering operations.
Definition UIRenderer.h:40
Manages GLFW window creation, lifecycle, and input handling.