Skip to content

Commit

Permalink
Add web demo instructions, clean up confusing inputs in streamer rom
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Oct 18, 2024
1 parent 04e6f46 commit 0abfd82
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
37 changes: 33 additions & 4 deletions emulator-patches/web-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,30 @@
background: black;
}

#clickToStart {
#clickToStart, #instructions {
background: black;
color: white;
border: none;

font-family: "Kode Mono";
font-optical-sizing: auto;
font-weight: bold;
font-style: italic;

font-size: calc(min(6vw, 20vh));
display: block;
margin: auto;
margin-top: 1em;
}

#clickToStart {
border: 1px white solid;
padding: 0.5em;
font-style: italic;
}

#instructions {
font-size: calc(min(5vw, 16vh));
padding: 1em;
}

</style>
Expand All @@ -65,6 +76,14 @@
async function main() {
// Change the click-to-start label to a loading indicator.
clickToStart.innerText = 'Loading...'
clickToStart.disabled = true;

// We haven't finished loading JS, try again in 1s.
if (!window.Nostalgist) {
console.log('Waiting for Nostalgist...');
setTimeout(main, 1000);
return;
}

// Launch the emulator, which will create its own canvas.
const nostalgist = await Nostalgist.launch({
Expand All @@ -75,8 +94,9 @@
},
rom: 'kinetoscope-streamer.rom',
onLaunch: () => {
// Once loaded, hide the click-to-start button.
// Once loaded, hide the click-to-start button and instructions.
clickToStart.style.display = 'none';
instructions.style.display = 'none';
},
});

Expand Down Expand Up @@ -108,6 +128,15 @@
</script>

<body>
<button id="clickToStart" onclick="main()">Click to start<br>Kinetoscope Emulator</button>
<button id="clickToStart" onclick="main()">Click here to start<br>Kinetoscope Emulator</button>
<div id="instructions">
<ul>
<li>up: ↑ / swipe up</li>
<li>down: ↓ / swipe down</li>
<li>start: enter / tap</li>
<li>pause: enter / tap</li>
<li>stop: X / swipe left</li>
</ul>
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions software/stream-with-special-hardware/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

static void onJoystickEvent(u16 joystick, u16 changed, u16 state) {
if (segavideo_getState() == Error) {
// Error: press start|A|B|C to continue.
if (state & (BUTTON_START | BUTTON_A | BUTTON_B | BUTTON_C)) {
// Error: press start|A to continue.
if (state & (BUTTON_START | BUTTON_A)) {
segavideo_menu_clearError();
}
} else if (segavideo_getState() == Player) {
Expand All @@ -28,8 +28,8 @@ static void onJoystickEvent(u16 joystick, u16 changed, u16 state) {
segavideo_stop();
}
} else if (segavideo_getState() == Menu) {
// Menu: press start|A|B|C to choose, up/down to navigate.
if (state & (BUTTON_START | BUTTON_A | BUTTON_B | BUTTON_C)) {
// Menu: press start|A to choose, up/down to navigate.
if (state & (BUTTON_START | BUTTON_A)) {
segavideo_menu_select(/* loop= */ false);
}
if (state & BUTTON_UP) {
Expand Down

0 comments on commit 0abfd82

Please sign in to comment.