Compare commits

..

No commits in common. "151afec7f058fb39f18875162fcf97e70855e89b" and "7dd55d94a9ac76ea02705501952ed278c9caec53" have entirely different histories.

3 changed files with 5 additions and 6 deletions

View file

@ -20,7 +20,6 @@
{
std::unique_ptr<psemek::app::application> application;
std::unique_ptr<psemek::sdl2::window> window;
psemek::app::application::context context;
} em_state;
#endif
@ -60,11 +59,7 @@ 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); };

View file

@ -22,6 +22,10 @@ namespace psemek::sdl2
window::window(psemek::app::application::options const & options)
{
#ifdef __EMSCRIPTEN__
SDL_SetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, "#canvas");
#endif
sdl_init_ = init(SDL_INIT_EVENTS | SDL_INIT_VIDEO);
std::uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE;

View file

@ -8,7 +8,7 @@
</style>
</head>
<body>
<canvas id="canvas" tabindex="-1" oncontextmenu="event.preventDefault()"></canvas>
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<script type="text/javascript">
var Module = {
canvas: document.getElementById('canvas'),