raylib_parthenon/minshell.html

78 lines
2.5 KiB
HTML
Raw Normal View History

2023-11-03 23:20:25 -04:00
<!doctype html>
<html lang="en-us">
<head>
2023-11-04 22:15:11 -04:00
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2023-11-03 23:20:25 -04:00
<title>raylib web game</title>
2023-11-04 22:15:11 -04:00
2023-11-03 23:20:25 -04:00
<style>
2023-11-04 22:15:11 -04:00
body {
margin: 0px;
}
canvas.emscripten {
border: 0px none;
background-color: black;
}
2023-11-03 23:20:25 -04:00
</style>
2023-11-04 22:15:11 -04:00
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"
></script>
<script type="text/javascript">
function saveFileFromMEMFSToDisk(memoryFSname, localFSname) {
// This can be called by C/C++ code
var isSafari = false; // Not supported, navigator.userAgent access is being restricted
//var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
var data = FS.readFile(memoryFSname);
var blob;
2023-11-03 23:20:25 -04:00
2023-11-04 22:15:11 -04:00
if (isSafari)
blob = new Blob([data.buffer], { type: "application/octet-stream" });
else
blob = new Blob([data.buffer], { type: "application/octet-binary" });
2023-11-03 23:20:25 -04:00
2023-11-04 22:15:11 -04:00
// NOTE: SaveAsDialog is a browser setting. For example, in Google Chrome,
// in Settings/Advanced/Downloads section you have a setting:
// 'Ask where to save each file before downloading' - which you can set true/false.
// If you enable this setting it would always ask you and bring the SaveAsDialog
saveAs(blob, localFSname);
}
</script>
</head>
<body>
<canvas
class="emscripten"
id="canvas"
oncontextmenu="event.preventDefault()"
tabindex="-1"
></canvas>
<p id="output" />
<script>
var Module = {
print: (function () {
let element = document.getElementById("output");
if (element) element.value = ""; // clear browser cache
return function (text) {
if (arguments.length > 1)
text = Array.prototype.slice.call(arguments).join(" ");
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
canvas: (function () {
let canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth; //document.width is obsolete
canvas.height = document.body.clientHeight; //document.height is obsolete
canvasW = canvas.width;
canvasH = canvas.height;
return canvas;
})(),
};
2023-11-03 23:20:25 -04:00
</script>
2023-11-04 22:15:11 -04:00
{{{ SCRIPT }}}
</body>
2023-11-03 23:20:25 -04:00
</html>