Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Handle Arrow keys inside iframe

A topic by Wild Spike created Oct 20, 2017 Views: 737 Replies: 2
Viewing posts 1 to 3
(+4)

Hello,

Recently I add html5 game with keyboard and mouse support. It works fine as standalone html5 application. But arrow keys doesn't forwarded into game on this site.

Problem - https://wildspike.itch.io/way-of-tanks

Works fine - http://apps.ugolnik.info/wayoftanks/

Is it possible to fix on yours or my side?

Admin (1 edit)

What game engine are you using? Some engines bind to event handlers in a way that isn't friendly with iframes. Here's a discussion about the problem with someone using pixi.js: https://github.com/itchio/itch.io/issues/727#issuecomment-337490481

Hello,

Thank you for reply. I use my own game engine. Here is workaround:

postRun: (function() {
                window.addEventListener('mousedown', function(evt) {
                    window.focus();
                    evt.preventDefault();
                    evt.stopPropagation();
                    evt.target.style.cursor = 'default';
                }, false);
            })(),
This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.