mirror of
https://github.com/thepigeongenerator/sdl_template.git
synced 2025-12-19 10:15:45 +01:00
allow setting of game status & escape exits window
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
|
||||
static gamestatus status = STATUS_RUNNING;
|
||||
|
||||
void set_gamestatus(gamestatus nstatus) {
|
||||
status = nstatus;
|
||||
}
|
||||
|
||||
gamestatus get_gamestatus(void) {
|
||||
return status;
|
||||
}
|
||||
@@ -52,6 +56,6 @@ void error(gamestatus error_code, char const* fmt, ...) {
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "something went wrong! :O", buf, NULL);
|
||||
|
||||
// set status, but exit immediately, as code is not allowed to execute beyond this point
|
||||
status = error_code;
|
||||
set_gamestatus(error_code);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user