diff --git a/BeefLibs/Beefy2D/src/BFWindow.bf b/BeefLibs/Beefy2D/src/BFWindow.bf index e6f9da70..41d0ae1f 100644 --- a/BeefLibs/Beefy2D/src/BFWindow.bf +++ b/BeefLibs/Beefy2D/src/BFWindow.bf @@ -47,6 +47,7 @@ namespace Beefy FakeFocus = 0x0100'0000, ShowMinimized = 0x0200'0000, ShowMaximized = 0x0400'0000, + AllowFullscreen = 0x0800'0000, }; [AllowDuplicates] diff --git a/BeefySysLib/BFWindow.h b/BeefySysLib/BFWindow.h index 7c43c45c..22a1de46 100644 --- a/BeefySysLib/BFWindow.h +++ b/BeefySysLib/BFWindow.h @@ -53,6 +53,7 @@ enum BFWINDOW_FAKEFOCUS = 0x1000000, BFWINDOW_SHOWMINIMIZED = 0x2000000, BFWINDOW_SHOWMAXIMIZED = 0x4000000, + BFWINDOW_ALLOW_FULLSCREEN = 0x8000000 }; diff --git a/BeefySysLib/platform/win/DXRenderDevice.cpp b/BeefySysLib/platform/win/DXRenderDevice.cpp index 702fd71a..3ed1ddf4 100644 --- a/BeefySysLib/platform/win/DXRenderDevice.cpp +++ b/BeefySysLib/platform/win/DXRenderDevice.cpp @@ -1033,7 +1033,7 @@ void DXSetConstantData::Render(RenderDevice* renderDevice, RenderWindow* renderW /// -DXRenderWindow::DXRenderWindow(DXRenderDevice* renderDevice, HWND hWnd, bool windowed) +DXRenderWindow::DXRenderWindow(DXRenderDevice* renderDevice, WinBFWindow* window, bool windowed) { BP_ZONE("DXRenderWindow::DXRenderWindow"); @@ -1046,7 +1046,8 @@ DXRenderWindow::DXRenderWindow(DXRenderDevice* renderDevice, HWND hWnd, bool win mRenderDevice = renderDevice; mDXRenderDevice = renderDevice; - mHWnd = hWnd; + mWindow = window; + mHWnd = window->mHWnd; Resized(); @@ -1120,6 +1121,9 @@ void DXRenderWindow::ReinitNative() descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; mDXRenderDevice->mD3DDevice->CreateTexture2D(&descDepth, NULL, &mD3DDepthBuffer); + + if ((mWindow->mFlags & BFWINDOW_ALLOW_FULLSCREEN) == 0) + mDXRenderDevice->mDXGIFactory->MakeWindowAssociation(mHWnd, DXGI_MWA_NO_ALT_ENTER); DXCHECK(mDXRenderDevice->mD3DDevice->CreateDepthStencilView(mD3DDepthBuffer, NULL, &mD3DDepthStencilView)); } diff --git a/BeefySysLib/platform/win/DXRenderDevice.h b/BeefySysLib/platform/win/DXRenderDevice.h index 9cc6e8e3..dcd83d93 100644 --- a/BeefySysLib/platform/win/DXRenderDevice.h +++ b/BeefySysLib/platform/win/DXRenderDevice.h @@ -48,6 +48,7 @@ NS_BF_BEGIN; +class WinBFWindow; class BFApp; class DXRenderDevice; @@ -150,7 +151,7 @@ public: virtual void PhysSetAsTarget(); public: - DXRenderWindow(DXRenderDevice* renderDevice, HWND hWnd, bool windowed); + DXRenderWindow(DXRenderDevice* renderDevice, WinBFWindow* window, bool windowed); ~DXRenderWindow(); void ReleaseNative(); diff --git a/BeefySysLib/platform/win/WinBFApp.cpp b/BeefySysLib/platform/win/WinBFApp.cpp index ef600cc5..1af8a47b 100644 --- a/BeefySysLib/platform/win/WinBFApp.cpp +++ b/BeefySysLib/platform/win/WinBFApp.cpp @@ -118,7 +118,7 @@ WinBFWindow::WinBFWindow(BFWindow* parent, const StringImpl& title, int x, int y int aWindowFlags = 0; bool hasDestAlpha = (windowFlags & BFWINDOW_DEST_ALPHA) != 0; - + if (windowFlags & BFWINDOW_MENU) { WinBFMenu* aMenu = new WinBFMenu(); @@ -250,8 +250,7 @@ WinBFWindow::WinBFWindow(BFWindow* parent, const StringImpl& title, int x, int y SetTimer(mHWnd, 0, 10, NULL); mIsMouseInside = false; - mRenderWindow = new DXRenderWindow((DXRenderDevice*) gBFApp->mRenderDevice, mHWnd, (windowFlags & BFWINDOW_FULLSCREEN) == 0); - mRenderWindow->mWindow = this; + mRenderWindow = new DXRenderWindow((DXRenderDevice*) gBFApp->mRenderDevice, this, (windowFlags & BFWINDOW_FULLSCREEN) == 0); gBFApp->mRenderDevice->AddRenderWindow(mRenderWindow); SetWindowLongPtr(mHWnd, GWLP_USERDATA, (LONG_PTR)this);