protected setButtonState()

in share/src/components/GameButtons.tsx [75:93]


    protected setButtonState(button: SimulatorButton, pressed: boolean) {
        const isAButton = button === SimulatorButton.A;
        const circle = isAButton ? this.aButton : this.bButton;
        const label = isAButton ? this.aLabel : this.bLabel;

        if (circle && label) {
            const pressedColor = "#249ca3";
            circle.setAttribute("fill", pressed ? pressedColor : "#333")
            label.setAttribute("fill", pressed ? "#333" : "")
        }

        const { simulator } = this.props;
        if (pressed) {
            if (!this.buttonPressCount[SimulatorButton[button]]) this.buttonPressCount[SimulatorButton[button]] = 0;
            this.buttonPressCount[SimulatorButton[button]] += 1;
            simulator.pressButton(button);
        }
        else simulator.releaseButton(button);
    }