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  [[nodiscard]] const std::string& getName() const override;
27  [[nodiscard]] std::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  [[nodiscard]] 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 private:
43  MSXEventDistributor& eventDistributor;
44  StateChangeDistributor& stateChangeDistributor;
45 
46  EmuTime lastPulse;
47  byte analogValue;
48  byte lastInput;
49 };
50 
51 } // namespace openmsx
52 
53 #endif
StateChangeListener.hh
openmsx::Paddle::serialize
void serialize(Archive &ar, unsigned version)
Definition: Paddle.cc:125
openmsx::MSXEventDistributor
Definition: MSXEventDistributor.hh:14
openmsx::JoystickDevice
Definition: JoystickDevice.hh:10
openmsx::MSXEventListener
Definition: MSXEventListener.hh:12
openmsx::StateChangeDistributor
Definition: StateChangeDistributor.hh:15
JoystickDevice.hh
MSXEventListener.hh
openmsx::Paddle::Paddle
Paddle(MSXEventDistributor &eventDistributor, StateChangeDistributor &stateChangeDistributor)
Definition: Paddle.cc:32
openmsx::Paddle
Definition: Paddle.hh:15
openmsx::Paddle::~Paddle
~Paddle() override
Definition: Paddle.cc:42
openmsx::Connector
Represents something you can plug devices into.
Definition: Connector.hh:21
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::StateChangeListener
Definition: StateChangeListener.hh:12