eco2d/web/eco2d.html

86 lines
4.1 KiB
HTML
Raw Normal View History

2022-09-11 19:58:30 +00:00
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>eco2d web game</title>
<meta name="title" content="eco2d web game">
<meta name="description" content="Small C99 2D game engine with a focus on prototyping">
<meta name="keywords" content="eco2d, html5, ecs, C, librg, chunks">
<meta name="viewport" content="width=device-width">
<!-- Open Graph metatags for sharing -->
<meta property="og:title" content="eco2d web game">
<meta property="og:image:type" content="image/png">
<meta property="og:image" content="https://avatars.githubusercontent.com/u/31039603?s=400&u=371f601b81fd4c6843f910b4565a54704caaa374&v=4">
<meta property="og:site_name" content="zpl.pw">
<meta property="og:url" content="https://github.com/zpl-c/eco2d">
<meta property="og:description" content="Small C99 2D game engine with a focus on prototyping">
<!-- Twitter metatags for sharing -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@DMadarasz">
<meta name="twitter:title" content="eco2d web game">
<meta name="twitter:image" content="https://avatars.githubusercontent.com/u/31039603?s=400&u=371f601b81fd4c6843f910b4565a54704caaa374&v=4">
<meta name="twitter:url" content="https://github.com/zpl-c/eco2d">
<meta name="twitter:description" content="Small C99 2D game engine with a focus on prototyping">
<style>
body { margin: 0px; background-color: black;}
canvas.emscripten { border: 0px none; background-color: black; }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
</style>
<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;
if (isSafari) blob = new Blob([data.buffer], { type: "application/octet-stream" });
else blob = new Blob([data.buffer], { type: "application/octet-binary" });
// 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>
<div class="overlay">
<input type="button" value="Fullscreen" onclick="Module.requestFullscreen(false, true);">
</div>
<canvas class=emscripten id=canvas oncontextmenu=event.preventDefault() tabindex=-1></canvas>
<script>
var Module = {
print: (function() {
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.log(text);
};
})(),
printErr: (function() {
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
console.error(text);
};
})(),
canvas: (function() {
var canvas = document.getElementById('canvas');
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})()
};
</script>
{{{ SCRIPT }}}
</body>
</html>