Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GWT module does not map the proper Input.Buttons #5805

Closed
payne911 opened this issue Oct 2, 2019 · 1 comment
Closed

GWT module does not map the proper Input.Buttons #5805

payne911 opened this issue Oct 2, 2019 · 1 comment

Comments

@payne911
Copy link
Contributor

payne911 commented Oct 2, 2019

Issue details

When trying to detect mouse clicks, the GWT module does not map the proper button clicks:

if (Gdx.input.isButtonJustPressed(Input.Buttons.RIGHT)) is actually triggered on left-click.

if(Gdx.input.isButtonJustPressed(Input.Buttons.MIDDLE)) is actually triggered on right-click.

if(Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) is not triggered through left-click, right-click, nor middle-click.

Reproduction steps/code

Try this piece of code to reproduce the issue. Via the DesktopLauncher it will work as expected, but when tried via the browser (after using dist and superDev html build tasks), it will behave as described above.

Version of LibGDX and/or relevant dependencies

1.9.10

Please select the affected platforms

HTML/GWT is the only platform I've seen this bug occur on so far.

@payne911 payne911 changed the title GWT module does not map the proper Input.Buttons GWT module does not map the proper Input.Buttons Oct 2, 2019
@tommyettinger
Copy link
Member

This is a real bug; it looks easy enough to fix. GwtInput has a getButton() method that remaps a constant from GWT's NativeEvent to the constants in libGDX's Input.Buttons. Take a look at

this.pressedButtons.add(getButton(e.getButton()));
justPressedButtons[e.getButton()] = true;
; one usage relating to the just-pressed buttons only uses the NativeEvent codes, and doesn't remap. This means @payne911 could either use NativeEvent's constants on GWT only (not any other platform), which seems bad but maybe necessary, or we could fix this by changing line 592 in GwtInput.java to call getButton() on the event's code from its own getButton() method (like on line 591).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants