mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
Feedback
This commit is contained in:
parent
55708c2b39
commit
7d40740be3
|
@ -49,8 +49,8 @@ export const Apple2 = (props: Apple2Props) => {
|
|||
...props,
|
||||
};
|
||||
const apple2 = new Apple2Impl(options);
|
||||
setApple2(apple2);
|
||||
apple2.ready.then(() => {
|
||||
setApple2(apple2);
|
||||
const io = apple2.getIO();
|
||||
const cpu = apple2.getCPU();
|
||||
setIO(io);
|
||||
|
|
|
@ -26,13 +26,11 @@ export const AudioControl = ({ apple2 }: AudioControlProps) => {
|
|||
|
||||
useEffect(() => {
|
||||
if (apple2) {
|
||||
apple2.ready.then(() => {
|
||||
const io = apple2.getIO();
|
||||
const audio = new Audio(io);
|
||||
options.addOptions(audio);
|
||||
setAudio(audio);
|
||||
setAudioEnabled(audio.isEnabled());
|
||||
}).catch(console.error);
|
||||
const io = apple2.getIO();
|
||||
const audio = new Audio(io);
|
||||
options.addOptions(audio);
|
||||
setAudio(audio);
|
||||
setAudioEnabled(audio.isEnabled());
|
||||
}
|
||||
}, [apple2]);
|
||||
|
||||
|
@ -46,6 +44,7 @@ export const AudioControl = ({ apple2 }: AudioControlProps) => {
|
|||
<ControlButton
|
||||
onClick={doToggleSound}
|
||||
title="Toggle Sound"
|
||||
disabled={!audio}
|
||||
icon={audioEnabled ? 'volume-up' : 'volume-off'}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -6,6 +6,7 @@ import { h, JSX } from 'preact';
|
|||
export interface ControlButtonProps {
|
||||
icon: string;
|
||||
title: string;
|
||||
disabled?: boolean;
|
||||
onClick: JSX.MouseEventHandler<HTMLButtonElement>;
|
||||
}
|
||||
|
||||
|
@ -17,8 +18,8 @@ export interface ControlButtonProps {
|
|||
* @param onClick Click callback
|
||||
* @returns Control Button component
|
||||
*/
|
||||
export const ControlButton = ({ icon, title, onClick }: ControlButtonProps) => (
|
||||
<button onClick={onClick} title={title}>
|
||||
export const ControlButton = ({ icon, title, onClick, ...props }: ControlButtonProps) => (
|
||||
<button onClick={onClick} title={title} {...props} >
|
||||
<i class={`fas fa-${icon}`}></i>
|
||||
</button>
|
||||
);
|
||||
|
|
|
@ -35,19 +35,17 @@ export const ControlStrip = ({ apple2, e }: ControlStripProps) => {
|
|||
|
||||
useEffect(() => {
|
||||
if (apple2) {
|
||||
apple2.ready.then(() => {
|
||||
const io = apple2.getIO();
|
||||
const vm = apple2.getVideoModes();
|
||||
const io = apple2.getIO();
|
||||
const vm = apple2.getVideoModes();
|
||||
|
||||
const system = new System(io, e);
|
||||
options.addOptions(system);
|
||||
const system = new System(io, e);
|
||||
options.addOptions(system);
|
||||
|
||||
const joystick = new JoyStick(io);
|
||||
options.addOptions(joystick);
|
||||
const joystick = new JoyStick(io);
|
||||
options.addOptions(joystick);
|
||||
|
||||
const screen = new Screen(vm);
|
||||
options.addOptions(screen);
|
||||
}).catch(console.error);
|
||||
const screen = new Screen(vm);
|
||||
options.addOptions(screen);
|
||||
}
|
||||
}, [apple2]);
|
||||
|
||||
|
|
|
@ -34,12 +34,14 @@ export const PauseControl = ({ apple2 }: PauseControlProps) => {
|
|||
{running ? (
|
||||
<ControlButton
|
||||
onClick={doPause}
|
||||
disabled={!apple2}
|
||||
title="Pause"
|
||||
icon="pause"
|
||||
/>
|
||||
) : (
|
||||
<ControlButton
|
||||
onClick={doRun}
|
||||
disabled={!apple2}
|
||||
title="Run"
|
||||
icon="play"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user