Skip to content

Commit 29fdf4c

Browse files
committed
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.
1 parent 7bb2393 commit 29fdf4c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lde.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!doctype html>
22
<!-- Based on https://github.com/timhutton/sdl-canvas-wasm/blob/main/index.html -->
3+
<!-- html to set up WebAssembly module for Medley running in a browser -->
34
<html>
45
<head>
56
<meta charset="utf-8">
@@ -10,8 +11,11 @@
1011
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
1112
</div>
1213
<script type="text/javascript">
14+
var width = 32*Math.trunc(Math.min(Math.max(window.innerWidth, 512), 1664)/32);
15+
var height = Math.min(Math.max(window.innerHeight, 512), 1260);
1316
var Module = {
14-
arguments: ["medley/loadups/full.sysout"],
17+
preRun: [ function() {ENV.MEDLEYDIR = "{DSK}<medley>";} ],
18+
arguments: ["medley/loadups/full.sysout","-sc", width+"x"+height, "-nh-host", "127.0.0.1"],
1519
canvas: (function() { return document.getElementById('canvas'); })()
1620
};
1721
</script>

0 commit comments

Comments
 (0)