detect device closing
Posted: Wed Aug 18, 2021 2:15 pm
How can I detect the device closing in response to the WM_QUIT message?
using this code as my main run() loop I have two different scenarios.
If I use set the application mode to IGE_MODE_QUIT to exit the program all works well,
however, if I use the window close button (X) to close the app I get an exception thrown indicating a memory leak.
it is related to me having my own IGE_GUI_Desktop class that handles the gui for me and I need to clean it up prior to the device closing.
question :
how can I detect the WM_QUIT windows message or the postquitmessage() and react to it prior to the device closing?
using this code as my main run() loop I have two different scenarios.
If I use set the application mode to IGE_MODE_QUIT to exit the program all works well,
however, if I use the window close button (X) to close the app I get an exception thrown indicating a memory leak.
it is related to me having my own IGE_GUI_Desktop class that handles the gui for me and I need to clean it up prior to the device closing.
question :
how can I detect the WM_QUIT windows message or the postquitmessage() and react to it prior to the device closing?
Code: Select all
// while everything is valid
while (getDevice() && getMode() != IGE_MODE_QUIT && getDevice()->run())
{
::QueryPerformanceCounter(&end);
float et = static_cast<float>(end.QuadPart - start.QuadPart) / frequency.QuadPart;
start = end;
IGE_PROFILE(getProfiler().stop(EP_APP_TIME_UPDATED);)
IGE_PROFILE(getProfiler().start(EP_APP_TIME_UPDATED);)
// call the frame functions
getEngine()->beginScene(et);
preFrame(et);
frame(et);
postFrame(et);
getEngine()->endScene(et);