|
| 1 | +<!doctype html> |
| 2 | +<html lang="EN-us"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 | + |
| 7 | + <title>raylib web game</title> |
| 8 | + |
| 9 | + <meta name="title" content="raylib web game"> |
| 10 | + <meta name="description" content="New raylib web videogame, developed using raylib videogames library"> |
| 11 | + <meta name="keywords" content="raylib, programming, examples, html5, C, C++, library, learn, games, videogames"> |
| 12 | + <meta name="viewport" content="width=device-width"> |
| 13 | + |
| 14 | + <!-- Open Graph metatags for sharing --> |
| 15 | + <meta property="og:type" content="website" /> |
| 16 | + <meta property="og:title" content="raylib web game"> |
| 17 | + <meta property="og:image:type" content="image/png"> |
| 18 | + <meta property="og:image" content="https://www.raylib.com/common/raylib_logo.png"> |
| 19 | + <meta property="og:image:alt" content="New raylib web videogame, developed using raylib videogames library" /> |
| 20 | + <meta property="og:site_name" content="raylib - example"> |
| 21 | + <meta property="og:url" content="https://www.raylib.com/games.html"> |
| 22 | + <meta property="og:description" content="New raylib web videogame, developed using raylib videogames library"> |
| 23 | + |
| 24 | + <!-- Twitter metatags for sharing --> |
| 25 | + <meta name="twitter:card" content="summary_large_image"> |
| 26 | + <meta name="twitter:site" content="@raysan5"> |
| 27 | + <meta name="twitter:title" content="raylib web game"> |
| 28 | + <meta name="twitter:image" content="https://www.raylib.com/common/raylib_logo.png"> |
| 29 | + <meta name="twitter:image:alt" content="New raylib web videogame, developed using raylib videogames library"> |
| 30 | + <meta name="twitter:url" content="https://www.raylib.com/games.html"> |
| 31 | + <meta name="twitter:description" content="New raylib web videogame, developed using raylib videogames library"> |
| 32 | + |
| 33 | + <!-- Favicon --> |
| 34 | + <link rel="shortcut icon" href="https://www.raylib.com/favicon.ico"> |
| 35 | + |
| 36 | + <style> |
| 37 | + body { margin: 0px; overflow: hidden; background-color: black; } |
| 38 | + canvas.emscripten { border: 0px none; background-color: black; } |
| 39 | + </style> |
| 40 | + <script type='text/javascript' src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"> </script> |
| 41 | + <script type='text/javascript'> |
| 42 | + function saveFileFromMEMFSToDisk(memoryFSname, localFSname) // This can be called by C/C++ code |
| 43 | + { |
| 44 | + var isSafari = false; // Not supported, navigator.userAgent access is being restricted |
| 45 | + //var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); |
| 46 | + var data = FS.readFile(memoryFSname); |
| 47 | + var blob; |
| 48 | + |
| 49 | + if (isSafari) blob = new Blob([data.buffer], { type: "application/octet-stream" }); |
| 50 | + else blob = new Blob([data.buffer], { type: "application/octet-binary" }); |
| 51 | + |
| 52 | + // NOTE: SaveAsDialog is a browser setting. For example, in Google Chrome, |
| 53 | + // in Settings/Advanced/Downloads section you have a setting: |
| 54 | + // 'Ask where to save each file before downloading' - which you can set true/false. |
| 55 | + // If you enable this setting it would always ask you and bring the SaveAsDialog |
| 56 | + saveAs(blob, localFSname); |
| 57 | + |
| 58 | + // Alternative implementation to avoid FileSaver.js |
| 59 | + //const link = document.createElement("a"); |
| 60 | + //link.href = URL.createObjectURL(blob); |
| 61 | + //link.download = localFSname; |
| 62 | + //link.click(); |
| 63 | + } |
| 64 | + </script> |
| 65 | + </head> |
| 66 | + <body> |
| 67 | + <canvas class=emscripten id=canvas oncontextmenu=event.preventDefault() tabindex=-1></canvas> |
| 68 | + <p id="output" /> |
| 69 | + <script> |
| 70 | + var Module = { |
| 71 | + print: (function() { |
| 72 | + var element = document.getElementById('output'); |
| 73 | + if (element) element.value = ''; // clear browser cache |
| 74 | + return function(text) { |
| 75 | + if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' '); |
| 76 | + console.log(text); |
| 77 | + if (element) { |
| 78 | + element.value += text + "\n"; |
| 79 | + element.scrollTop = element.scrollHeight; // focus on bottom |
| 80 | + } |
| 81 | + }; |
| 82 | + })(), |
| 83 | + canvas: (function() { |
| 84 | + var canvas = document.getElementById('canvas'); |
| 85 | + return canvas; |
| 86 | + })() |
| 87 | + }; |
| 88 | + </script> |
| 89 | + {{{ SCRIPT }}} |
| 90 | + </body> |
| 91 | +</html> |
0 commit comments