1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-15 04:06:19 +00:00

Adapt to window geometry, set up a fake environment variable MEDLEYDIR

Passes the window width/height as the requested geometry to lde at startup.

Since we control the directory structure of the file-system, we can pass the
known fixed location of the Medley directories in the MEDLEYDIR environment variable.

Sets up the NetHub host as localhost - not currenty functional, but a WebSocket
server could be added to communicate with the NetHub gateway to enable local
networking from the browser version of Medley.
This commit is contained in:
Nick Briggs
2024-01-01 16:58:23 -08:00
parent 7bb2393637
commit 29fdf4c40b

View File

@@ -1,5 +1,6 @@
<!doctype html>
<!-- Based on https://github.com/timhutton/sdl-canvas-wasm/blob/main/index.html -->
<!-- html to set up WebAssembly module for Medley running in a browser -->
<html>
<head>
<meta charset="utf-8">
@@ -10,8 +11,11 @@
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
</div>
<script type="text/javascript">
var width = 32*Math.trunc(Math.min(Math.max(window.innerWidth, 512), 1664)/32);
var height = Math.min(Math.max(window.innerHeight, 512), 1260);
var Module = {
arguments: ["medley/loadups/full.sysout"],
preRun: [ function() {ENV.MEDLEYDIR = "{DSK}<medley>";} ],
arguments: ["medley/loadups/full.sysout","-sc", width+"x"+height, "-nh-host", "127.0.0.1"],
canvas: (function() { return document.getElementById('canvas'); })()
};
</script>