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