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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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