Added support to exit a game on Android device when Back button is
clicked
This commit is contained in:
1 parent
ad88083f53
commit
6d3440ba1f
1 file changed
+8
@@ -7,6 +7,7 @@
|
|||||||
#include "SDL_events.h"
|
#include "SDL_events.h"
|
||||||
#include "SDL_hints.h"
|
#include "SDL_hints.h"
|
||||||
#include "SDL_image.h"
|
#include "SDL_image.h"
|
||||||
|
#include "SDL_keycode.h"
|
||||||
#include "SDL_mixer.h"
|
#include "SDL_mixer.h"
|
||||||
#include "SDL_pixels.h"
|
#include "SDL_pixels.h"
|
||||||
#include "SDL_platform.h"
|
#include "SDL_platform.h"
|
||||||
@@ -757,6 +758,13 @@ void handle_events() {
|
|||||||
switch (GameEngine.event.type) {
|
switch (GameEngine.event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
GameEngine.running = false;
|
GameEngine.running = false;
|
||||||
|
break;
|
||||||
|
case SDL_KEYUP:
|
||||||
|
if (GameEngine.event.key.keysym.sym == SDLK_AC_BACK) {
|
||||||
|
// Handle Android's back button
|
||||||
|
GameEngine.running = false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user