[Keyboard Plugin][SOLVED] How do I detect non ascii chars?

0 favourites
  • 5 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi,

    I have a huge problem understanding how the Keyboard plugin detects which character is typed.

    In my example, I have a [TextBox] and an [Input Text Box].

    I use a french keyboard with characters like 'é', 'è', 'ç', etc.

    FRENCH KEYBOARD

    I'm just trying to detect the character 'é' which is on the same key as the character '2' on the French keyboard.

    The '2' is triggered when CAPS are on, and if not, it is the 'é' that is displayed.

    STEPS TO REPRODUCE THE STRANGE BEHAVIOUR

    * USING ONLY THE TEXT BOX*

    When I put the focus on the Input Text Box, I can type the character 'é' without any problems inside the Input Text Box.

    * USING ONLY THE TEXT BOX*

    Now, I put the focus out of the Input Text Box.

    I added an event on the Keyboard and the Text Box.

    Every time I type something, the character is displayed in the Text Box.

    So, I type the same character 'é' but I only get the character '2' and NEVER the character 'é' which is the one I'm typing. (I'm not using any CAPS on)

    Here is the capx to test:

    https://dl.dropboxusercontent.com/u/22785599/Html%20Projects/InconsistentKeyboardBehavior.capx

    Could someone help me understand this please ?

  • Calling local Frenchmen Kyatric and Yann

    Maybe those guys will know

    ~Sol

  • The keycode gives the physical key location more or less, and the other function converts that to the character. It doesn't take into account if capslock or shift is pressed though.

    Here's a way to take into account shift and capslock.

    https://dl.dropboxusercontent.com/u/542 ... essed.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you attempt to display the keycode corresponding to when you are pressing "é" on your keyboard, with the Textbox out of focus you will end up with the code 50 which is the character "2".

    As R0jo mentions, shift and alt status is not taken into account when pressing a key.

  • Thanks a lot guys (@SoldjahBoy , R0J0hound , Kyatric),

    Now I understand better. The Keyboard.LastKeyCode function is not used to know which exact key was typed but which "physical" key was typed.

    That's why we can bind and build custom controls for the player.

    Although I haven't tested yet your solution R0J0hound, because I fear the call of Javascript code as it is warned by Ashley, thank you for your solution.

    I'll give it a shot.

    Putting this subject at SOLVED.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)