krying
Version:
krying — games hub, AI, movies, and tools
77 lines (67 loc) • 2.18 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Kobran - Awsome Tanks</title>
<style>
html, body {
margin: 0;
padding: 0;
background: black;
overflow: hidden;
height: 100%;
width: 100%;
}
#flash-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: black;
}
ruffle-player {
width: 100%;
height: 100%;
background: black;
display: block;
}
</style>
<script src="https://cdn.jsdelivr.net/gh/somer-sheff-73/xv@main/ruffle.js"></script>
</head>
<body>
<div id="flash-container"></div>
<script>
const container = document.getElementById("flash-container");
function resizeGame() {
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
const aspectRatio = 4 / 3;
let width = Math.floor(windowWidth);
let height = Math.floor(windowWidth / aspectRatio);
if (height > windowHeight) {
height = Math.floor(windowHeight);
width = Math.floor(height * aspectRatio);
}
container.style.width = `${width}px`;
container.style.height = `${height}px`;
}
window.addEventListener("resize", resizeGame);
window.addEventListener("DOMContentLoaded", () => {
resizeGame();
const ruffle = window.RufflePlayer?.newest() || window.RufflePlayer?.createPlayer();
if (ruffle && container) {
const player = ruffle.createPlayer();
player.style.width = "100%";
player.style.height = "100%";
player.style.background = "black";
container.appendChild(player);
player.load("https://cdn.jsdelivr.net/gh/bubbls/UGS-file-encryption@754a57837e92bb4552e8247c6a401bd4ce8e4ee7/587840_awesomeTanks.swf");
} else {
container.textContent = "Ruffle failed to load.";
}
});
</script>
</body>
</html>