exit DlgMainMenu when user requests closing it
This commit is contained in:
5
main.cpp
5
main.cpp
@@ -30,6 +30,7 @@ int main(int argc, char **argv) {
|
||||
SDL_Log("error creating window");
|
||||
return 1;
|
||||
}
|
||||
SDL_WindowID sdl_menu_win_id = SDL_GetWindowID(sdl_menu_win);
|
||||
|
||||
SDL_Renderer *sdl_renderer = SDL_CreateRenderer(sdl_window, NULL);
|
||||
if (sdl_renderer == NULL) {
|
||||
@@ -117,6 +118,10 @@ int main(int argc, char **argv) {
|
||||
rousku.shouldRunAway(event.motion.x < (float) rousku.getImage()->w / 2 ? 1 : -1); // selecting direction to run in parameter
|
||||
}
|
||||
}
|
||||
} else if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
|
||||
if (event.window.windowID == sdl_menu_win_id) {
|
||||
dlg_menu->setExit(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user