Web: Fix canvas not auto clearing when client is exited with an error (e.g. invalid port)

This commit is contained in:
UnknownShadow200 2021-10-07 20:32:26 +11:00
parent d3a9477470
commit 1c786570e4
2 changed files with 10 additions and 2 deletions

View File

@ -358,7 +358,12 @@ cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
*-----------------------------------------------------Process/Module------------------------------------------------------*
*#########################################################################################################################*/
cc_result Process_StartGame(const cc_string* args) { return ERR_NOT_SUPPORTED; }
void Process_Exit(cc_result code) { exit(code); }
void Process_Exit(cc_result code) {
/* Window isn't implicitly closed when process is exited */
if (code) Window_Close();
exit(code);
}
extern int interop_OpenTab(const char* url);
cc_result Process_StartOpen(const cc_string* args) {

View File

@ -481,13 +481,16 @@ void Window_Close(void) {
WindowInfo.Exists = false;
Event_RaiseVoid(&WindowEvents.Closing);
/* If the game is closed while in fullscreen, the last rendered frame stays */
/* shown in fullscreen, but the game can't be interacted with anymore */
/* shown in fullscreen, but the game can't be interacted with anymore */
Window_ExitFullscreen();
/* Don't want cursor stuck on the dead 0,0 canvas */
Window_DisableRawMouse();
Window_SetSize(0, 0);
UnhookEvents();
/* Game_DoFrame doesn't do anything when WindowExists.False is false, */
/* but it's still better to cancel main loop to minimise resource usage */
emscripten_cancel_main_loop();
}
extern void interop_RequestCanvasResize(void);