clone

a browser grid puzzle game where you push words around to rewrite the rules of each level

feat(input): request spoken board summary with T

Dami committed 55cd31a
commit
55cd31ab6802c8097bf87cdb4e9997fdfbcb73f2
parent
a5711fe70f587466842bfe39810dab914348435c
author
Dami <dami.etoile@gmail.com>
2 files changed, +11 -3
Msrc/input.js6+++---
Mtests/input.test.js8++++++++
M src/input.js +3 -3
@@ -113,7 +113,7 @@ export function createInput(options = {}) {
113113 if (typeof dirOrIntent === 'string') {114114 if (DIRECTIONS[dirOrIntent]) return pressDirection(dirOrIntent, source, `${source}:${dirOrIntent}`, time);115115 if (dirOrIntent === 'undo') return pressUndo(source, source, time);116- if (['confirm', 'restart', 'menu', 'mute'].includes(dirOrIntent)) { emit({ type: dirOrIntent, source }); return true; }116+ if (['confirm', 'restart', 'menu', 'mute', 'summary'].includes(dirOrIntent)) { emit({ type: dirOrIntent, source }); return true; }117117 return false;118118 }119119 if (!dirOrIntent || typeof dirOrIntent !== 'object') return false;
@@ -127,7 +127,7 @@ export function createInput(options = {}) {
127127 }128128 function pressAction(type, source = 'gamepad', time = now()) {129129 if (type === 'undo') return pressUndo(source, source, time);130- if (['confirm', 'restart', 'menu', 'mute'].includes(type)) { emit({ type, source }); return true; }130+ if (['confirm', 'restart', 'menu', 'mute', 'summary'].includes(type)) { emit({ type, source }); return true; }131131 return false;132132 }133133 function releaseAction(type, source = 'gamepad') {
@@ -148,7 +148,7 @@ export function createInput(options = {}) {
148148 if (!event.repeat) pressUndo('keyboard', `keyboard:${key}`);149149 return;150150 }151- const action = ({ Enter: 'confirm', Escape: 'menu', p: 'menu', P: 'menu', r: 'restart', R: 'restart', m: 'mute', M: 'mute' })[key];151+ const action = ({ Enter: 'confirm', Escape: 'menu', p: 'menu', P: 'menu', r: 'restart', R: 'restart', m: 'mute', M: 'mute', t: 'summary', T: 'summary' })[key];152152 if (action) { event.preventDefault?.(); if (!event.repeat) emit({ type: action, source: 'keyboard' }); }153153 }154154 function handleKeyUp(event) {
M tests/input.test.js +8 -0