From 13e41e69f7a10b819f77c2db0b9e5364ea51de2e Mon Sep 17 00:00:00 2001 From: Can Date: Mon, 3 Feb 2025 17:12:20 +0100 Subject: UI changes and audio support --- src/renderers/js.effekt | 285 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 264 insertions(+), 21 deletions(-) (limited to 'src/renderers') diff --git a/src/renderers/js.effekt b/src/renderers/js.effekt index 05802e6..3292481 100644 --- a/src/renderers/js.effekt +++ b/src/renderers/js.effekt @@ -13,6 +13,8 @@ extern io def log(msg: String): Unit = jsWeb "log(${msg});" extern io def loadRom(): ByteArray = jsWeb "rom ? rom : new Uint8Array(0)" extern io def requestAnimationFrame {callback: () => Unit}: Unit = jsWeb "requestAnimationFrame(() => $effekt.runToplevel((ks) => ${box callback}(ks)))" extern jsWeb """ + let audioContext = null; + let oscillator = null; let rom = undefined; let keyStates = new Map(); // Change to track multiple keys let lastKeyUpdate = performance.now(); @@ -60,31 +62,246 @@ val pageContent = """
CHIP-8 Emulator in Effekt
+