Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualhupsilardee

Posted 11 November 2012 - 09:06 AM

I do love the easy fullscreen switching in D3D10+. However I would not like this to be controlled via Alt+Enter, I prefer F4 to toggle fullscreen. (A throwback to my GameMaker days Posted Image ). The below code controls fullscreen-switching, but why does Alt+Enter still work? The pSwapChain was definitely created without DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH.

bool Device::IsFullscreen()
{
	 BOOL fs;
	 pSwapChain->GetFullscreenState(&fs, NULL);
	 return (bool)fs;
}
void Device::SetFullscreen(bool fs)
{
	 BOOL dummy = (BOOL)fs;
	 pSwapChain->SetFullscreenState(&dummy, NULL);
}

// Yeah I am aware that multi-monitor systems might break this... I promise to fix that later!

void UpdateGame()
{
	 // message pump

	 if (input->KeyPressed(VK_F4))
	 {
	 	 // F4 toggles fullscreen
	 	 pDevice->SetFullscreen(!pDevice->IsFullscreen());
	 }
}


Also, how do people get those nice blue tags on their topics?

#1hupsilardee

Posted 11 November 2012 - 08:45 AM

I do love the easy fullscreen switching in D3D10+. However I would not like this to be controlled via Alt+Enter, I prefer F4 to toggle fullscreen. (A throwback to my GameMaker days :) ). The below code controls fullscreen-switching, but why does Alt+Enter still work? The pSwapChain was definitely created without DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH.

bool Device::IsFullscreen()
{
	 BOOL fs;
	 pSwapChain->GetFullscreenState(&fs, NULL);
	 return (bool)fs;
}
void Device::SetFullscreen(bool fs)
{
	 BOOL dummy = (BOOL)fs;
	 pSwapChain->SetFullscreenState(&dummy, NULL);
}

// Yeah I am aware that multi-monitor systems might break this... I promise to fix that later!

void UpdateGame()
{
	 // message pump

	 if (input->KeyPressed(VK_F4))
	 {
	 	 // F4 toggles fullscreen
	 	 pDevice->SetFullscreen(!pDevice->IsFullscreen());
	 }
}


PARTNERS