To replicate the problem:
1. Start the program in fullscreen mode.
2. Change HGE_WINDOW system state to true.
3. Close the program.
System_Shutdown() will crash during the DestroyWindow()
function call. I've tracked down the problem to
system.cpp, around the following line:
if(hwnd)
{
//ShowWindow(hwnd, SW_HIDE);
//SetWindowLong(hwnd, GWL_EXSTYLE,
GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_TOOLWINDOW);
//ShowWindow(hwnd, SW_SHOW);
DestroyWindow(hwnd);
hwnd=0;
}
Logged In: YES
user_id=1379046
Hmmm... My App never crash, because I use HGE_EXITFUNC for
correct shutdown.
bool QuitFlag = false;
void ToggleScreen()
{
if (hge->Input_GetKeyState(HGEK_ALT) &&
hge->Input_GetKey() == HGEK_ENTER)
hge->System_SetState(HGE_WINDOWED,
!(hge->System_GetState(HGE_WINDOWED)).bool_value);
}
bool QuitQuery(void)
{
QuitFlag = true;
return false;
}
bool FrameFunc(void)
{
ToggleScreen();
...
// Logic & Render
...
return QuitFlag;
}
//...WinMain...
hge->System_SetState(HGE_EXITFUNC, QuitQuery);
hge->System_SetState(HGE_FRAMEFUNC, FrameFunc);
//...
Maybe engine need same flag as QuitFlag as easy solution?
Logged In: YES
user_id=1330669
stingerx,
I use that same strategy (a "quit flag" which is set to true
in the exitFunc).