xwords/xwords4/wasm/main.html
2021-03-19 14:26:18 -07:00

102 lines
3.1 KiB
HTML

<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
canvas.emscripten {
border: 0px none;
margin-left:auto;
margin-right:auto;
display:block;
}
p.startButton {
text-align: center;
background-color: #4c7aff;
font-family: Sans-Serif;
padding: 10px;
}
#loadingDiv {
text-align: center;
}
div.buttons {
text-align: center;
}
</style>
<script>
function callNewGame() {
var args = [
document.getElementById("player0Checked").checked,
document.getElementById("player1Checked").checked,
]
Module.ccall('newgame', null, ['boolean', 'boolean'], args);
}
</script>
</head>
<body>
<div id="loadingDiv">CrossWords is loading...</div>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<div style="width:200px; margin-left:auto; margin-right:auto">
<p class="startButton" onclick="start_function(this)">Click to start</p>
</div>
<div class="buttons">
<button onclick="Module.ccall('button', null, ['string'], ['hintdown']);">Prev Hint</button>
<button onclick="Module.ccall('button', null, ['string'], ['hintup']);">Next Hint</button>
<button onclick="Module.ccall('button', null, ['string'], ['flip']);">Flip</button>
<button onclick="Module.ccall('button', null, ['string'], ['redo']);">Un/Redo</button>
<button onclick="Module.ccall('button', null, ['string'], ['vals']);">Vals</button>
</div>
<div class="buttons">
<span>Player 1</span>
<input type="checkbox" id="player0Checked">Is Robot</input>
</div>
<div class="buttons">
<span>Player 2</span>
<input type="checkbox" id="player1Checked">Is Robot</input>
</div>
<div class="buttons">
<button type="button" onclick="callNewGame();">New Game</button>
</div>
<script type='text/javascript'>
var Module = {
onRuntimeInitialized: function() {
var e = document.getElementById('loadingDiv');
e.style.visibility = 'hidden';
},
canvas: (function() {
var canvas = document.getElementById('canvas');
return canvas;
})()
};
var start_function = function(o) {
o.style.visibility = "hidden";
Module.ccall('mainf', null, null);
};
</script>
<script>
(function() {
var memoryInitializer = 'main.js.mem';
if (typeof Module['locateFile'] === 'function') {
memoryInitializer = Module['locateFile'](memoryInitializer);
} else if (Module['memoryInitializerPrefixURL']) {
memoryInitializer = Module['memoryInitializerPrefixURL'] + memoryInitializer;
}
var xhr = Module['memoryInitializerRequest'] = new XMLHttpRequest();
xhr.open('GET', memoryInitializer, true);
xhr.responseType = 'arraybuffer';
xhr.send(null);
})();
var script = document.createElement('script');
script.src = "main.js";
document.body.appendChild(script);
</script>
</body>
</html>