From 8212ed2280396a7f7383e96cd57a24a8c1f6eac4 Mon Sep 17 00:00:00 2001 From: Kah Wei Date: Tue, 20 Dec 2022 20:29:28 +0800 Subject: [PATCH] Application::Quit() no longer kills the application if in editor --- SHADE_Managed/src/Engine/Application.cxx | 9 ++++++++- SHADE_Managed/src/Engine/Application.hxx | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/SHADE_Managed/src/Engine/Application.cxx b/SHADE_Managed/src/Engine/Application.cxx index c19bafa6..06ad632f 100644 --- a/SHADE_Managed/src/Engine/Application.cxx +++ b/SHADE_Managed/src/Engine/Application.cxx @@ -44,6 +44,10 @@ namespace SHADE return false; } + bool Application::IsEditor::get() + { + return SHSystemManager::GetSystem() != nullptr; + } int Application::WindowWidth::get() { return SHGraphicsSystemInterface::GetWindowWidth(); @@ -66,6 +70,9 @@ namespace SHADE /*---------------------------------------------------------------------------------*/ void Application::Quit() { - SHGraphicsSystemInterface::CloseWindow(); + if (!IsEditor) + { + SHGraphicsSystemInterface::CloseWindow(); + } } } diff --git a/SHADE_Managed/src/Engine/Application.hxx b/SHADE_Managed/src/Engine/Application.hxx index 8629cf75..4467ec3b 100644 --- a/SHADE_Managed/src/Engine/Application.hxx +++ b/SHADE_Managed/src/Engine/Application.hxx @@ -43,6 +43,13 @@ namespace SHADE bool get(); } /// + /// True if the engine is running in the editor. + /// + static property bool IsEditor + { + bool get(); + } + /// /// Retrieves the designated width of the current window. /// static property int WindowWidth @@ -71,6 +78,7 @@ namespace SHADE /*-----------------------------------------------------------------------------*/ /// /// Marks the application to stop at the end of the current frame. + /// If running in the editor, this function does nothing. /// static void Quit(); };