Skip to content

Commit 1bd4037

Browse files
committed
Deploying to gh-pages from @ 7e674d4 🚀
0 parents  commit 1bd4037

10 files changed

Lines changed: 3247 additions & 0 deletions

File tree

assets/icon-1024.png

314 KB
Loading

assets/icon-256.png

47.2 KB
Loading

assets/icon_ios_touch_192.png

20.6 KB
Loading

assets/maskable_icon_x512.png

128 KB
Loading

chess.js

Lines changed: 3027 additions & 0 deletions
Large diffs are not rendered by default.

chess_bg.wasm

9.64 MB
Binary file not shown.

favicon.ico

15 KB
Binary file not shown.

index.html

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4+
5+
<!-- Don't cache page. It can mess up persistent stage. -->
6+
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate" />
7+
<meta http-equiv="Pragma" content="no-cache" />
8+
<meta http-equiv="Expires" content="0" />
9+
10+
<!-- Disable zooming: -->
11+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
12+
13+
<head>
14+
<!-- change this to your project name -->
15+
<title>Chess</title>
16+
17+
<!-- config for our rust wasm binary. go to https://trunkrs.dev/assets/#rust for more customization -->
18+
19+
<script type="module">
20+
import init, * as bindings from 'https://pishleback.github.io/Two-Player-Games/chess.js';
21+
const wasm = await init({ module_or_path: 'https://pishleback.github.io/Two-Player-Games/chess_bg.wasm' });
22+
23+
24+
window.wasmBindings = bindings;
25+
26+
27+
dispatchEvent(new CustomEvent("TrunkApplicationStarted", {detail: {wasm}}));
28+
29+
</script>
30+
<!-- this is the base url relative to which other urls will be constructed. trunk will insert this from the public-url option -->
31+
<base href="https://pishleback.github.io/Two-Player-Games/" />
32+
33+
<link rel="icon" href="https://pishleback.github.io/Two-Player-Games/favicon.ico" integrity="sha384-jNOAE6jgE03LznIulCTVP6BH4NrTuROFjP9wj8bV1UUMJKtZAvstFpIAP3PDcFpx"/>
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
<link rel="manifest" href="manifest.json">
45+
<link rel="apple-touch-icon" href="assets/icon_ios_touch_192.png">
46+
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white">
47+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#404040">
48+
49+
<style>
50+
html {
51+
/* Remove touch delay: */
52+
touch-action: manipulation;
53+
}
54+
55+
body {
56+
/* Light mode background color for what is not covered by the egui canvas,
57+
or where the egui canvas is translucent. */
58+
background: #909090;
59+
}
60+
61+
@media (prefers-color-scheme: dark) {
62+
body {
63+
/* Dark mode background color for what is not covered by the egui canvas,
64+
or where the egui canvas is translucent. */
65+
background: #404040;
66+
}
67+
}
68+
69+
/* Allow canvas to fill entire web page: */
70+
html,
71+
body {
72+
overflow: hidden;
73+
margin: 0 !important;
74+
padding: 0 !important;
75+
height: 100%;
76+
width: 100%;
77+
}
78+
79+
/* Make canvas fill entire document: */
80+
canvas {
81+
margin-right: auto;
82+
margin-left: auto;
83+
display: block;
84+
position: absolute;
85+
top: 0;
86+
left: 0;
87+
width: 100%;
88+
height: 100%;
89+
}
90+
91+
.centered {
92+
margin-right: auto;
93+
margin-left: auto;
94+
display: block;
95+
position: absolute;
96+
top: 50%;
97+
left: 50%;
98+
transform: translate(-50%, -50%);
99+
color: #f0f0f0;
100+
font-size: 24px;
101+
font-family: Ubuntu-Light, Helvetica, sans-serif;
102+
text-align: center;
103+
}
104+
105+
/* ---------------------------------------------- */
106+
/* Loading animation from https://loading.io/css/ */
107+
.lds-dual-ring {
108+
display: inline-block;
109+
width: 24px;
110+
height: 24px;
111+
}
112+
113+
.lds-dual-ring:after {
114+
content: " ";
115+
display: block;
116+
width: 24px;
117+
height: 24px;
118+
margin: 0px;
119+
border-radius: 50%;
120+
border: 3px solid #fff;
121+
border-color: #fff transparent #fff transparent;
122+
animation: lds-dual-ring 1.2s linear infinite;
123+
}
124+
125+
@keyframes lds-dual-ring {
126+
0% {
127+
transform: rotate(0deg);
128+
}
129+
130+
100% {
131+
transform: rotate(360deg);
132+
}
133+
}
134+
</style>
135+
<link rel="modulepreload" href="https://pishleback.github.io/Two-Player-Games/chess.js" crossorigin="anonymous" integrity="sha384-f6C8L42ahPDX69yqTCw2VgyLQtnZBv7SNm0KHih1a8ZWgh9Fgb+vohcBwNbZi7+j"><link rel="preload" href="https://pishleback.github.io/Two-Player-Games/chess_bg.wasm" crossorigin="anonymous" integrity="sha384-jiWEIL6LjrilYXrFW31zs9KYOHwXIW0W1ZS55ATwWO3iMsjpSZ6oCnehP9DJZvDL" as="fetch" type="application/wasm"></head>
136+
137+
<body>
138+
<!-- The WASM code will resize the canvas dynamically -->
139+
<!-- the id is hardcoded in main.rs . so, make sure both match. -->
140+
<canvas id="the_canvas_id"></canvas>
141+
142+
<!-- the loading spinner will be removed in main.rs -->
143+
<div class="centered" id="loading_text">
144+
<p style="font-size:16px">
145+
Loading…
146+
</p>
147+
<div class="lds-dual-ring"></div>
148+
</div>
149+
150+
<!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
151+
<!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files -->
152+
<script>
153+
// We disable caching during development so that we always view the latest version.
154+
if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
155+
window.addEventListener('load', function () {
156+
if (!navigator.gpu) {
157+
alert("WebGPU is not supported in this browser. Some features may be missing.");
158+
}
159+
navigator.serviceWorker.register('sw.js');
160+
});
161+
}
162+
</script>
163+
</body>
164+
165+
</html>
166+
167+
<!-- Powered by egui: https://github.com/emilk/egui/ -->

