MCPcopy Create free account
hub / github.com/ZDoom/Raze / SetWindowSize

Method SetWindowSize

source/common/platform/win32/base_sysfb.cpp:217–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215//==========================================================================
216
217void SystemBaseFrameBuffer::SetWindowSize(int w, int h)
218{
219 if (w < 0 || h < 0)
220 {
221 RestoreWindowedPos();
222 }
223 else
224 {
225 LONG style = WS_VISIBLE | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW;
226 LONG exStyle = WS_EX_WINDOWEDGE;
227 SetWindowLong(mainwindow.GetHandle(), GWL_STYLE, style);
228 SetWindowLong(mainwindow.GetHandle(), GWL_EXSTYLE, exStyle);
229
230 int winx, winy, winw, winh, scrwidth, scrheight;
231
232 RECT r = { 0, 0, w, h };
233 AdjustWindowRectEx(&r, style, false, exStyle);
234 w = int(r.right - r.left);
235 h = int(r.bottom - r.top);
236
237 GetCenteredPos(w, h, winx, winy, winw, winh, scrwidth, scrheight);
238
239 // Just move to (0,0) if we were run with the -0 option.
240 if (Args->CheckParm("-0"))
241 {
242 winx = winy = 0;
243 }
244 else
245 {
246 KeepWindowOnScreen(winx, winy, winw, winh, scrwidth, scrheight);
247 }
248
249 if (!vid_fullscreen)
250 {
251 ShowWindow(mainwindow.GetHandle(), SW_SHOWNORMAL);
252 SetWindowPos(mainwindow.GetHandle(), nullptr, winx, winy, winw, winh, SWP_NOZORDER | SWP_FRAMECHANGED);
253 win_maximized = false;
254 SetSize(GetClientWidth(), GetClientHeight());
255 SaveWindowedPos();
256 }
257 else
258 {
259 win_x = winx;
260 win_y = winy;
261 win_w = winw;
262 win_h = winh;
263 win_maximized = false;
264 vid_fullscreen = false;
265 }
266 }
267}
268
269//==========================================================================
270//

Callers 1

CCMDFunction · 0.45

Calls 3

SetSizeFunction · 0.85
CheckParmMethod · 0.80
GetHandleMethod · 0.45

Tested by

no test coverage detected