Explorar o código

Disabled Alt+Enter

Brian Fiete %!s(int64=5) %!d(string=hai) anos
pai
achega
962ebba6e9

+ 1 - 0
BeefLibs/Beefy2D/src/BFWindow.bf

@@ -47,6 +47,7 @@ namespace Beefy
 			FakeFocus = 0x0100'0000,
 			ShowMinimized = 0x0200'0000,
 			ShowMaximized = 0x0400'0000,
+			AllowFullscreen = 0x0800'0000,
         };
 
 		[AllowDuplicates]

+ 1 - 0
BeefySysLib/BFWindow.h

@@ -53,6 +53,7 @@ enum
 	BFWINDOW_FAKEFOCUS		= 0x1000000,
 	BFWINDOW_SHOWMINIMIZED  = 0x2000000,
 	BFWINDOW_SHOWMAXIMIZED  = 0x4000000,
+	BFWINDOW_ALLOW_FULLSCREEN = 0x8000000
 	
 };
  

+ 6 - 2
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));
 }

+ 2 - 1
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();

+ 2 - 3
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);