agb/website/src/App.tsx

37 lines
817 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-17 22:57:24 +01:00
import { BindingsControl, DefaultBindingsSet } from "./bindings";
2023-04-13 20:12:45 +01:00
function App() {
2023-04-13 21:32:40 +01:00
const [volume, setVolume] = useState(1.0);
2023-04-17 22:57:24 +01:00
const [bindings, setBindings] = useState(DefaultBindingsSet());
const [paused, setPaused] = useState(false);
2023-04-13 21:32:40 +01:00
2023-04-13 20:12:45 +01:00
return (
2023-04-13 21:32:40 +01:00
<div>
2023-07-05 10:07:10 +01:00
<Mgba
gameUrl="/game.gba"
volume={volume}
controls={bindings.Actual}
paused={paused}
/>
<input
type="range"
value={volume}
min="0"
max="1"
step="0.05"
onChange={(e) => setVolume(Number(e.target.value))}
></input>
<BindingsControl
bindings={bindings}
setBindings={setBindings}
setPaused={setPaused}
/>
2023-04-13 20:12:45 +01:00
</div>
);
}
export default App;