Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

HTML5 game, keyboard focus

A topic by Endurion created Oct 07, 2020 Views: 764 Replies: 2
Viewing posts 1 to 3
(+6)

I've recently managed to find a emscripten compiled VICE to embed C64 games as HTML5 games. Standalone everything works fine.

For itch.io I've created the zip file as wanted and the game nicely loads. However it doesn't get the focus right away. I have to switch tabs/programs, and only once I return the game is focused.

Any idea what I'm missing?


Example: https://endurion.itch.io/loopin

Click on "Play in Browser", wait for the game to finish loading. Keys are numpad cursor (8,4,6,2) and numpad insert as fire button.
They only register once I switched away and back.

The same works fine in the stand alone version, which uses the exact same HTML/.js file.

(+4)

<script type='text/javascript'>

window.onload = function () { window.focus(); }

window.onclick = function () { window.focus(); }

</script>

in the index.html file should work

That works a treat, thanks a lot!

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.