Jump to content

Function keys F1, F5, F12


Mike
 Share

Recommended Posts

I was a bit surprised, that the framework catch, them as I often press F5, or F12

 

So my request is if can be added some kind of global setting, to preserver the "F" keys default behavior and

we can choose if we want it or not :)

 

Maybe there is some deeper thoughts, so I'll be glad to hear Rich opinion

 

 

Link to comment
Share on other sites

I disabled that in the version I pushed up a couple of hours ago, as it was bugging me :)

 

The problem is if you don't capture arrow keys, the page will scroll. So what I need to do is capture JUST select keys, or put it under devs control which are caught or not. But anyway it's fixed in the version now on git.

Link to comment
Share on other sites

  • 2 weeks later...

So using the laters 9.0.2 and this time anoyed by the up, down, and space default behavior i used:

 

 

    var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);    function init() {        myGame.world.setSize(2240, 2240);        myGame.loader.addImageFile('grid', 'src/Tests/assets/tests/debug-grid-1920x1920.png');        myGame.loader.addImageFile('car', 'src/Tests/assets/sprites/car90.png');        myGame.input.keyboard.addKeyCapture(32);        myGame.input.keyboard.addKeyCapture(38);        myGame.input.keyboard.addKeyCapture(40);        myGame.loader.load();    } 

 

 

This doesn't look quite nice and i propose something like:

 

myGame.input.keyboard.addKeysCapture({32,38,40}); 

 

or { 32: true, 38: true, 40: true }

 

or just as array...

 

Anyway i've made a custo build of phaser... again for testing only with:

 

 

module Phaser {    export class Keyboard {        constructor(game: Game) {            this._game = game;            this.start();            this._capture = { 32: true, 38: true, 40: true };        } 
Link to comment
Share on other sites

Hi, again and 10x for adding it, but i test it and saw this problem:

 

if (typeof keycode == 'array')

 

 

and this doesn't work:

 

 

myGame.input.keyboard.addKeyCapture([32, 38, 40]);

 

 

so the case should be:

 

if (typeof keycode == 'object') //i think this is the better check...orif(keycode instanceof Array)  

 

and this way it will work as intended. :)

Link to comment
Share on other sites

  • 4 months later...

Using the old thread cause it's related but at the moment v1.0:

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });var arCapturedKeys = [        Phaser.Keyboard.SPACEBAR,        ,Phaser.Keyboard.UP        ,Phaser.Keyboard.DOWN        ,Phaser.Keyboard.LEFT        ,Phaser.Keyboard.RIGHT    ];game.input.keyboard.addKeyCapture(arCapturedKeys);

At this moment game.input is null  and result in Uncaught TypeError: Cannot read property 'keyboard' of null

 

I couldn't find info why is this so ...   any tips where to look for fixing it ?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...