Skip to content

Add optional touchscreen controls (SDL backend) - #3426

Open
okias wants to merge 1 commit into
ZDoom:masterfrom
okias:touch-controls
Open

okias wants to merge 1 commit into
ZDoom:masterfrom
okias:touch-controls

Conversation

@okias

@okias okias commented Aug 10, 2026

Copy link
Copy Markdown

Note: let me add, that my deep knowledge of gzdoom is limited, but I wanted to play games based on gzdoom such as Blade of Agony on my Linux phone without setting up some custom overlays and stuff.
I haven't found any other open-source effort, so here it's.

The main inspiration was Luanti touchscreen controls (used across Linux and Android), but of course input system in gzdoom looks differently.

The menu experience is extremely annoying (small scale), but the game itself is fine.

Here is the video of freedoom (OnePlus 6T, running Mobian distribution)

Adds an on-screen touch control overlay for touchscreen devices:

- Virtual joystick (auto-follows the finger in the left third of the screen): digital 8-way movement through the regular +forward/+back/ +moveleft/+moveright bindings, with an outer ring that adds +speed.
- Look around by dragging anywhere that isn't a control; deltas go through PostMouseMove so mouse sensitivity/invert/freelook apply.
- Translucent buttons (fire, use, jump, crouch, weapon next/prev, esc) drawn with 2D primitives, no image assets.
- New KEY_TOUCH_* key codes bound via engine/commonbinds.txt, so every touch button is rebindable through the existing binding system. Configs from before these keys existed get the defaults re-applied.
- Touch taps act as left-mouse clicks in menus and the console.
- New cvars touch_enable (auto/off/on), touch_scale, touch_alpha, touch_sensitivity, with an Options -> Input -> Touchscreen menu.
- Mouse is not captured in relative mode while touch is enabled and touch-synthesized mouse events are dropped: SDL synthesizes mouse input from touches in relative mode even with the hint off, which made every touch fire mouse1.
- touchtest console command simulates finger events for development without touch hardware.

Similar work for UZDoom ( https://github.com/okias/UZDoom/tree/touch-controls but not upstremable due to strict LLM policy)

@okias okias mentioned this pull request Aug 10, 2026
Adds an on-screen touch control overlay for touchscreen devices:

- Virtual joystick (auto-follows the finger in the left third of the
  screen): digital 8-way movement through the regular +forward/+back/
  +moveleft/+moveright bindings, with an outer ring that adds +speed.
- Look around by dragging anywhere that isn't a control; deltas go
  through PostMouseMove so mouse sensitivity/invert/freelook apply.
- Translucent buttons (fire, use, jump, crouch, weapon next/prev, esc)
  drawn with 2D primitives, no image assets.
- New KEY_TOUCH_* key codes bound via engine/commonbinds.txt, so every
  touch button is rebindable through the existing binding system.
  Configs from before these keys existed get the defaults re-applied.
- Touch taps act as left-mouse clicks in menus and the console.
- New cvars touch_enable (auto/off/on), touch_scale, touch_alpha,
  touch_sensitivity, with an Options -> Input -> Touchscreen menu.
- Mouse is not captured in relative mode while touch is enabled and
  touch-synthesized mouse events are dropped: SDL synthesizes mouse
  input from touches in relative mode even with the hint off, which
  made every touch fire mouse1.
- touchtest console command simulates finger events for development
  without touch hardware.
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

Successfully merging this pull request may close these issues.

1 participant