Skip to main content
gamedev.net
🔒 Locked

Toggle Fullscreen

Started by Karadok 2 replies 2.1k views
Original Post
Karadok
Karadok
Hi, maybe you can help me. I search for a tutorial that shows how to toggle fullscreen in directX 9 with c++.
Namethatnobodyelsetook
Namethatnobodyelsetook
I'm sure the samples that come in the SDK show it, though sometimes they're not exactly clear.

You need to use SetWindowLong to change the window style. You need to use SetWindowPos, with the flag SWP_FRAMECHANGED, to make the style changes take effect.

You change your D3D presentation parameters to include the new backbuffer size you want (ClientRect of window, or resolution of full screen mode), set windowed to true or false, and do a Reset on your D3D device, passing the new presentation parameters in.
Flimflam
Flimflam
In addition to what the person above me said, you will lose all your resources like textures, buffers and the like. I'm not sure if you knew this already, but toggling between fullscreen and windowed acts as your device has been lost, so you need to release your resources and load them again.
Karadok
Karadok
Thank you, i now that. I make a reset when i resize the window. it works well but when i want to toggle into fullscreen the program closes the window. I need a tutorial. That one i found isn`t good.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.