Fix app context lifetime in emscripten
All checks were successful
Run tests / Run tests (push) Successful in 7m49s

This commit is contained in:
Nikita Lisitsa 2026-07-04 16:31:34 +03:00
parent abf45f3dcb
commit 151afec7f0

View file

@ -20,6 +20,7 @@
{
std::unique_ptr<psemek::app::application> application;
std::unique_ptr<psemek::sdl2::window> window;
psemek::app::application::context context;
} em_state;
#endif
@ -59,7 +60,11 @@ int main(int argc, char ** argv) try
sdl2::window window(options);
#endif
#ifdef __EMSCRIPTEN__
auto & context = em_state.context;
#else
app::application::context context;
#endif
for (int i = 0; i < argc; ++i)
context.args.push_back(argv[i]);
context.show_cursor = [&](bool show){ window.show_cursor(show); };