Archived

This topic is now archived and is closed to further replies.

Holy Fuzz

Switching from windowed to fullscreen, and vice-versa.

Recommended Posts

Does anyone have any code examples for switching from windowed to fullscreen and back in-game? I''m using Direct3D9, but 8+ will do. I''ve done it before, but I lost my code and I can''t get it to work now. Here''s how I''m trying to do it: ON INITIALIZATION - Create two windows: One with a border and title-bar, etc, for windowed mode. One just WS_POPUP for fullscreen. - Show proper window, set its position. - Setup D3DPRESENT_PARAMETERS with required info, including handle to proper window. - Create the device. Initialization works perfectly, no problems. I can startup in whatever mode I want. ON SWITCHING MODES - Hide improper window, show proper window. Set its position. - Setup D3DPRESENT_PARAMETERS exactly like on initialization. - Reset the device. Here''s what happens: When going from windowed to fullscreen, it works until I click on the window, at which point my application just freezes. (it happens to freeze somewhere insice the IDirect3DDevice::Clear function, which is the ONLY drawing I''m doing, since this is only a test.) When going from fullscreen to windowed, Reset throws an unhandled exception. Thanks for any ideas/examples! - Fuzz

Share this post


Link to post
Share on other sites
Ok, you only need to reset the device if its lost i think, so check if it is lost first.

Share this post


Link to post
Share on other sites
If I only reset the device if it''s lost, then how do I go about changing modes?

BTW, I''ve never had any problems resetting when I HAVEN''T lost the device. For instance, I reset the device whenever my window resizes, which I''m having no problems with.

Share this post


Link to post
Share on other sites
i was trying to switch to fullscreen from windowed and vice-versa once, i only used 1 window, and when the user pressed a key i would release the d3ddevice create a new one with fullscreen and use setwindowlong to change the style of the window. it worked fine for going from windowed to fullscreen but going from fullscreen to windowed it froze. i stopped trying to debug it and i dont think i have it anymore. still wondering how to do it tho for future games

extended waranty, how can I lose!

[edited by - brass_fish on March 3, 2003 9:30:32 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your answer is in Microsoft''s samples. Look in d3dapp.cpp for ToggleFullscreen() function.

Share this post


Link to post
Share on other sites