X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=8b5c2bb474efcf9d70e24b507fc6ca684888e9ba;hb=73b48f8afe7e1e1faf0e87436d7d74b27bba5f27;hp=1444fe8be075de897b9e91c869047097f903bf2f;hpb=969000b44b047ef2d77619bd3882a3f09eb1787d;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 1444fe8b..8b5c2bb4 100644 --- a/src/screens.c +++ b/src/screens.c @@ -7206,6 +7206,7 @@ boolean ConfigureVirtualButtonsMain() char grid_button_old[MAX_GRID_XSIZE][MAX_GRID_YSIZE]; char grid_button_tmp[MAX_GRID_XSIZE][MAX_GRID_YSIZE]; boolean set_grid_button = FALSE; + int nr = GRID_ACTIVE_NR(); int x, y; for (x = 0; x < MAX_GRID_XSIZE; x++) @@ -7350,6 +7351,31 @@ boolean ConfigureVirtualButtonsMain() } break; +#if defined(TARGET_SDL2) + case SDL_WINDOWEVENT: + HandleWindowEvent((WindowEvent *) &event); + + // check if device has been rotated + if (nr != GRID_ACTIVE_NR()) + { + nr = GRID_ACTIVE_NR(); + + for (x = 0; x < MAX_GRID_XSIZE; x++) + for (y = 0; y < MAX_GRID_YSIZE; y++) + grid_button_old[x][y] = grid_button_tmp[x][y] = + overlay.grid_button[x][y]; + } + + break; + + case SDL_APP_WILLENTERBACKGROUND: + case SDL_APP_DIDENTERBACKGROUND: + case SDL_APP_WILLENTERFOREGROUND: + case SDL_APP_DIDENTERFOREGROUND: + HandlePauseResumeEvent((PauseResumeEvent *) &event); + break; +#endif + default: HandleOtherEvents(&event); break; @@ -7369,6 +7395,10 @@ boolean ConfigureVirtualButtonsMain() BackToFront(); } + for (x = 0; x < MAX_GRID_XSIZE; x++) + for (y = 0; y < MAX_GRID_YSIZE; y++) + overlay.grid_button_all[nr][x][y] = overlay.grid_button[x][y]; + overlay.grid_button_highlight = CHAR_GRID_BUTTON_NONE; SetOverlayShowGrid(FALSE);