Application::Quit() no longer kills the application if in editor

This commit is contained in:
Kah Wei 2022-12-20 20:29:28 +08:00
parent c479e6c8d8
commit 8212ed2280
2 changed files with 16 additions and 1 deletions

View File

@ -44,6 +44,10 @@ namespace SHADE
return false;
}
bool Application::IsEditor::get()
{
return SHSystemManager::GetSystem<SHEditor>() != nullptr;
}
int Application::WindowWidth::get()
{
return SHGraphicsSystemInterface::GetWindowWidth();
@ -66,6 +70,9 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/
void Application::Quit()
{
SHGraphicsSystemInterface::CloseWindow();
if (!IsEditor)
{
SHGraphicsSystemInterface::CloseWindow();
}
}
}

View File

@ -43,6 +43,13 @@ namespace SHADE
bool get();
}
/// <summary>
/// True if the engine is running in the editor.
/// </summary>
static property bool IsEditor
{
bool get();
}
/// <summary>
/// Retrieves the designated width of the current window.
/// </summary>
static property int WindowWidth
@ -71,6 +78,7 @@ namespace SHADE
/*-----------------------------------------------------------------------------*/
/// <summary>
/// Marks the application to stop at the end of the current frame.
/// If running in the editor, this function does nothing.
/// </summary>
static void Quit();
};