if (new_display_width != video.display_width ||
new_display_height != video.display_height)
{
+ int nr = GRID_ACTIVE_NR(); // previous screen orientation
+
video.display_width = new_display_width;
video.display_height = new_display_height;
SDLSetScreenProperties();
+
+ // check if screen orientation has changed (should always be true here)
+ if (nr != GRID_ACTIVE_NR())
+ {
+ int x, y;
+
+ if (game_status == GAME_MODE_SETUP)
+ {
+ // save active virtual buttons (in case of just configuring them)
+ 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];
+ }
+
+ nr = GRID_ACTIVE_NR();
+
+ overlay.grid_xsize = overlay.grid_xsize_all[nr];
+ overlay.grid_ysize = overlay.grid_ysize_all[nr];
+
+ for (x = 0; x < MAX_GRID_XSIZE; x++)
+ for (y = 0; y < MAX_GRID_YSIZE; y++)
+ overlay.grid_button[x][y] = overlay.grid_button_all[nr][x][y];
+ }
}
}
#endif
}
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;