mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-22 14:45:37 +00:00
Fail init if SDL window creation fails
This commit is contained in:
@@ -1301,6 +1301,13 @@ bool GpDisplayDriver_SDL_GL2::Init()
|
||||
windowFlags |= SDL_WINDOW_RESIZABLE;
|
||||
|
||||
m_window = SDL_CreateWindow(GP_APPLICATION_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, m_windowWidthPhysical, m_windowHeightPhysical, windowFlags);
|
||||
if (!m_window)
|
||||
{
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "Failed to create window: %s", SDL_GetError());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_isFullScreen)
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpFontHandler.h"
|
||||
#include "IGpInputDriver.h"
|
||||
#include "IGpLogDriver.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -119,9 +120,17 @@ int GpMain::Run()
|
||||
appEnvironment->SetSystemServices(g_gpGlobalConfig.m_systemServices);
|
||||
|
||||
// Start the display loop
|
||||
displayDriver->Init();
|
||||
|
||||
appEnvironment->Run();
|
||||
if (displayDriver->Init())
|
||||
{
|
||||
appEnvironment->Run();
|
||||
}
|
||||
else
|
||||
{
|
||||
IGpLogDriver *logger = g_gpGlobalConfig.m_logger;
|
||||
if (logger)
|
||||
logger->Printf(IGpLogDriver::Category_Error, "Failed to start display driver");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clean up
|
||||
if (inputDrivers)
|
||||
|
Reference in New Issue
Block a user