1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix timer lifetime

This commit is contained in:
Mathieu Schroeter 2017-02-02 17:57:51 +01:00
parent cbfe4585ce
commit 061bfe9e2b

View File

@ -366,7 +366,6 @@ LRESULT CALLBACK WindowProc2 (HWND hWnd, UINT message,
break;
case WM_DESTROY:
KillTimer(g_hWnd, 1);
FinishObjects();
PostQuitMessage(0);
break;
@ -777,13 +776,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
return false;
}
SDL_TimerID my_timer_id = SDL_AddTimer (g_timerInterval, [] (Uint32 interval, void *param) -> Uint32
SDL_TimerID updateTimer = SDL_AddTimer (g_timerInterval, [] (Uint32 interval, void *param) -> Uint32
{
CEvent::PushUserEvent (WM_UPDATE);
return interval;
}, nullptr);
while (SDL_TRUE)
{
if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
@ -816,6 +814,7 @@ out:
if (g_window)
SDL_DestroyWindow (g_window);
SDL_RemoveTimer (updateTimer);
SDL_Quit ();
return static_cast<int> (msg.wParam);
}