Touch interface for phones and tablets; category toolbar for mouse and touch

- touch.rs: gesture recognition (tap, double tap, long press, drag, two-finger pan/pinch/rotate)
- Touch mode: Auto (touch device or first touch) / On / Off in Settings -> Game
- Larger interface factor on touch screens, top bar wraps, smaller minimap, fewer messages
- Toolbar grouped into categories with pop-up rows and a menu button, also on the desktop
- Long press shows information or drops held units; double tap with the hand slaps
- Savegame name via the browser's text dialog when the name field is tapped
- Touch help texts (EN/DE)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-03 10:10:53 +01:00
1 parent 6f037294c0
commit af6be62805
10 files changed
+744 -152

No files matched your search

+11
View File
@@ -102,6 +102,17 @@
bytes(ptr, pending.length).set(pending);
pending = null;
};
// browser text dialog (touch devices have no keyboard in the canvas); result via dc_storage_take
env.dc_prompt = function (tp, tl, dp, dl) {
var v = window.prompt(str(tp, tl), str(dp, dl));
if (v === null || v === undefined) { pending = null; return -1; }
pending = new TextEncoder().encode(v);
return pending.length;
};
// the device's main pointer is a finger (phones, tablets)
env.dc_coarse_pointer = function () {
try { return window.matchMedia("(pointer: coarse)").matches ? 1 : 0; } catch (e) { return 0; }
};
env.dc_storage_set = function (kp, kl, vp, vl) {
try { window.localStorage.setItem(str(kp, kl), str(vp, vl)); } catch (e) { }
};