Jump to content

Can't capture accents on mac


Recommended Posts

I am making a typewritter game in portuguese using phaser, and some words have accents, like café or água.


The problem is, whenever someone tries to type an accented letter, such as á, phaser only captures 'a', completelly ignoring the accent before, since accents are typed as ´a.


Accents for some reason don't get captured, like ´ or ~ before an letter, so I can't even build an table like 'if there was a ~ before an a, then replace with ã'.


I don't know how to know when an accented letter was typed on mac, I need help


I am using this:

game.input.keyboard.addCallbacks(game, undefined, undefined, function (key) {        if (game.typer) {            game.typer.typed(key);        }        console.log("phaser: " + key);        game.data.toConsume.push(key);    });

and also attempted to use:

window.addEventListener('keypress', function (event) {    var key = event.keyCode || event.which;    console.log("press: " + key + ", " + String.fromCharCode(key));    event.preventDefault();});window.addEventListener("keydown", function (e) {    var key = event.keyCode || event.which;    console.log("down: " + key + ", " + String.fromCharCode(key));    if (e.which === 8) {        e.preventDefault();    }});

keydown event sometimes would capture some crazy thing rather than an accent, however, if the accent were to be accessed via 'shift + 6' for instance, I would only know that 6 was pressed, but not what 'shift + 6' means

Link to comment
Share on other sites


  • Recently Browsing   0 members

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