MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / ShowWindowFrame

Method ShowWindowFrame

olcPixelGameEngine.h:6839–6878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6837 }
6838
6839 olc::rcode ShowWindowFrame(const bool bShowFrame)
6840 {
6841 // Oooooooof... yeah....
6842 DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
6843 DWORD dwStyle = WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_THICKFRAME;
6844
6845 RECT rWndRect, rWndRectNow;
6846 GetWindowRect(olc_hWnd, &rWndRectNow);
6847
6848 if (!bShowFrame)
6849 {
6850 LONG_PTR lp = GetWindowLongPtr(olc_hWnd, GWL_STYLE);
6851 SetWindowLongPtr(olc_hWnd, GWL_STYLE, lp & ~(WS_CAPTION | WS_SYSMENU | WS_POPUPWINDOW | WS_THICKFRAME));
6852 lp = GetWindowLongPtr(olc_hWnd, GWL_EXSTYLE);
6853 SetWindowLongPtr(olc_hWnd, GWL_EXSTYLE, lp & ~(WS_EX_WINDOWEDGE));
6854 dwExStyle = WS_EX_APPWINDOW;
6855 dwStyle = 0;
6856 }
6857 else
6858 {
6859 LONG_PTR lp = GetWindowLongPtr(olc_hWnd, GWL_STYLE);
6860 SetWindowLongPtr(olc_hWnd, GWL_STYLE, lp | (WS_CAPTION | WS_SYSMENU | WS_POPUPWINDOW | WS_THICKFRAME));
6861 lp = GetWindowLongPtr(olc_hWnd, GWL_EXSTYLE);
6862 SetWindowLongPtr(olc_hWnd, GWL_EXSTYLE, lp | (WS_EX_WINDOWEDGE));
6863 }
6864
6865
6866 rWndRectNow.right = rWndRectNow.left + vWinSize.x;
6867 rWndRectNow.bottom = rWndRectNow.top + vWinSize.y;
6868 rWndRect = rWndRectNow;
6869 AdjustWindowRectEx(&rWndRect, dwStyle, FALSE, dwExStyle);
6870 int width = rWndRect.right - rWndRect.left;
6871 int height = rWndRect.bottom - rWndRect.top;
6872 vWinPos = { rWndRect.left, rWndRect.top };
6873 vWinSize = { width, height };
6874 SetWindowPos(olc_hWnd, NULL, rWndRectNow.left, rWndRectNow.top, width, height, SWP_SHOWWINDOW);
6875
6876
6877 return olc::OK;
6878 }
6879
6880 olc::rcode SetWindowSize(const olc::vi2d& vWindowPos, const olc::vi2d& vWindowSize)
6881 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected