View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0021331||Runner||[All Projects] HTML5||Public||2016-04-28 12:28||2018-02-05 16:28|
|Reporter||Piotr Gnys||Assigned To||Mike Dailly|
|Priority||High||Severity||B - Major||Reproducibility||100%|
|Target Version||Fixed in Version|
|Summary||0021331: Some characters works wrong in HTML5|
|Description||When exporting game to HTML5, some characters from keyboard are wrongly recognized from keyboard:|
Shift+~ = @, should be ~
Shift+2 = ", should be @
Shift+' = ~, shoold be " (double quote)
' = #, should be ' (apostrophe/single quote)
Shift+2 = £, should be # (newline in GM).
I've used font with 32-255 characters range available for tests.
|Steps To Reproduce||Only code needed for test in HTML5 - draw event:|
var last = keyboard_lastchar;
if last = '#' last = '\#';
draw_text(10,10,'last key: <' + string(keyboard_lastchar)+'>');
(this makes # visible as character instead newline).
|1.4 Found In||1.4.1757|
|2.x Runtime Found In|
|2.x Runtime Verified In|
|That's because the current implementation of keyboard_lastchar and keyboard_string is always pegged to the UK layout. I've been a critic of this for a long time and the only way out is to overlay a text field or text area over the canvas through JS.|
Last edited: 2016-04-28 15:51
It should use US keyboard, even if other countries (like Poland). That will be most accurate I think.
Absolutely not. Work with anything that isn't written using the basic English alphabet and the approach comes apart.
Text field/area overlays are the only real valid approach that adequately accounts for layout/orthographical differences, not keyboard_string or keyboard_lastchar and certainly not one of those silly on-screen keyboard lookalikes.
I gave up trying to interprete keycodes and switched to text fields aswell.
Current runner implementation is a very poor design choice I'd say.
|I think that good idea will be that we can define keyboard we want on our own, or redefine it at runtime.|
Or another approach, that there's function:
where map can be one of constans:
html_layout_uk - https://upload.wikimedia.org/wikipedia/commons/d/da/KB_United_Kingdom.svg
html_layout_us - https://upload.wikimedia.org/wikipedia/commons/5/51/KB_United_States-NoAltGr.svg
This should now be addressed as all browsers (we think) now pass through the ASCII of the character pressed. Chinese and Korean chaarcters probably won't work as browsers don't pass them through, but european and cyrillic alphabets should work.
Where the character isn't available, it'll fall back to the UK keyboard again.