I made a game using C++ SDL2 with Emscripten, zipped with an index.html file, and uploaded to NG. But, the keyboard keys are not recognized. Locally it runs fine with "emrun index.html" command. Why would that be?
I made a game using C++ SDL2 with Emscripten, zipped with an index.html file, and uploaded to NG. But, the keyboard keys are not recognized. Locally it runs fine with "emrun index.html" command. Why would that be?
At 3/15/23 03:44 PM, NeWaGe wrote: I made a game using C++ SDL2 with Emscripten, zipped with an index.html file, and uploaded to NG. But, the keyboard keys are not recognized. Locally it runs fine with "emrun index.html" command. Why would that be?
You might get more responses in the programming forum. I haven't seen anyone here using emscripten. If you haven't already, you can check the console (F12) to see if it's throwing errors.
ok I figured it out. In case someone else comes across this thread...
In the HTML file, change the canvas element to: `<canvas class="emscripten" id="canvas" tabindex=1></canvas>` and add the script `document.getElementById('canvas').focus();`.