Browse Source

Platform: ability to specify exit code in AbstractXApplication.

For consistency with all others.
pull/381/merge
Vladimír Vondruš 7 years ago
parent
commit
39ba1583e1
  1. 2
      src/Magnum/Platform/AbstractXApplication.cpp
  2. 11
      src/Magnum/Platform/AbstractXApplication.h

2
src/Magnum/Platform/AbstractXApplication.cpp

@ -128,7 +128,7 @@ int AbstractXApplication::exec() {
while(mainLoopIteration()) {} while(mainLoopIteration()) {}
return 0; return _exitCode;
} }
bool AbstractXApplication::mainLoopIteration() { bool AbstractXApplication::mainLoopIteration() {

11
src/Magnum/Platform/AbstractXApplication.h

@ -126,8 +126,14 @@ class AbstractXApplication {
*/ */
bool mainLoopIteration(); 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: protected:
/* Nobody will need to have (and delete) AbstractXApplication*, thus /* Nobody will need to have (and delete) AbstractXApplication*, thus
@ -283,6 +289,7 @@ class AbstractXApplication {
Containers::Pointer<Implementation::AbstractContextHandler<GLConfiguration, Display*, VisualID, Window>> _contextHandler; Containers::Pointer<Implementation::AbstractContextHandler<GLConfiguration, Display*, VisualID, Window>> _contextHandler;
Containers::Pointer<Platform::GLContext> _context; Containers::Pointer<Platform::GLContext> _context;
int _exitCode = 0;
/** @todo Get this from the created window */ /** @todo Get this from the created window */
Vector2i _windowSize; Vector2i _windowSize;

Loading…
Cancel
Save