Skip to content

Commit f4e08ab

Browse files
committed
build(web): Keep SDL out of GameMain's Emscripten loop callback
1 parent 979a4db commit f4e08ab

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@
3434

3535
#if defined(__EMSCRIPTEN__)
3636
#include <emscripten.h>
37-
#include <SDL3/SDL.h>
38-
39-
extern SDL_Window *TheSDL3Window;
4037

4138
// TheSuperHackers @feature githubawn 29/07/2026 A browser tab cannot host a blocking
4239
// game loop: the page only paints, delivers input and completes network I/O when
4340
// control returns to its event loop. So instead of GameEngine::execute() running the
4441
// loop itself, one iteration is handed to emscripten_set_main_loop below and the
45-
// browser calls it once per animation frame.
42+
// browser calls it once per animation frame. Window and SDL teardown stays with the
43+
// platform layer that created them; the page tears both down on unload anyway.
4644
static void ggcEmscriptenLoopIteration()
4745
{
4846
if (TheGameEngine != nullptr && !TheGameEngine->getQuitting())
@@ -62,13 +60,6 @@ static void ggcEmscriptenLoopIteration()
6260
TheFramePacer = nullptr;
6361
delete TheGameEngine;
6462
TheGameEngine = nullptr;
65-
66-
if (TheSDL3Window != nullptr)
67-
{
68-
SDL_DestroyWindow(TheSDL3Window);
69-
TheSDL3Window = nullptr;
70-
}
71-
SDL_Quit();
7263
}
7364
#endif
7465

0 commit comments

Comments
 (0)