MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / CreateRenderWindow

Function CreateRenderWindow

Source/Player/WinMain.cpp:37–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35static BE1::CVar disp_frequency("disp_frequency", "0", BE1::CVar::Flag::Integer | BE1::CVar::Flag::Archive, "");
36
37static HWND CreateRenderWindow(const TCHAR *title, const TCHAR *classname, int width, int height, bool fullscreen) {
38 int style = WS_VISIBLE;
39 int styleEx;
40 BE1::Rect windowRect;
41
42 if (fullscreen) {
43 styleEx = WS_EX_TOPMOST;
44 style |= WS_POPUP;
45 } else {
46 styleEx = 0;
47 style |= WS_OVERLAPPEDWINDOW;
48 }
49
50 RECT rect;
51 ::SetRect(&rect, 0, 0, width, height);
52 ::AdjustWindowRect(&rect, style, fullscreen ? FALSE : TRUE);
53
54 if (fullscreen) {
55 windowRect.x = 0;
56 windowRect.y = 0;
57 } else {
58 windowRect.x = CW_USEDEFAULT;
59 windowRect.y = CW_USEDEFAULT;
60 }
61
62 windowRect.w = rect.right - rect.left;
63 windowRect.h = rect.bottom - rect.top;
64
65 HWND hwnd = ::CreateWindowEx(
66 styleEx,
67 classname,
68 title,
69 style,
70 windowRect.x, windowRect.y, windowRect.w, windowRect.h,
71 NULL, NULL, (HINSTANCE)GetModuleHandle(NULL), NULL);
72
73 if (fullscreen) {
74 hmenu = GetMenu(hwnd);
75 if (hmenu) {
76 SetMenu(hwnd, NULL);
77 }
78 }
79
80 ::SetForegroundWindow(hwnd);
81 ::SetFocus(hwnd);
82
83 return hwnd;
84}
85
86static void ChangeRenderWindow(HWND hwnd, int width, int height, bool fullscreen) {
87 int style = ::GetWindowLong(hwnd, GWL_STYLE);

Callers 1

InitInstanceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected