libgdx/libgdx

Why the BACKSPACE key is treated differently in libGDX/GWT than in libGDX/LWJGL ?

Open

#7,219 创建于 2023年8月29日

在 GitHub 查看
 (2 评论) (1 反应) (0 负责人)Java (6,537 fork)batch import
buggood first issuegwtinput

仓库指标

Star
 (25,087 star)
PR 合并指标
 (平均合并 61天 22小时) (30 天内合并 3 个 PR)

描述

Issue details

In libGDX, I use Gdx.input.isKeyPressed(Input.Keys.BACKSPACE) to know when the use push BACKSPACE. But, results are different depending on the backend. In libgGDX/LWJGL, when I press BACKSPACE, the above expression returns true but in libgGDX/GWT, it always returns false. After searching in code, I found the following lines in libGDX: DefaultGwtInput line 699 where I can clearly see that BACKSPACE key is treated differently and that Gdx.input.isKeyPressed(Input.Keys.BACKSPACE) will never returns true. In libGDX/LWJGL there is no such difference. Why the BACKSPACE key is treated differently in libgGDX/GWT than in libGDX/LWJGL ?

Reproduction steps/code

test.tar.gz Download and untar test.tar.gz. The program is just a black window. An InputProcessor is attached to Gdx.input. When BACKSPACE is pressed, an event is triggered, InputProcessor#keyDown is called and I print '[DEBUG] DOWN'. Then, the render method is called multiple times, resulting in printing multiple times [DEBUG] PRESSED (using Gdx.input.isKeyPresssed). Finally, when BACKSPACE is released, InputProcessor#keyUp is called and I print '[DEBUG] UP'. This is the expected output.

On a desktop, the output is:

[DEBUG] DOWN
[DEBUG] PRESSED       (repeated multiple times)
[DEBUG] UP

which is expected. With the HTML version the output is:

[DEBUG] DOWN           (repeated multiple times)
[DEBUG] UP

Version of libGDX and/or relevant dependencies

libGDX version 1.12.0 GWT version 2.10.0

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • [ ] macOS

贡献者指南