Fix app context lifetime in emscripten
All checks were successful
Run tests / Run tests (push) Successful in 7m49s
All checks were successful
Run tests / Run tests (push) Successful in 7m49s
This commit is contained in:
parent
abf45f3dcb
commit
151afec7f0
1 changed files with 5 additions and 0 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
{
|
{
|
||||||
std::unique_ptr<psemek::app::application> application;
|
std::unique_ptr<psemek::app::application> application;
|
||||||
std::unique_ptr<psemek::sdl2::window> window;
|
std::unique_ptr<psemek::sdl2::window> window;
|
||||||
|
psemek::app::application::context context;
|
||||||
} em_state;
|
} em_state;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -59,7 +60,11 @@ int main(int argc, char ** argv) try
|
||||||
sdl2::window window(options);
|
sdl2::window window(options);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
auto & context = em_state.context;
|
||||||
|
#else
|
||||||
app::application::context context;
|
app::application::context context;
|
||||||
|
#endif
|
||||||
for (int i = 0; i < argc; ++i)
|
for (int i = 0; i < argc; ++i)
|
||||||
context.args.push_back(argv[i]);
|
context.args.push_back(argv[i]);
|
||||||
context.show_cursor = [&](bool show){ window.show_cursor(show); };
|
context.show_cursor = [&](bool show){ window.show_cursor(show); };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue