MCPcopy Create free account
hub / github.com/diasurgical/devilution / HandleDocking

Function HandleDocking

SourceX/platform/switch/docking.cpp:13–47  ·  view source on GitHub ↗

* @brief Do a manual window resize when docking/undocking the Switch */

Source from the content-addressed store, hash-verified

11 * @brief Do a manual window resize when docking/undocking the Switch
12 */
13void 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

Callers 1

PeekMessageAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected