Commit Graph

3 Commits (21847f5e57ce028900c110e62a2cd296fba22471)

Author SHA1 Message Date
Noah 21847f5e57 Code cleanup for TouchScreenMode 2024-04-19 23:13:32 -07:00
Noah b8665c8b8d TouchScreenMode Fix
Made some fixes to touchscreen control detection:

* TouchScreenMode is activated on the first SDL2 FingerDown
* TouchScreenMode deactivates after the last finger is removed, and a
  mouse event happens at least 5 ticks later.
2024-04-19 22:42:47 -07:00
Noah 5b3121171e Fix touchscreen mode detection
* Touchscreen mode used to be detected based on SDL2 GetNumTouchDevices
  but on a Macbook, the trackpad registers as a touch device - worse,
  GetNumTouchDevices will only start returning 1 the first time some
  devices are touched.
* The result was that on macOS the custom mouse cursor was drawn by
  default, but on the first trackpad touch, would disappear in favor of
  assuming the game is running on a touch screen device (which is not
  the case).
* New method: the render engine has an IsFingerDown boolean which will
  be true as long as at least one finger has registered a FingerDown
  event, but not yet a FingerUp event.
* So as long as one finger is down, the mouse cursor can disappear and
  then it comes back on release. This isn't perfectly ideal for pure
  touch devices (ideally the cursor remains hidden until a mouse
  movement without touch occurs).
2024-04-19 22:01:33 -07:00