the web export version should auto detect keyboard mouse or screen and remove the touch screen controls if not needed #171
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Done in
0fad1dd.The old rule asked
DisplayServer.is_touchscreen_available(), which answers "could a touch arrive" rather than "is anyone touching". In a browser that is yes on any laptop whose panel or pointer reports touch support, so the web build put thumb sticks over a screen being played with a mouse - and it also gated MOUSE AIMING, which was therefore switched off on exactly the machine it exists for. The decision was also made once and never revisited, so a wrong answer the other way stranded a device with no controls until it was restarted.The reading is now the last input actually USED, which is a fact rather than a capability. It lives in GameState (
pointer_is_touch) because two things need the same answer - GameController shows or hides the four on-screen controls, MouseCombatController decides whether a click fires - and one answer means they can never disagree.It is two-way: a keyboard or mouse takes the controls away, a touch brings them straight back. That is what makes it safe to apply everywhere rather than only where the display claims there is no touchscreen - nothing can be stranded, because the gesture that needs the controls is the gesture that restores them, and it takes one tap.
The one subtlety: Godot manufactures the other kind of event from each one, so a tap produces a click a moment later. A touch therefore suppresses mouse evidence for a second, and that manufactured click is not mistaken for a mouse.
test_desktop_hides_touch_controls.gd was rewritten around the new rule and now covers both directions, the manufactured click, and the fact that the guns read the same answer the sticks do.