feat(nds): improve fullscreen button and add volume slider

This commit is contained in:
2026-02-25 17:09:41 +01:00
parent 8c64f287e1
commit 39476d0b53
6 changed files with 91 additions and 52 deletions

View File

@@ -12,8 +12,9 @@ const createAudio = (path: string) => {
return {
play: (volume = 1) => {
if (!source) return;
const app = useAppStore();
const audio = source.cloneNode() as HTMLAudioElement;
audio.volume = volume;
audio.volume = Math.min(1, volume * app.settings.volume);
audio.addEventListener("ended", () => audio.remove(), { once: true });
audio.play().catch(() => {});
},

View File

@@ -7,6 +7,6 @@ export const useClockTick = () => {
const s = now.getSeconds();
if (s === lastSecond) return;
lastSecond = s;
assets.audio.clockTick.play(s === 0 ? 1 : 0.7);
assets.audio.clockTick.play(s === 0 ? 2 : 1.4);
};
};

View File

@@ -13,6 +13,12 @@ export const useKeyDown = (callback: KeyDownCallback) => {
if (app.lagDetected) return;
const ndsButton = mapCodeToNDS(event.code);
if (
ndsButton &&
document.activeElement &&
document.activeElement !== document.body
)
return;
callback({
key: ndsButton ? `NDS_${ndsButton}` : event.key,
ndsButton,