-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
71 lines (59 loc) · 3.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE 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">
<title>TIC-80 tiny computer</title>
<link rel="stylesheet" href="style.css">
<style type="text/css">
#game-frame > div { font-size: 44px; font-family: monospace; font-weight: bold;}
/* You can set custom dimensions here */
.game { width: 100vw; height: 100vh; }
/* Uncomment to remove the frame on top of the canvas and start the game directly */
/* #game-frame { display: none; } */
</style>
</head>
<body style="margin:0; padding:0; background: linear-gradient(to right bottom,#ECEFF4,rgb(161, 176, 199));">
<div id="mySidenav" class="sidenav" onmouseleave="closeNav()">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="https://scythe101.github.io">Home</a>
<a href="https://scythe101.github.io/htmlclickergame">HTML Clicker Game</a>
<a href="https://scythe101.github.io/SummationCalc">Summation Notation Calculator</a>
<a href="https://scythe101.github.io/scythes_breakout">Scythe's Breakout</a>
<a href="https://scythe101.github.io/scythes_shmup/">Scythe's Shmup</a>
<a href="https://scythe101.github.io/scythe-os/">Scythe OS</a>
<a href="https://scythe101.github.io/ninja_platformer">Ninja Platformer</a>
</div>
<span onmouseover="teaseNav()" onmouseleave="closeTeasedNav()" id="menuButton" onclick="openNav()">☰</span>
<div class="game" style="margin: 0; position: relative; background: linear-gradient(to right bottom,#ECEFF4,rgb(161, 176, 199));">
<div id="game-frame" style="cursor: pointer; position: absolute; margin: 0 auto; opacity: 1; background: linear-gradient(to right bottom,#ECEFF4,rgb(161, 176, 199)); width: 100%; height: 100%;">
<div style="text-align: center; color: white; display: flex; justify-content: center; align-items: center; width: 100%; height: 100%;">
<p style="margin: 0;">- CLICK TO PLAY -</p>
</div>
</div>
<canvas style="width: 100%; height: 95%; margin: 0 auto; display: block; image-rendering: pixelated; background:linear-gradient(to right bottom,#ECEFF4,rgb(161, 176, 199))" id="canvas" oncontextmenu="event.preventDefault()" onmousedown="window.focus()"></canvas>
</div>
<script type="text/javascript">
var Module = {canvas: document.getElementById('canvas'), arguments:['cart.tic']}
const gameFrame = document.getElementById('game-frame')
const displayStyle = window.getComputedStyle(gameFrame).display;
if (displayStyle === 'none')
{
let scriptTag = document.createElement('script'), // create a script tag
firstScriptTag = document.getElementsByTagName('script')[0]; // find the first script tag in the document
scriptTag.src = 'tic80.js'; // set the source of the script to your script
firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag); // append the script to the DOM
} else {
gameFrame.addEventListener('click', function() {
let scriptTag = document.createElement('script'), // create a script tag
firstScriptTag = document.getElementsByTagName('script')[0]; // find the first script tag in the document
scriptTag.src = 'tic80.js'; // set the source of the script to your script
firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag); // append the script to the DOM
this.remove()
});
}
</script>
<script src="main.js"></script>
</body>
</html>