• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
hupsilardee

[DXGI]Disabling Alt+Enter?

11 posts in this topic

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 [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] ). 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.

[code]
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());
}
}

[/code]

Also, how do people get those nice blue tags on their topics? Edited by hupsilardee
0

Share this post


Link to post
Share on other sites
You can use the IDXGIFactory::MakeWindowAssocation function to disable Alt+Enter: [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb174540%28v=vs.85%29.aspx"]http://msdn.microsof...0(v=vs.85).aspx[/url]

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. Edited by Erik Rufelt
0

Share this post


Link to post
Share on other sites
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)

[code]

// Initialise SwapChainDesc...
SwapChainDesc.Flags = 0;

IDXGIFactory* factory;
CreateDXGIFactory(IID_IDXGIFactory, (void**)&factory);
HRESULT hr = D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0/*flags*/, D3D10_SDK_VERSION, &pDevice);
hr = factory->CreateSwapChain(pDevice, &SwapChainDesc, &pSwapChain);
hr = factory->MakeWindowAssociation(window->GetHWND(), DXGI_MWA_NO_ALT_ENTER);

factory->Release();

[/code]

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.
0

Share this post


Link to post
Share on other sites
This is fun.

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.
2

Share this post


Link to post
Share on other sites
This is also fun. Found this discussion on stackoverflow

http://stackoverflow.com/questions/2353178/disable-alt-enter-in-a-direct3d-directx-application

So I changed my startup code. (Again, without error checking)

[code]
DWORD flags = 0;
#ifdef _DEBUG
flags |= D3D10_CREATE_DEVICE_DEBUG;
#endif
//if (SingleThreadedD3D10)
//{
//flags |= D3D10_CREATE_DEVICE_SINGLETHREADED;
//}
HRESULT hr = D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, flags, D3D10_SDK_VERSION, &pDevice);
IDXGIDevice* dxgiDevice;
IDXGIAdapter* adapter;
IDXGIFactory* factory;
pDevice->QueryInterface(IID_IDXGIDevice, (void**)&dxgiDevice);
dxgiDevice->GetParent(IID_IDXGIAdapter, (void**)&adapter);
adapter->GetParent(IID_IDXGIFactory, (void**)&factory);
hr = factory->CreateSwapChain(pDevice, &SwapChainDesc, &pSwapChain);
hr = factory->MakeWindowAssociation(window->GetHWND(), DXGI_MWA_NO_ALT_ENTER);
factory->Release();
adapter->Release();
dxgiDevice->Release();
[/code]

Guess what? Didn't work.

However, using DXGI_MWA_NO_WINDOW_CHANGES [i]does[/i] work, but it makes a Windows beep. Now I would like to get rid of this. What a pain.
0

Share this post


Link to post
Share on other sites
You need pSwapChain->GetParent for MWA.

I have this working in my own code and I'll dig it out later on this evening for you if you need it.
2

Share this post


Link to post
Share on other sites
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
0

Share this post


Link to post
Share on other sites
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?
0

Share this post


Link to post
Share on other sites
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 [img]http://public.gamedev.net//public/style_emoticons/default/happy.png[/img]. However, they have the same problem I had with the beeping in windowed mode [img]http://public.gamedev.net//public/style_emoticons/default/laugh.png[/img]
0

Share this post


Link to post
Share on other sites
Some more info and discussion on the beep here: http://stackoverflow.com/questions/3662192/disable-messagebeep-on-invalid-syskeypress
0

Share this post


Link to post
Share on other sites
As a game player I'd prefer to have Alt-Enter in, this is IMHO quasi standard; whereas F4 feels like the odd one out.

What's so bad about having both?
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0