Skip to content

Commit b793642

Browse files
committed
Added a nice pause reminder
1 parent 370fd68 commit b793642

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

src/components/wasmboyCanvas/wasmboyCanvas.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,25 @@ export default class WasmBoyCanvas extends Component {
132132
onPlay: () => {
133133
// This is to show/hide the
134134
// Insert cartridge
135-
this.setState({
136-
...this.state
135+
setTimeout(() => {
136+
this.setState(
137+
{
138+
...this.state
139+
},
140+
100
141+
);
142+
});
143+
},
144+
onPause: () => {
145+
// This is to show/hide the
146+
// Insert cartridge
147+
setTimeout(() => {
148+
this.setState(
149+
{
150+
...this.state
151+
},
152+
100
153+
);
137154
});
138155
},
139156
saveStateCallback: saveStateObject => {
@@ -233,13 +250,20 @@ export default class WasmBoyCanvas extends Component {
233250
);
234251
}
235252

253+
// Get a pause overlay
254+
let pauseOverlay = <div />;
255+
if (WasmBoy.isLoadedAndStarted() && WasmBoy.isPaused()) {
256+
pauseOverlay = <div class="wasmboy-canvas__pause-overlay">Paused ⏸️</div>;
257+
}
258+
236259
return (
237260
<div class={canvasClasses.join(" ")} aria-hidden="true">
238261
<div class="wasmboy-canvas__canvas-container">
239262
<canvas id="wasmboy-canvas" />
240263
</div>
241264
{insertCartridge}
242265
{debugOverlay}
266+
{pauseOverlay}
243267
</div>
244268
);
245269
}

src/components/wasmboyCanvas/wasmboyCanvas.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@
6969
z-index: 4;
7070
}
7171

72+
&__pause-overlay {
73+
position: absolute;
74+
bottom: 0px;
75+
right: 0px;
76+
77+
padding: 5px;
78+
79+
background-color: $aesthetic-50-transparent;
80+
color: $aesthetic-white;
81+
82+
z-index: 5;
83+
}
84+
7285
&__canvas-container {
7386
position: absolute;
7487
top: 0px;

0 commit comments

Comments
 (0)