openMSX
ArkanoidPad.hh
Go to the documentation of this file.
1 #ifndef ARKANOIDPAD_HH
2 #define ARKANOIDPAD_HH
3 
4 #include "JoystickDevice.hh"
5 #include "MSXEventListener.hh"
6 #include "StateChangeListener.hh"
7 #include "serialize_meta.hh"
8 
9 namespace openmsx {
10 
11 class MSXEventDistributor;
12 class StateChangeDistributor;
13 
14 class ArkanoidPad final : public JoystickDevice, private MSXEventListener
15  , private StateChangeListener
16 {
17 public:
18  explicit ArkanoidPad(MSXEventDistributor& eventDistributor,
19  StateChangeDistributor& stateChangeDistributor);
20  ~ArkanoidPad() override;
21 
22  template<typename Archive>
23  void serialize(Archive& ar, unsigned version);
24 
25 private:
26  // Pluggable
27  const std::string& getName() const override;
28  std::string_view getDescription() const override;
29  void plugHelper(Connector& connector, EmuTime::param time) override;
30  void unplugHelper(EmuTime::param time) override;
31 
32  // JoystickDevice
33  byte read(EmuTime::param time) override;
34  void write(byte value, EmuTime::param time) override;
35 
36  // MSXEventListener
37  void signalMSXEvent(const std::shared_ptr<const Event>& event,
38  EmuTime::param time) override;
39  // StateChangeListener
40  void signalStateChange(const std::shared_ptr<StateChange>& event) override;
41  void stopReplay(EmuTime::param time) override;
42 
43  MSXEventDistributor& eventDistributor;
44  StateChangeDistributor& stateChangeDistributor;
45  int shiftreg;
46  int dialpos;
47  byte buttonStatus;
48  byte lastValue;
49 };
51 
52 } // namespace openmsx
53 
54 #endif
openmsx::ArkanoidPad::~ArkanoidPad
~ArkanoidPad() override
Definition: ArkanoidPad.cc:67
StateChangeListener.hh
openmsx::MSXEventDistributor
Definition: MSXEventDistributor.hh:13
serialize_meta.hh
openmsx::JoystickDevice
Definition: JoystickDevice.hh:9
openmsx::MSXEventListener
Definition: MSXEventListener.hh:11
openmsx::StateChangeDistributor
Definition: StateChangeDistributor.hh:14
JoystickDevice.hh
openmsx::SERIALIZE_CLASS_VERSION
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
MSXEventListener.hh
openmsx::ArkanoidPad::serialize
void serialize(Archive &ar, unsigned version)
Definition: ArkanoidPad.cc:188
openmsx::ArkanoidPad
Definition: ArkanoidPad.hh:14
openmsx::Connector
Represents something you can plug devices into.
Definition: Connector.hh:20
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::ArkanoidPad::ArkanoidPad
ArkanoidPad(MSXEventDistributor &eventDistributor, StateChangeDistributor &stateChangeDistributor)
Definition: ArkanoidPad.cc:56
openmsx::StateChangeListener
Definition: StateChangeListener.hh:11