Ember
Loading...
Searching...
No Matches
App.cpp
Go to the documentation of this file.
1#include "App/App.h"
2#include "App/MainFrame.h"
4#include "Utils/Logger.h"
5#ifdef HAVE_SPDLOG
7#endif
8
10
12 // Initialize image handlers for PNG support
13 wxInitAllImageHandlers();
14
15 // Unified logging - appears in both UI panel and console/file
16 LOG_INFO("System", "EmberForge Application starting up...");
17 LOG_INFO("System", "Unified logging active - messages appear in UI panel AND console/file");
18
19 // Load application preferences to determine window style
22 prefs.LoadFromFile(configPath);
23
24 // Apply console color preference from loaded settings
25 const auto &logSettings = prefs.GetBottomPanelSettings().logTab;
26 EmberCore::Logger::GetInstance().SetConsoleColorsEnabled(logSettings.enableConsoleColors);
27
28 // Build window style - always use default (resizable)
29 long windowStyle = wxDEFAULT_FRAME_STYLE;
30
31 // Get screen dimensions for responsive sizing
32 wxDisplaySize(&m_screenWidth, &m_screenHeight);
33
34 // Calculate responsive window size (80% of screen size, minimum 1000x700)
35 int windowWidth = wxMax(1000, static_cast<int>(m_screenWidth * 0.8));
36 int windowHeight = wxMax(700, static_cast<int>(m_screenHeight * 0.8));
37
38 // Center window on screen
39 int windowX = (m_screenWidth - windowWidth) / 2;
40 int windowY = (m_screenHeight - windowHeight) / 2;
41
42 // Create main frame with responsive sizing and custom style
43 m_frame = new MainFrame("EmberForge", wxPoint(windowX, windowY), wxSize(windowWidth, windowHeight), windowStyle);
44 m_frame->Show(true);
45
46 return true;
47}
48
50#ifdef HAVE_SPDLOG
51 // Shutdown spdlog before static destructors run; avoids use-after-free
52 // when SpdlogManager destructor would run after spdlog's registry.
53 EmberCore::SpdlogManager::GetInstance().Shutdown();
54#endif
55 return wxApp::OnExit();
56}
wxIMPLEMENT_APP(App)
#define LOG_INFO(category, message)
Definition Logger.h:114
Main application class for EmberForge.
Definition App.h:32
bool OnInit() override
Application initialization.
Definition App.cpp:11
int m_screenWidth
Screen width at startup.
Definition App.h:61
MainFrame * m_frame
Pointer to main frame window.
Definition App.h:60
int m_screenHeight
Screen height at startup.
Definition App.h:62
int OnExit() override
Application cleanup.
Definition App.cpp:49
static Logger & GetInstance()
Definition Logger.cpp:251
void SetConsoleColorsEnabled(bool enabled)
Definition Logger.cpp:240
static AppPreferencesManager & GetInstance()
static EmberCore::String GetDefaultConfigPath()
Main application window for EmberForge.
Definition MainFrame.h:67
std::string String
Framework-agnostic string type.
Definition String.h:14