Hi, so I''ve got my app changing to full-screen and back, using Direct3D9. All is working, all my sprites and textures survive
However, when I first start my app using this code for window creation:
if (windowed)
g_hWnd = CreateWindow("MY_WINDOWS_CLASS",
"Direct3D (DX9) - Creating 2D Sprites with D3DXSPRITE",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL );
else // is full-screen
g_hWnd = CreateWindow("MY_WINDOWS_CLASS",
"Direct3D (DX9) - Creating 2D Sprites with D3DXSPRITE",
WS_POPUP | WS_VISIBLE,
0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL );
everything is kosher and I get a nice window with a minimize, maximize, and close button. And if I click outside the window, my window goes to the background, which is what I want.
However, if I switch to full screen, and then back again, using this function:
if (windowed) {
// set window-mode style
SetWindowLong( *hWnd, GWL_STYLE, WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX);
SetWindowPos( *hWnd , HWND_TOP , 0 , 0 , width , height , SWP_SHOWWINDOW | SWP_FRAMECHANGED );
// bc, according to MSDN: if you change any of the frame styles, you must call
// SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly.
} else { // changing to full-screen
// Set fullscreen-mode style
SetWindowLong( *hWnd, GWL_STYLE, WS_POPUP | WS_VISIBLE);
}
// now do all d3d reset code...same as in init function
I get a window, that has no minimize, maximize, or close buttons, and when I click on another window, my game window stays on top, but just becomes not-active. Any thoughts?
Thanks.
Life's Short. Make Games.