Merge branch 'req-exit' of https://github.com/Tryibion/FlaxEngine into Tryibion-req-exit
This commit is contained in:
@@ -199,6 +199,7 @@ void GameBaseImpl::OnMainWindowClosed()
|
||||
|
||||
// Request engine exit
|
||||
Globals::IsRequestingExit = true;
|
||||
Engine::RequestingExit();
|
||||
}
|
||||
|
||||
void GameBaseImpl::OnPostRender(GPUContext* context, RenderContext& renderContext)
|
||||
|
||||
@@ -70,6 +70,7 @@ Action Engine::LateFixedUpdate;
|
||||
Action Engine::Draw;
|
||||
Action Engine::Pause;
|
||||
Action Engine::Unpause;
|
||||
Action Engine::RequestingExit;
|
||||
Window* Engine::MainWindow = nullptr;
|
||||
|
||||
int32 Engine::Main(const Char* cmdLine)
|
||||
@@ -259,10 +260,12 @@ void Engine::RequestExit(int32 exitCode)
|
||||
{
|
||||
Globals::IsRequestingExit = true;
|
||||
Globals::ExitCode = exitCode;
|
||||
RequestingExit();
|
||||
}
|
||||
#else
|
||||
Globals::IsRequestingExit = true;
|
||||
Globals::ExitCode = exitCode;
|
||||
RequestingExit();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,11 @@ public:
|
||||
/// </summary>
|
||||
static Action Unpause;
|
||||
|
||||
/// <summary>
|
||||
/// Event called when the engine is requesting exit.
|
||||
/// </summary>
|
||||
API_EVENT() static Action RequestingExit;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,9 +59,19 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Globals);
|
||||
// True if fatal error occurred (engine is exiting)
|
||||
static bool FatalErrorOccurred;
|
||||
|
||||
// True if engine need to be closed
|
||||
// True if engine needs to be closed
|
||||
static bool IsRequestingExit;
|
||||
|
||||
/// <summary>
|
||||
/// True if engine needs to be closed
|
||||
/// </summary>
|
||||
API_PROPERTY() FORCE_INLINE static bool GetIsRequestingExit() { return IsRequestingExit; }
|
||||
|
||||
/// <summary>
|
||||
/// True if fatal error occurred (engine is exiting)
|
||||
/// </summary>
|
||||
API_PROPERTY() FORCE_INLINE static bool GetFatalErrorOccurred() { return FatalErrorOccurred; }
|
||||
|
||||
// Exit code
|
||||
static int32 ExitCode;
|
||||
|
||||
|
||||
@@ -271,6 +271,7 @@ void PlatformBase::Fatal(const Char* msg, void* context)
|
||||
Globals::FatalErrorOccurred = true;
|
||||
Globals::IsRequestingExit = true;
|
||||
Globals::ExitCode = -1;
|
||||
Engine::RequestingExit();
|
||||
|
||||
// Collect crash info (platform-dependant implementation that might collect stack trace and/or create memory dump)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user