Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG?] GetJoyStickX and GetJoyStickY WASD HTML5

Author
Message
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 6th Mar 2017 10:52 Edited at: 6th Mar 2017 10:54
Hello

Code used to replicate this behaviour:


Not my code, found somewhere in the docs.

I live in Belgium, and we use AZERTY keyboards here, just like in France.
When I run the example, it recognizes that and I can use ZQSD instead of WASD. No problems, works perfectly.
Export this code to HTML5 and it doesn't, I have to use WASD, which is very odd on a AZERTY keyboard.

I suspect this is a bug in the HTML5 code, as this works perfect on desktop (tested on OSX).

Or is there another way to handle different keyboard layouts?

Thanks
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 7th Mar 2017 17:35
Paul?

Anything on about this subject? The main problem is that the behaviour on desktop is different from HTML5.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Mar 2017 18:36 Edited at: 7th Mar 2017 18:37
workaround ?
example of using 1,2,3,4

+ GetDeviceLanguage ( ) is maybe useful

AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 7th Mar 2017 20:05
Hi Markus

Using Keystates is indeed a workaround, but the main issue is that the same code acts different on another platform. And that's weird.
BUT: Your example showed what is really wrong! (The print(GetRawLastKey()) part)

When I press 'Z' (forward on AZERTY), I see a RawLastKey code 87. Which is wrong, because that's a 'W'. -> Desktop (Mac) behaviour
RawLastKey of 'Z' on HTML5: 90 -> correct.

So Keycodes are wrong on desktop with AZERTY (on Mac at least)

DeviceLanguage won't help me, we speak Dutch and use AZERTY. But in The Netherlands, QUERTY.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 7th Mar 2017 20:21 Edited at: 7th Mar 2017 20:23
seems it is something for @Paul

germany have qwertz, and i believe english layout is y and z interchanged. means qwerty

german:
w is forward
a left d right
s down
q e turn
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 8th Mar 2017 09:18
I believe it's a problem with the keyboard, and not AGK. The scancodes return whatever code is assigned to the physical key, not what's supposed to be on the key. Most drivers will internally switch the output depending on the devices input language, which I suspect you'll have to do yourself.

Or have a keyboard remapping routine within your code so users can set their own controls.
Signature removed by mod because it's larger than 600x120... please resize and try again.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Mar 2017 12:09
//KEY_Z 90 at german keyboard is correct, but i not know if paul have a select case for this intern

AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Mar 2017 17:15
Both HTML5 and Mac are using the key codes provided by GLFW, which we use on both, so I don't know why they would differ. I would have expected Mac to copy HTML5 and report 90 for Z since from what I've seen the key codes are based on the letter rather than its physical location on the keybaord. There is a possibility we could switch to using the physical location instead, but I don't know how consistent that would be across all platforms, would need a lot of testing.
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 10th Mar 2017 14:46
Hi Paul

Thanks for your answer. Really weird that they differ.
I'll go with the Mobiius solution:

Quote: "Or have a keyboard remapping routine within your code so users can set their own controls."

Login to post a reply

Server time is: 2024-11-24 19:51:37
Your offset time is: 2024-11-24 19:51:37