* @brief Do a manual window resize when docking/undocking the Switch */
| 11 | * @brief Do a manual window resize when docking/undocking the Switch |
| 12 | */ |
| 13 | void HandleDocking() |
| 14 | { |
| 15 | int docked; |
| 16 | switch (appletGetOperationMode()) { |
| 17 | case AppletOperationMode_Handheld: |
| 18 | docked = 0; |
| 19 | break; |
| 20 | case AppletOperationMode_Docked: |
| 21 | docked = 1; |
| 22 | break; |
| 23 | default: |
| 24 | docked = 0; |
| 25 | } |
| 26 | |
| 27 | int display_width; |
| 28 | int display_height; |
| 29 | if ((currently_docked == -1) || (docked && !currently_docked) || (!docked && currently_docked)) { |
| 30 | // docked mode has changed, update window size |
| 31 | if (docked) { |
| 32 | display_width = 1920; |
| 33 | display_height = 1080; |
| 34 | currently_docked = 1; |
| 35 | } else { |
| 36 | display_width = 1280; |
| 37 | display_height = 720; |
| 38 | currently_docked = 0; |
| 39 | } |
| 40 | // remove leftover-garbage on screen |
| 41 | for (int i = 0; i < 3; i++) { |
| 42 | SDL_RenderClear(renderer); |
| 43 | SDL_RenderPresent(renderer); |
| 44 | } |
| 45 | SDL_SetWindowSize(window, display_width, display_height); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | } // namespace dvl |