From 39ba1583e1812c1dc98c8d9aeb44dbe89f9c05bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 8 Nov 2019 09:14:30 +0100 Subject: [PATCH] Platform: ability to specify exit code in AbstractXApplication. For consistency with all others. --- src/Magnum/Platform/AbstractXApplication.cpp | 2 +- src/Magnum/Platform/AbstractXApplication.h | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Magnum/Platform/AbstractXApplication.cpp b/src/Magnum/Platform/AbstractXApplication.cpp index 309b06820..858d1f1ae 100644 --- a/src/Magnum/Platform/AbstractXApplication.cpp +++ b/src/Magnum/Platform/AbstractXApplication.cpp @@ -128,7 +128,7 @@ int AbstractXApplication::exec() { while(mainLoopIteration()) {} - return 0; + return _exitCode; } bool AbstractXApplication::mainLoopIteration() { diff --git a/src/Magnum/Platform/AbstractXApplication.h b/src/Magnum/Platform/AbstractXApplication.h index 88a250eae..c84634fb3 100644 --- a/src/Magnum/Platform/AbstractXApplication.h +++ b/src/Magnum/Platform/AbstractXApplication.h @@ -126,8 +126,14 @@ class AbstractXApplication { */ bool mainLoopIteration(); - /** @brief Exit application main loop */ - void exit() { _flags |= Flag::Exit; } + /** + * @brief Exit application main loop + * @param exitCode The exit code the application should return + */ + void exit(int exitCode = 0) { + _flags |= Flag::Exit; + _exitCode = exitCode; + } protected: /* Nobody will need to have (and delete) AbstractXApplication*, thus @@ -283,6 +289,7 @@ class AbstractXApplication { Containers::Pointer> _contextHandler; Containers::Pointer _context; + int _exitCode = 0; /** @todo Get this from the created window */ Vector2i _windowSize;