-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
147 lines (120 loc) · 3.4 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<head>
@manifest {
title: "Undertale";
favicon: "/assets/soul.png";
}
@resources {
# CDN can be replaced with local copy of PIXI.js
js:
https://cdnjs.cloudflare.com/ajax/libs/pixi.js/8.3.4/pixi.min.js,
/engine/engine.js,
/engine/constructor.js,
/engine/misc.js,
# Game logic
/game/game.js
;
ls-js: tiny;
}
<script async>
window.tsl = Date.now() // Time since load
</script>
</head>
<body>
<main %viewPort></main>
<style>
@font-face {
font-family: "DeterminationSans";
src: url(/assets/fonts/determination/sans.ttf);
}
:root, html, body {
font-family: DeterminationSans;
background: #111;
color: #fff;
position: fixed;
margin: 0;
padding: 0;
inset: 0;
width: 100%;
height: 100%;
-webkit-font-smoothing: none;
-moz-osx-font-smoothing: grayscale;
font-smooth: never;
-webkit-user-select: none;
user-select: none;
}
canvas {
width: 100%;
height: 100%;
object-fit: contain;
}
.debug canvas {
outline: 2px solid red;
}
img, canvas {
image-rendering: pixelated;
}
img {
-webkit-user-drag: none;
-khtml-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
}
body.scaling {
position: relative;
transform: translate(50%, 50%);
/* overflow: hidden; */
}
#viewPort {
min-width: 640px;
min-height: 480px;
height: 100vh;
width: 100vw;
/* overflow: hidden; */
background-color: #000;
padding: 0;
margin: 0;
}
#toolset {
padding: 4px;
}
.scaling #toolset {
position: fixed;
background: #0005;
top: -50%;
right: 50%;
}
.debug #debugTools {
display: block;
}
</style>
<div %toolset>
<details>
<summary>
Options
</summary>
<input type="checkbox" %scaleToView>
<label for="scaleToView">Scale to fit the screen</label> <br>
<input type="checkbox" %debugMode>
<label for="debugMode">Enable debug mode</label> <br> <br>
<button onclick="window.open(location.href, '', `width=${app.screen.width},height=${app.screen.height}`)">Start in a window</button> <br> <br>
<div %debugTools hidden>
FPS: <span .fps></span>
</div>
</details>
</div>
<script>
O("#scaleToView").on("change", function () {
engine.scaling = this.checked
})
let FPSInterval;
O("#debugMode").on("change", function () {
game.debug = this.checked
if(game.debug){
FPSInterval = setInterval(() => {
O(".fps").innerText = app.ticker.FPS.toFixed(2)
}, 500)
} else clearInterval(FPSInterval)
})
</script>
</body>