Sign in to follow this  
Tispe

Strange border behaviour fullscreen -> windowed

Recommended Posts

Hi

My game can go windowed to fullscreen and back without any trouble. Borders are fine.

However, if I start the application in fullscreen, and then go to windowed mode, all borders are gone! If to try to refresh with going windowed to windowed with the same resolution nothing happens, but if I refresh going from windowed to windowed with another resolution the border pops back!

Can you tell what is wrong?

[CODE]
void DEVICEOBJECT::ChangeResolution(GAMEWINDOW &gw)
{
gw.Height = max(gw.Height, 480);
gw.Width = max(gw.Width, 640);

ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = gw.Format;
d3dpp.MultiSampleType = D3DMULTISAMPLE_8_SAMPLES;
d3dpp.Windowed = gw.Windowed;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
if(!gw.Windowed)
{
d3dpp.BackBufferWidth = gw.Width;
d3dpp.BackBufferHeight = gw.Height;
}
RECT rc;
SetRect(&rc, 0, 0, gw.Width, gw.Height);
DWORD grfStyle = gw.Windowed ? WS_OVERLAPPEDWINDOW&~WS_THICKFRAME&~WS_MAXIMIZEBOX : WS_EX_TOPMOST|WS_POPUP;
AdjustWindowRectEx(&rc, grfStyle, FALSE, NULL);
//UpdateWindow(hWnd);
MoveWindow(hWnd,50, 50, rc.right-rc.left, rc.bottom-rc.top, true);
SetWindowLong(hWnd, GWL_STYLE, grfStyle);
ShowWindow(hWnd, SW_SHOW);
ResetDevice();
return;
}
[/CODE]

Share this post


Link to post
Share on other sites
Hi!

I think, the intended way for changing the resolution and the window mode is to directly modify the swap chain, instead of letting the window force the changes.
Here is some information on [url="http://msdn.microsoft.com/en-us/library/windows/desktop/ee417025%28v=vs.85%29.aspx#Full_Screen_Issues"]best practices[/url] (also ensuring that you get maximum performance in fullscreen mode). In case you haven't seen it yet, here is a [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb205075%28v=vs.85%29.aspx"]DXGI Overview[/url] article.
Hope this helps to unravel this weird behavior. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Cheers!

Share this post


Link to post
Share on other sites
Hi, I still have the problem. I can't figure out what is wrong...

What else must be done besides change window style, window size, editing present parameters and calling d3ddev->Reset(&d3dpp)?

PS: This is a DX9 app Edited by Tispe

Share this post


Link to post
Share on other sites
[quote name='Tsus' timestamp='1347580007' post='4979891']
Hi!

I think, the intended way for changing the resolution and the window mode is to directly modify the swap chain, instead of letting the window force the changes.
Here is some information on [url="http://msdn.microsoft.com/en-us/library/windows/desktop/ee417025%28v=vs.85%29.aspx#Full_Screen_Issues"]best practices[/url] (also ensuring that you get maximum performance in fullscreen mode). In case you haven't seen it yet, here is a [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb205075%28v=vs.85%29.aspx"]DXGI Overview[/url] article.
Hope this helps to unravel this weird behavior. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Cheers!
[/quote]
That relates to DXGI which is not going to be relevant for the OP, who is clearly using D3D9 (present parameters, etc).

Check the documentation for SetWindowLong: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%29.aspx

[quote]Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly.[/quote]

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