agb/website/src/App.tsx

31 lines
677 B
TypeScript
Raw Normal View History

2023-04-13 21:44:00 +01:00
import React, { useState } from "react";
import { Mgba } from "./mgba";
2023-04-13 20:12:45 +01:00
function App() {
2023-04-13 21:32:40 +01:00
const [onGame, setOnGame] = useState(false);
const [volume, setVolume] = useState(1.0);
2023-04-13 20:12:45 +01:00
return (
2023-04-13 21:32:40 +01:00
<div>
2023-04-13 21:44:00 +01:00
{onGame && (
<>
<Mgba gameUrl="/game.gba" volume={volume} />
<input
type="range"
value={volume}
min="0"
max="1"
step="0.05"
onChange={(e) => setVolume(Number(e.target.value))}
></input>
</>
)}
<button onClick={() => setOnGame(!onGame)}>
{onGame ? "End Game" : "Start Game"}
</button>
2023-04-13 20:12:45 +01:00
</div>
);
}
export default App;