Skip to content

Commit 9202d19

Browse files
committed
Set clipping region to be the circle
1 parent c4b7891 commit 9202d19

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Win32Application.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
HWND Win32Application::m_hwnd = nullptr;
1616

17+
static void SetClippingRegion(HWND hWnd)
18+
{
19+
RECT rect = {};
20+
GetWindowRect(hWnd, &rect);
21+
HRGN rgn = CreateEllipticRgnIndirect(&rect);
22+
SetWindowRgn(hWnd, rgn, false);
23+
}
24+
1725
int Win32Application::Run(DXSample* pSample, HINSTANCE hInstance, int nCmdShow)
1826
{
1927
// Parse the command line parameters
@@ -52,6 +60,9 @@ int Win32Application::Run(DXSample* pSample, HINSTANCE hInstance, int nCmdShow)
5260
hInstance,
5361
pSample);
5462

63+
// Set the clipping region
64+
SetClippingRegion(m_hwnd);
65+
5566
// Initialize the sample. OnInit is defined in each child-implementation of DXSample.
5667
pSample->OnInit();
5768

0 commit comments

Comments
 (0)