openMSX
KeyJoystick.hh
Go to the documentation of this file.
1 #ifndef KEYJOYSTICK_HH
2 #define KEYJOYSTICK_HH
3 
4 #include "JoystickDevice.hh"
5 #include "MSXEventListener.hh"
6 #include "StateChangeListener.hh"
7 #include "KeyCodeSetting.hh"
8 #include "serialize_meta.hh"
9 
10 namespace openmsx {
11 
12 class CommandController;
13 class MSXEventDistributor;
14 class StateChangeDistributor;
15 
16 class KeyJoystick final : public JoystickDevice, private MSXEventListener
17  , private StateChangeListener
18 {
19 public:
20  KeyJoystick(CommandController& commandController,
21  MSXEventDistributor& eventDistributor,
22  StateChangeDistributor& stateChangeDistributor,
23  std::string name);
24  ~KeyJoystick() override;
25 
26  template<typename Archive>
27  void serialize(Archive& ar, unsigned version);
28 
29 private:
30  // Pluggable
31  const std::string& getName() const override;
32  string_view getDescription() const override;
33  void plugHelper(Connector& connector, EmuTime::param time) override;
34  void unplugHelper(EmuTime::param time) override;
35 
36  // KeyJoystickDevice
37  byte read(EmuTime::param time) override;
38  void write(byte value, EmuTime::param time) override;
39 
40  // MSXEventListener
41  void signalMSXEvent(const std::shared_ptr<const Event>& event,
42  EmuTime::param time) override;
43  // StateChangeListener
44  void signalStateChange(const std::shared_ptr<StateChange>& event) override;
45  void stopReplay(EmuTime::param time) override;
46 
47  MSXEventDistributor& eventDistributor;
48  StateChangeDistributor& stateChangeDistributor;
49  const std::string name;
50  KeyCodeSetting up;
51  KeyCodeSetting down;
52  KeyCodeSetting left;
53  KeyCodeSetting right;
54  KeyCodeSetting trigA;
55  KeyCodeSetting trigB;
56 
57  byte status;
58  bool pin8;
59 };
61 
62 } // namespace openmsx
63 
64 #endif
void serialize(Archive &ar, unsigned version)
Definition: KeyJoystick.cc:176
Represents something you can plug devices into.
Definition: Connector.hh:20
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
~KeyJoystick() override
Definition: KeyJoystick.cc:64
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
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
KeyJoystick(CommandController &commandController, MSXEventDistributor &eventDistributor, StateChangeDistributor &stateChangeDistributor, std::string name)
Definition: KeyJoystick.cc:40