MCPcopy Create free account
hub / github.com/NetHack/NetHack / mswin_set_splash_data

Function mswin_set_splash_data

win/win32/mhsplash.c:54–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52} SplashData;
53
54static void
55mswin_set_splash_data(HWND hWnd, SplashData * sd, double scale)
56{
57 RECT client_rect;
58 RECT window_rect;
59 RECT ok_control_rect;
60 RECT text_control_rect;
61
62 GetClientRect(hWnd, &client_rect);
63 GetWindowRect(hWnd, &window_rect);
64 GetWindowRect(GetDlgItem(hWnd, IDOK), &ok_control_rect);
65 GetWindowRect(GetDlgItem(hWnd, IDC_EXTRAINFO), &text_control_rect);
66
67 sd->boarder_width = (window_rect.right - window_rect.left) -
68 (client_rect.right - client_rect.left);
69 sd->boarder_height = (window_rect.bottom - window_rect.top) -
70 (client_rect.bottom - client_rect.top);
71
72 sd->ok_control_width = ok_control_rect.right - ok_control_rect.left;
73 sd->ok_control_height = ok_control_rect.bottom - ok_control_rect.top;
74
75 sd->width = (int)(scale * SPLASH_WIDTH_96DPI);
76 sd->height = (int)(scale * SPLASH_HEIGHT_96DPI);
77 sd->offset_x = (int)(scale * SPLASH_OFFSET_X_96DPI);
78 sd->offset_y = (int)(scale * SPLASH_OFFSET_Y_96DPI);
79 sd->version_x = (int)(scale * SPLASH_VERSION_X_96DPI);
80 sd->version_y = (int)(scale * SPLASH_VERSION_Y_96DPI);
81
82 sd->client_width = sd->width + sd->offset_x * 2;
83 sd->client_height = sd->height + sd->ok_control_height +
84 sd->offset_y * 3;
85
86 sd->window_width = sd->client_width + sd->boarder_width;
87 sd->window_height = sd->client_height + sd->boarder_height;
88
89 sd->ok_control_offset_x = (sd->client_width - sd->ok_control_width) / 2;
90 sd->ok_control_offset_y = sd->client_height - sd->ok_control_height - sd->offset_y;
91
92 sd->text_control_width = sd->client_width - sd->offset_x * 2;
93 sd->text_control_height = text_control_rect.bottom - text_control_rect.top;
94
95 sd->text_control_offset_x = sd->offset_x;
96 sd->text_control_offset_y = sd->ok_control_offset_y - sd->offset_y -
97 sd->text_control_height;
98
99 if (sd->hFont != NULL)
100 DeleteObject(sd->hFont);
101
102 sd->hFont = mswin_create_splashfont(hWnd);
103
104 MoveWindow(hWnd, window_rect.left, window_rect.top,
105 sd->window_width, sd->window_height, TRUE);
106
107 MoveWindow(GetDlgItem(hWnd, IDOK),
108 sd->ok_control_offset_x, sd->ok_control_offset_y,
109 sd->ok_control_width, sd->ok_control_height, TRUE);
110
111 MoveWindow(GetDlgItem(hWnd, IDC_EXTRAINFO),

Callers 2

NHSplashWndProcFunction · 0.85

Calls 1

mswin_create_splashfontFunction · 0.85

Tested by

no test coverage detected