-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
executable file
·331 lines (298 loc) · 8.73 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chess Mashup</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="icon" href="favicon.png" type="image/png" />
<meta property="og:image" content="https://1j01.github.io/chess-mashup/og-screenshot.png" />
<meta property="og:title" content="Chess Mashup" />
<meta property="og:description" content="Crazy chess variants in beautiful 3D." />
<meta property="og:url" content="https://1j01.github.io/chess-mashup/" />
<meta name="twitter:card" content="summary_large_image" />
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
#turn-indicator {
background-color: black;
color: white;
font-family: sans-serif;
font-size: 24px;
font-weight: bold;
position: absolute;
top: 0;
right: 0;
padding: 15px 20px;
border-bottom-left-radius: 20px;
}
#main-menu,
#new-game-options,
#general-options {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: black;
color: white;
font-family: sans-serif;
}
#general-options {
top: 70px;
right: auto;
bottom: auto;
}
#main-menu a {
color: firebrick;
text-decoration: none;
}
#main-menu h2 {
text-align: center;
}
#main-menu h2+p {
position: absolute;
left: 0;
right: 0;
bottom: 10px;
pointer-events: none;
text-align: center;
/* right: 0;
top: 0;
bottom: 0;
left: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center; */
}
#main-menu h2:not(:hover):not(:focus-within)+p {
opacity: 0;
}
#start-game {
width: 10em;
height: 2.5em;
font-size: 1.4em;
}
#floating-buttons {
position: absolute;
z-index: 5;
left: 5px;
top: 5px;
}
.floating-button,
#game-over-dialog button {
display: inline-block;
line-height: 2.5em;
padding: 0 10px;
font-size: 1.2em;
color: firebrick;
background-color: black;
border: 1px solid rgb(60, 0, 0);
cursor: pointer;
}
.floating-button:hover {
border-color: firebrick;
}
.icon-button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0;
width: 2em;
height: 2em;
border-radius: 50%;
}
.option-row {
padding: 10px;
display: block;
}
#loading-progress {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
}
#game-over-dialog[open] {
top: -5px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: rgb(36, 36, 36);
color: wheat;
border: 5px solid rgb(139, 19, 19);
border-radius: 5px;
box-shadow: 0 4px 2px 4px #bf0000, 0 4px 2px 5px #ff7e7e;
}
#game-over-dialog img {
width: 300px;
}
#game-over-dialog button {
width: 300px;
margin-bottom: 10px;
}
#game-over-dialog h1,
#game-over-dialog h2 {
margin: 5px;
}
#game-over-dialog h2 {
margin-bottom: 15px;
}
</style>
</head>
<body>
<progress max="1" min="0" value="0" id="loading-progress"></progress>
<div id="stats-and-renderer-container">
<!-- Stats.js element goes here -->
<div id="renderer-container">
<!-- Canvas and/or SVG goes here -->
</div>
</div>
<span id="turn-indicator"></span>
<div id="floating-buttons">
<a id="leave-game" class="floating-button" href="#" style="display: none">Leave Game</a>
<a id="back-to-main" class="floating-button" href="#" style="display: none">Back</a>
<button id="toggle-options-button" class="floating-button icon-button" aria-label="Options"
aria-expanded="false" aria-controls="general-options">
<span aria-hidden="true">⚙️</span>
</button>
</div>
<div id="main-menu">
<h2><a href="#almost-chess/new-game">Incorrect Chess</a></h2>
<p>The classic game of strategy.</p>
<h2><a href="#chess-on-a-cube/new-game">Chess on a Cube</a></h2>
<p>Finally a perfect information game with poor visibility! Pieces move all over the map.</p>
<h2><a href="#voxel-chess/new-game">Voxel Chess</a></h2>
<p>Chess on arbitrary cubic terrain. Unfair to your brain.</p>
<!--
<h2><a href="#bio-chess/new-game">Biological Chess</a></h2>
<p>Chess played on a growing organism.</p>
<h2><a href="#mashup/new-game">Chess Mashup
<p style="line-height: 1; margin: 0; font-size: 0.6em"><em style="color: gray">Or:</em> What Game Should We Play? Yes</p>
</a></h2>
<p>Combining tile based board games of Chess, Checkers, Go, Othello, and Scrabble.</p>
<h2><a href="#campaign/new-game">Campaign</a></h2>
<p>Story mode chess puzzle saga.</p>
-->
</div>
<div id="new-game-options" style="display: none">
<fieldset>
<legend>Players</legend>
<label>
<input type="radio" name="players" value="1" checked> 1 Player
</label>
<label>
<input type="radio" name="players" value="2"> 2 Players
</label>
</fieldset>
<br>
<div id="voxel-chess-options">
<label class="option-row">
World Size:
<input type="number" id="world-size" value="8" style="width: 50px">
</label>
<label class="option-row">
Seed:
<input type="text" id="seed" value="" style="width: 50px">
</label>
</div>
<br>
<button id="start-game">Play</button>
</div>
<div id="general-options" style="display: none">
<label class="option-row">
Visual theme:
<select id="visual-theme-select">
<option value="default" selected>Elegant</option>
<option value="perf">Retro</option>
<option value="wireframe">Wireframe</option>
<option value="svg">Symbolic</option>
</select>
</label>
<label class="option-row">
<input type="checkbox" checked id="enable-shadows-checkbox"> Enable Shadows
</label>
<label class="option-row">
Audio theme:
<select id="audio-theme-select" disabled>
<option value="elegant">Elegant</option>
<option value="cartoon" selected>Cartoon</option>
<option value="retro">Retro</option>
</select>
</label>
<label class="option-row">
<input type="checkbox" disabled id="music-checkbox"> Music
</label>
</div>
<dialog id="game-over-dialog" style="display: none">
<img src="textures/game-over-top.png" />
<!-- heading text is replaced when showing the dialog -->
<h1>Game Over</h1>
<h2>To be continued...</h2>
<button id="return-to-menu">Main Menu</button>
<button id="review-game">Review Game</button>
<img src="textures/game-over-bottom.png" />
</dialog>
<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
<script type="importmap">
{
"imports": {
"three": "./lib/three.module.js"
}
}
</script>
<script src="lib/seedrandom.min.js"></script>
<script>
var Detector = {
canvas: !!window.CanvasRenderingContext2D,
webgl: (function () { try { return !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl'); } catch (e) { return false; } })(),
workers: !!window.Worker,
fileapi: window.File && window.FileReader && window.FileList && window.Blob,
getWebGLErrorMessage: function () {
var element = document.createElement('div');
element.id = 'webgl-error-message';
element.style.fontFamily = 'monospace';
element.style.fontSize = '13px';
element.style.fontWeight = 'normal';
element.style.textAlign = 'center';
element.style.background = '#fff';
element.style.color = '#000';
element.style.padding = '1.5em';
element.style.width = '400px';
element.style.margin = '5em auto 0';
if (!this.webgl) {
element.innerHTML = window.WebGLRenderingContext ? [
'Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />',
'Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'
].join('\n') : [
'Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>',
'Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'
].join('\n');
}
return element;
},
addGetWebGLMessage: function (ops) {
ops = ops || {};
var parent, id, element;
parent = ops.parent !== undefined ? ops.parent : document.body;
id = ops.id !== undefined ? ops.id : 'oldie';
element = Detector.getWebGLErrorMessage();
element.id = id;
parent.appendChild(element);
}
};
</script>
<script type="module" src="game.js"></script>
</body>
</html>