mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 13:44:58 +00:00
feat: Re-enable service initialization in ServiceBasedApp and improve SDL initialization check in SdlWindowService
This commit is contained in:
@@ -54,8 +54,7 @@ void ServiceBasedApp::Run() {
|
||||
|
||||
try {
|
||||
// Initialize all services
|
||||
// Temporarily disabled for testing
|
||||
// lifecycleController_->InitializeAll();
|
||||
lifecycleController_->InitializeAll();
|
||||
|
||||
// Create the window
|
||||
auto windowService = registry_.GetService<services::IWindowService>();
|
||||
|
||||
@@ -62,12 +62,17 @@ void SdlWindowService::Initialize() {
|
||||
throw std::runtime_error("SdlWindowService already initialized");
|
||||
}
|
||||
|
||||
try {
|
||||
ThrowSdlErrorIfFailed(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO), "SDL_Init failed");
|
||||
} catch (const std::exception& e) {
|
||||
ShowErrorDialog("SDL Initialization Failed",
|
||||
std::string("Failed to initialize SDL subsystems.\n\nError: ") + e.what());
|
||||
throw;
|
||||
// Check if SDL is already initialized
|
||||
if (SDL_WasInit(0) == 0) {
|
||||
try {
|
||||
ThrowSdlErrorIfFailed(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO), "SDL_Init failed");
|
||||
} catch (const std::exception& e) {
|
||||
ShowErrorDialog("SDL Initialization Failed",
|
||||
std::string("Failed to initialize SDL subsystems.\n\nError: ") + e.what());
|
||||
throw;
|
||||
}
|
||||
} else {
|
||||
logging::Logger::GetInstance().Info("SDL already initialized, skipping SDL_Init");
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user