Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

Switching between full screen and windowed mode

$
0
0

Before creating my main window and swap chain (in Windows 8.1 and Direct3D 11), my application displays some graphics settings the user can configure such as choosing between windowed and full screen mode.

 

Based on the outcome, I create my main window via CreateWindow with the (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) or WS_POPUP flags.

 

My DXGI_SWAP_CHAIN_DESC1 looks like:

swap_chain_desc.Width = width;
swap_chain_desc.Height = height;
swap_chain_desc.Format = g_device_enumeration->GetDisplayMode()->Format;
swap_chain_desc.SampleDesc.Count = 1;
swap_chain_desc.SampleDesc.Quality = 0;
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swap_chain_desc.BufferCount = 1;

Is this correct to use only 1 buffer in full screen mode? Or do I need to set this to at least 2 buffers?

 

 

Furthermore, I explicitly set:

dxgi_factory3->MakeWindowAssociation(m_hwindow, DXGI_MWA_NO_ALT_ENTER);

and do not set:

swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; 

This all avoids switching between full screen and windowed mode.

 

I wonder if it is possible to allow switching between full screen and windowed mode, but also between WS_OVERLAPPED and WS_POPUP without needing two different windows? For instance a resolution of 1600x900 in full screen mode can be switched to a resolution of 1600x900 in windowed mode that contains a border. When i stick to WS_POPUP, everything seems to work but I cannot move the window since there is no border (which is also a bit ugly in my opinion).

 

Games like Watch Dogs and Assassin's Creed allow a similar switching between modes, I think. Or do they position the border outside the visible view and just re-center the window when ALT+ENTER is pressed (if the user moved the window) so that they actually always operate in windowed mode?

 


Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>