Keys: which ones are held, not only which were pressed

Apps heard a key once, when it went down. A Game that moves something
for as long as a key is held (issue #101) asks the key mapper instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
This commit is contained in:
2026-10-13 22:59:05 +02:00
co-authored by Claude Opus 5.5
parent 8aa2848c5f
commit 5c660d866d
3 changed files with 77 additions and 0 deletions
+6
View File
@@ -33,6 +33,12 @@ class KeyMapper {
// don't need Fn.
void setTextEntry(bool active) { textEntry_ = active; }
// Is this key down right now, as of the last update()? Events only say when a key goes down:
// a Game that moves something for as long as a key is held asks this (issue #101). The arrows
// are ; . , / as for events: alone outside Text Entry, with Fn anywhere.
bool held(Key key) const;
bool heldChar(char c) const; // a character key, as it types
// 0 when idle, '*' when opt was pressed, or the accent character waiting for its letter.
char pendingCompose() const { return compose_; }