manifest.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "egui Template PWA",
3+
"short_name": "egui-template-pwa",
4+
"icons": [
5+
{
6+
"src": "./assets/icon-256.png",
7+
"sizes": "256x256",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "./assets/maskable_icon_x512.png",
12+
"sizes": "512x512",
13+
"type": "image/png",
14+
"purpose": "any maskable"
15+
},
16+
{
17+
"src": "./assets/icon-1024.png",
18+
"sizes": "1024x1024",
19+
"type": "image/png"
20+
}
21+
],
22+
"lang": "en-US",
23+
"id": "/index.html",
24+
"start_url": "./index.html",
25+
"display": "standalone",
26+
"background_color": "white",
27+
"theme_color": "white"
28+
}

sw.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var cacheName = 'egui-template-pwa';
2+
var filesToCache = [
3+
'./',
4+
'./index.html',
5+
'./eframe_template.js',
6+
'./eframe_template_bg.wasm',
7+
];
8+
9+
/* Start the service worker and cache all of the app's content */
10+
self.addEventListener('install', function (e) {
11+
e.waitUntil(
12+
caches.open(cacheName).then(function (cache) {
13+
return cache.addAll(filesToCache);
14+
})
15+
);
16+
});
17+
18+
/* Serve cached content when offline */
19+
self.addEventListener('fetch', function (e) {
20+
e.respondWith(
21+
caches.match(e.request).then(function (response) {
22+
return response || fetch(e.request);
23+
})
24+
);
25+
});

0 commit comments

Comments
 (0)