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 <string>
23
24// Forward declarations
25namespace MetaImGUI {
26class WindowManager;
27class UIRenderer;
28class UpdateChecker;
29class ConfigManager;
30class DialogManager;
31class ISSTracker;
32struct UpdateInfo;
33} // namespace MetaImGUI
34
35namespace MetaImGUI {
36
70public:
73
74 // Disable copy and move
75 Application(const Application&) = delete;
79
96 bool Initialize();
97
111 void Run();
112
128 void Shutdown();
129
134 [[nodiscard]] bool ShouldClose() const;
135
136private:
137 // Subsystem managers
138 std::unique_ptr<WindowManager> m_windowManager;
139 std::unique_ptr<UIRenderer> m_uiRenderer;
140 std::unique_ptr<UpdateChecker> m_updateChecker;
141 std::unique_ptr<ConfigManager> m_configManager;
142 std::unique_ptr<DialogManager> m_dialogManager;
143 std::unique_ptr<ISSTracker> m_issTracker;
144
145 // Application state
146 bool m_initialized = false;
147 bool m_showAboutWindow = false;
148 bool m_showDemoWindow = false;
149 bool m_showUpdateNotification = false;
150 bool m_updateCheckInProgress = false;
151 bool m_showExitDialog = false;
152 bool m_showISSTracker = false;
153
154 // Update checking
155 std::unique_ptr<UpdateInfo> m_latestUpdateInfo;
156
157 // Status bar state
158 std::string m_statusMessage;
159 float m_lastFrameTime = 0.0f;
160
161 // Private methods
162 void ProcessInput();
163 void Render();
164 void CheckForUpdates();
165 void OnUpdateCheckComplete(const UpdateInfo& updateInfo);
166
167 // Context recovery
168 bool OnContextLoss();
169
170 // Input callbacks
171 void OnFramebufferSizeChanged(int width, int height);
172 void OnKeyPressed(int key, int scancode, int action, int mods);
173 void OnWindowCloseRequested();
174
175 // UI event handlers
176 void OnExitRequested();
177 void OnToggleDemoWindow();
178 void OnCheckUpdatesRequested();
179 void OnShowAboutRequested();
180 void OnShowInputDialogRequested();
181 void OnToggleISSTracker();
182
183 // Window size constants
184 static constexpr int DEFAULT_WIDTH = 1200;
185 static constexpr int DEFAULT_HEIGHT = 800;
186 static constexpr const char* WINDOW_TITLE = "MetaImGUI - ImGui Application Template";
187};
188
189} // namespace MetaImGUI
Main application class that orchestrates the application lifecycle.
Definition Application.h:69
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.