diff --git a/website/src/App.tsx b/website/src/App.tsx
index da84fe16..a7fcf941 100644
--- a/website/src/App.tsx
+++ b/website/src/App.tsx
@@ -25,6 +25,23 @@ const ActionButton = styled.button`
const AppContainer = styled.main`
height: calc(100vh - 20px);
padding: 10px;
+ display: flex;
+`;
+
+const StartButtonWrapper = styled.button`
+ margin: auto;
+ font-size: 5em;
+ padding: 1em;
+ text-transform: uppercase;
+ background-color: black;
+ color: white;
+ border: none;
+ border-radius: 0.5em;
+
+ &:hover {
+ background-color: #222;
+ cursor: pointer;
+ }
`;
function App() {
@@ -50,6 +67,8 @@ function App() {
useAvoidItchIoScrolling();
+ const [isPlaying, setIsPlaying] = useState(false);
+
return (
{showBindings && (
@@ -63,13 +82,17 @@ function App() {
restart={() => mgbaRef.current?.restart()}
/>
)}
-
+ {isPlaying ? (
+
+ ) : (
+ setIsPlaying(true)} />
+ )}
);
}
@@ -101,11 +124,7 @@ function BindingsWindow({
min="0"
max="1"
step="0.05"
- onChange={(e) => {
- console.log("e.target.value", e.target.value);
- console.log("volume", volume);
- setVolume(Number(e.target.value));
- }}
+ onChange={(e) => setVolume(Number(e.target.value))}
/>
void }) {
+ return (
+ Press to start
+ );
+}
+
export default App;
diff --git a/website/src/mgba.tsx b/website/src/mgba.tsx
index 5f5fc463..e0c1e064 100644
--- a/website/src/mgba.tsx
+++ b/website/src/mgba.tsx
@@ -56,6 +56,8 @@ export const Mgba = forwardRef(
const gamePath = `${MGBA_ROM_DIRECTORY}/${gameUrl}`;
mgbaModule.current.FS.writeFile(gamePath, new Uint8Array(gameData));
mgbaModule.current.loadGame(gamePath);
+ mgbaModule.current.setVolume(0.1); // for some reason you have to do this or you get no sound
+ console.log(mgbaModule.current.getVolume());
setGameLoaded(true);
})();
}, [state, gameUrl]);
@@ -63,7 +65,7 @@ export const Mgba = forwardRef(
// init mgba
useEffect(() => {
(async () => {
- if (canvas === null) return;
+ if (canvas.current === null) return;
if (state !== MgbaState.Uninitialised) return;
setState(MgbaState.Initialising);
@@ -111,7 +113,9 @@ export const Mgba = forwardRef(
useEffect(() => {
if (!gameLoaded) return;
+ console.log("before", mgbaModule.current.getVolume());
mgbaModule.current.setVolume(volume ?? 1.0);
+ console.log("after", mgbaModule.current.getVolume());
}, [gameLoaded, volume]);
useEffect(() => {