1
0
forked from sent/waves
waves-fork/public/assets/g/csdust/index.html
2025-04-09 17:11:14 -05:00

133 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CS Dust</title>
<style>
html,
body {
background: #000;
width: 100%;
height: 100%;
overflow: visible;
padding: 0;
margin: 0;
}
div#gameContainer {
background: transparent !important;
position: absolute;
}
div#gameContainer canvas {
position: absolute;
}
div#gameContainer canvas[data-pixel-art="true"] {
position: absolute;
image-rendering: optimizeSpeed;
image-rendering: -webkit-crisp-edges;
image-rendering: -moz-crisp-edges;
image-rendering: -o-crisp-edges;
image-rendering: crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: optimize-contrast;
image-rendering: pixelated;
-ms-interpolation-mode: nearest-neighbor;
}
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block }
#unity-logo {width: 154px; height: 130px; background: url('TemplateData/unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; background: url('TemplateData/progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('TemplateData/progress-bar-full-dark.png') no-repeat center }
</style>
<script src="https://img.y8.com/prevent-keys.js"></script></head>
<body>
<div id="gameContainer">
<canvas id="unity-canvas" data-pixel-art=""></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
<script src="Build/CS Dust.loader.js"></script>
<script>
var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full");
var canvas = document.querySelector("#unity-canvas");
var logo = document.querySelector("#unity-logo");
var config = {
dataUrl: "Build/CS Dust.data.gz",
frameworkUrl: "Build/CS Dust.framework.js.gz",
codeUrl: "Build/CS Dust.wasm.gz",
streamingAssetsUrl: "StreamingAssets",
companyName: "SAFING Inc",
productName: "CS Dust",
productVersion: "1",
};
var scaleToFit;
try {
scaleToFit = !!JSON.parse("");
} catch (e) {
scaleToFit = true;
}
function progressHandler(progress) {
var percent = progress * 100 + '%';
progressBarFull.style.width = percent;
}
function onResize() {
var container = canvas.parentElement;
var w;
var h;
if (scaleToFit) {
w = window.innerWidth;
h = window.innerHeight;
var r = 600 / 960;
if (w * r > window.innerHeight) {
w = Math.min(w, Math.ceil(h / r));
}
h = Math.floor(w * r);
} else {
w = 960;
h = 600;
}
container.style.width = canvas.style.width = w + "px";
container.style.height = canvas.style.height = h + "px";
container.style.top = Math.floor((window.innerHeight - h) / 2) + "px";
container.style.left = Math.floor((window.innerWidth - w) / 2) + "px";
logo.style.left = Math.floor((w - 154) / 2) + "px"; // 154 is the width of the logo
logo.style.top = Math.floor((h - 130) / 3) + "px"; // 130 is the height of the logo, divided by 3 for 33
}
var myGameInstance = null;
createUnityInstance(canvas, config, progressHandler).then(function (instance) {
loadingBar.style.display = 'none';
myGameInstance = instance;
canvas = instance.Module.canvas;
onResize();
});
window.addEventListener('resize', onResize);
onResize();
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
const meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
}
</script>
<script type="text/javascript" src="TemplateData/gameBreakBeta.js"></script>
</div>
</body>
</html>