我使用这个游戏引擎 pico8,您可以导出游戏的 html 版本。我把它放在我的网站上,但现在我网站上的所有其他 iframe 都无法正常工作了 我猜这是导致问题的代码(画布过度使用 iframe 或其他东西?):
<STYLE TYPE="text/css">
canvas#canvas { width: 512px; height: 412px; }
canvas{
image-rendering: optimizeSpeed;
image-rendering: -moz-crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: optimize-contrast;
image-rendering: pixelated;
-ms-interpolation-mode: nearest-neighbor;
border: 0px
}
</STYLE>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<script type="text/javascript">
var canvas = document.getElementById("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var Module = {};
Module.canvas = canvas;
</script>
<script async type="text/javascript" src="mywikinggame.js"></script>
<script>
function onKeyDown_blocker(event) {
event = event || window.event;
var o = document.activeElement;
if (!o || o == document.body || o.tagName == "canvas")
{
if ([32, 37, 38, 39, 40].indexOf(event.keyCode) > -1)
{
if (event.preventDefault) event.preventDefault();
}
}
}
document.addEventListener('keydown', onKeyDown_blocker, false);
</script>
</div></center>