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.
Mode switch refers to changing the monitor resolution to match the back-buffer. Even without mode switch the swap-chain can go to fullscreen mode with the desktop resolution.
Thanks for the quick reply. I found that page as well but was unable to get it to work. Here's the device/swap chain creation (minus error checking etc)
I checked the HR line-by-line using breakpoints. All returns S_OK. But Alt+Enter Still Works! I can't leave this alone because Alt and Enter are both likely to be used as character controls, and it's very conceivable that the player might press both.
There is a serious omission in the D3D documentation surrounding the MakeWindowAssociation call; what it fails to mention (IIRC it hints at it but never states it outright) is that the IDXGIFactory used for MakeWindowAssociation must be retrieved via calling IDXGISwapchain::GetParent first. Then it works; otherwise it won't.
Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.
I would really appreciate it if it's not too much trouble, mhagain. However I can now call the problem half-solved. If I use MWA_NO_WINDOW_CHANGES along with the above code, Alt+Enter doesn't toggle fullscreen. It does make a beeping, only in windowed mode, but most people play games in fullscreen anyway.
Although now I'm worrying about the other effects of MWA_NO_WINDOW_CHANGES
OK, first things first, I'm using D3D11. That shouldn't matter much as the basic process is the same; just so you're aware of it.
Secondly, I create using D3D11CreateDeviceAndSwapchain - that may be relevant and I'd recommend that for D3D10 you also use D3D10CreateDeviceAndSwapchain, if for no other reason, to rule out uncertainty/difference in the basic creation.
Thanks for the help mhagain. However it STILL doesn't work for me Perhaps it's because you are using DXGI 1.1? Should I start using DXGI 1.1 or will that cause problems for people on Vista who don't install their service packs?
Hello again. Sorry to resurrect such an old thread, but I thought I would post with 2 things:
Firstly, the problem has been solved
Secondly, I've been playing Black Ops 2 recently, and I noticed to my amusement that Alt+Enter is not disabled; handy for playing in windowed mode so people who knock on my door remain convinced that I'm being productive . However, they have the same problem I had with the beeping in windowed mode