Skip to content

Commit 923133e

Browse files
committed
feat(*): back to home page button
1 parent f16bf2a commit 923133e

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

www/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<link rel="icon" type="image/x-icon" href="/favicon.ico"/>
3232
</head>
3333
<body>
34+
<button class="back-home-page" title="Back to home page">👋</button>
3435
<canvas id="bevy"></canvas>
3536
<div id="orientationlock">Please lock your device in portrait mode to use this game.</div>
3637
<div id="presentation">

www/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ document.getElementById('start').addEventListener('click', () => {
1212
document.body.classList.add('playing');
1313
init();
1414
});
15+
16+
document.querySelector('.back-home-page').addEventListener('click', () => {
17+
console.log('stop');
18+
window.location.reload(); // todo find an more elegant and performant to cleanup wasm instanciations
19+
})

www/style.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,28 @@ canvas#bevy {
3030
display: none;
3131
}
3232

33+
button.back-home-page {
34+
display: none;
35+
cursor: pointer;
36+
position: absolute;
37+
bottom: 16px;
38+
left: 16px;
39+
border: 4px solid #808080;
40+
width: 36px;
41+
height: 48px;
42+
font-size: 22px;
43+
background-color: white;
44+
padding: 0px;
45+
}
46+
3347
.playing canvas#bevy {
3448
display: block;
3549
}
3650

51+
.playing button.back-home-page {
52+
display: block;
53+
}
54+
3755
#presentation {
3856
display: block;
3957
padding: 1rem;

0 commit comments

Comments
 (0)