diff --git a/src/ClassiCube.vcxproj b/src/ClassiCube.vcxproj index 35ca0b84d..bb93b5c20 100644 --- a/src/ClassiCube.vcxproj +++ b/src/ClassiCube.vcxproj @@ -496,7 +496,7 @@ - + diff --git a/src/ClassiCube.vcxproj.filters b/src/ClassiCube.vcxproj.filters index 4e46449fb..f1c86faab 100644 --- a/src/ClassiCube.vcxproj.filters +++ b/src/ClassiCube.vcxproj.filters @@ -596,7 +596,7 @@ Source Files\Platform - + Source Files\Platform diff --git a/src/Game.c b/src/Game.c index 0459b70e2..1f2305626 100644 --- a/src/Game.c +++ b/src/Game.c @@ -49,6 +49,7 @@ int Game_MaxViewDistance = DEFAULT_MAX_VIEWDIST; int Game_FpsLimit, Game_Vertices; cc_bool Game_SimpleArmsAnim; +static cc_bool gameRunning; cc_bool Game_ClassicMode, Game_ClassicHacks; cc_bool Game_AllowCustomBlocks; @@ -615,7 +616,7 @@ static void Game_RenderFrame(double delta) { Gfx_EndFrame(); } -void Game_Free(void* obj) { +static void Game_Free(void* obj) { struct IGameComponent* comp; /* Most components will call OnContextLost in their Free functions */ /* Set to false so components will always free managed textures too */ @@ -627,6 +628,7 @@ void Game_Free(void* obj) { if (comp->Free) comp->Free(); } + gameRunning = false; Logger_WarnFunc = Logger_DialogWarn; Gfx_Free(); Options_SaveIfChanged(); @@ -638,7 +640,7 @@ void Game_Free(void* obj) { delta = Stopwatch_ElapsedMicroseconds(Game_FrameStart, render) / (1000.0 * 1000.0);\ \ Window_ProcessEvents(delta);\ - if (!WindowInfo.Exists) return;\ + if (!gameRunning) return;\ \ if (delta > 1.0) delta = 1.0; /* avoid large delta with suspended process */ \ if (delta > 0.0) { Game_FrameStart = render; Game_RenderFrame(delta); } @@ -681,6 +683,7 @@ void Game_Run(int width, int height, const cc_string* title) { Window_Create3D(width, height); Window_SetTitle(title); Window_Show(); + gameRunning = true; Game_Load(); Event_RaiseVoid(&WindowEvents.Resized); diff --git a/src/Platform_WinApi.c b/src/Platform_Windows.c similarity index 100% rename from src/Platform_WinApi.c rename to src/Platform_Windows.c diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 9be979e10..42861ccae 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -70,7 +70,7 @@ void Window_Show(void) { } void Window_SetSize(int width, int height) { } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); } /*########################################################################################################################* diff --git a/src/Window_Android.c b/src/Window_Android.c index 602061c9c..3bf71a95e 100644 --- a/src/Window_Android.c +++ b/src/Window_Android.c @@ -302,7 +302,7 @@ static void RemakeWindowSurface(void) { /* Loop until window gets created by main UI thread */ /* (i.e. until processSurfaceCreated is received) */ while (!winCreated) { - Window_ProcessEvents(0.0); + Window_ProcessEvents(0.01); Thread_Sleep(10); } diff --git a/src/Window_Dreamcast.c b/src/Window_Dreamcast.c index 3c7b904ed..9bef57ed1 100644 --- a/src/Window_Dreamcast.c +++ b/src/Window_Dreamcast.c @@ -60,7 +60,7 @@ void Window_Show(void) { } void Window_SetSize(int width, int height) { } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); } /*########################################################################################################################* diff --git a/src/Window_GCWii.c b/src/Window_GCWii.c index bd86ed71e..357f7cd38 100644 --- a/src/Window_GCWii.c +++ b/src/Window_GCWii.c @@ -28,8 +28,8 @@ int Display_ScaleY(int y) { return y; } static void OnPowerOff(void) { - Event_RaiseVoid(&WindowEvents.Closing); WindowInfo.Exists = false; + Window_Close(); } void Window_Init(void) { @@ -85,7 +85,7 @@ void Window_Create2D(int width, int height) { launcherMode = true; } void Window_Create3D(int width, int height) { launcherMode = false; } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); } diff --git a/src/Window_PS3.c b/src/Window_PS3.c index 8c55e4b90..387a8b43b 100644 --- a/src/Window_PS3.c +++ b/src/Window_PS3.c @@ -79,7 +79,7 @@ void Window_Show(void) { } void Window_SetSize(int width, int height) { } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); } diff --git a/src/Window_PSP.c b/src/Window_PSP.c index 91ffa5662..4d2667803 100644 --- a/src/Window_PSP.c +++ b/src/Window_PSP.c @@ -58,7 +58,7 @@ void Window_Show(void) { } void Window_SetSize(int width, int height) { } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); } diff --git a/src/Window_PSVita.c b/src/Window_PSVita.c index 248fc1e27..a128f186d 100644 --- a/src/Window_PSVita.c +++ b/src/Window_PSVita.c @@ -61,7 +61,7 @@ void Window_Show(void) { } void Window_SetSize(int width, int height) { } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); } diff --git a/src/Window_Xbox.c b/src/Window_Xbox.c index 4f7b65ea4..f1c4126be 100644 --- a/src/Window_Xbox.c +++ b/src/Window_Xbox.c @@ -98,7 +98,7 @@ void Window_Show(void) { } void Window_SetSize(int width, int height) { } void Window_Close(void) { - /* TODO implement */ + Event_RaiseVoid(&WindowEvents.Closing); }