resizing a window in-game (settings menu)

Started by
2 comments, last by MasterWorks 18 years, 7 months ago
I am running directx 9 and have been able to enumerate my device to see what modes and resolutions i can run in. However, I am having trouble with actually resizing my window. I am using win32 with C++, but I was wondering if there was a way to change the window size and resolution with directx, or if it has to be in win32...and if you know an effective way to do it, post some code please!
Advertisement
I assume that you want to do a fullscreen resolution change. If that is the case, check out your D3DPRESENTPARAMETERS. Update BackBufferWidth, and BackBufferHeight to their new values, and then perform a device reset (IDirect3DDevice9::Reset()). Something along these lines:

presentParams.BackBufferWidth = newWidth;presentParams.BackBufferHeight = newHeight;if( FAILED( d3dDevice->Reset( &presentParams ) ) ){   ...}
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
will this only work in full screen mode? also, should i do device->EndScene() before reseting the device then device->BeginScene() afterwards? i am still having troubles with it. it is working in full screen mode. are there other properties that are necessary to be changed? i've tried changing to the new format and it doesn't help either

[Edited by - vacatola on September 14, 2005 9:56:23 PM]
Quote:Original post by vacatola
will this only work in full screen mode? also, should i do device->EndScene() before reseting the device then device->BeginScene() afterwards? i am still having troubles with it. it is working in full screen mode. are there other properties that are necessary to be changed? i've tried changing to the new format and it doesn't help either

You should (check for lost device/reset device) outside the BeginScene/EndScene pair, I think. If the device doesn't reset, you should make sure you've released any D3DPOOL_DEFAULT objects and if it still doesn't work, check the debug output and it will tell you the problem.

This topic is closed to new replies.

Advertisement