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"
7#include "KeyCodeSetting.hh"
8#include "serialize_meta.hh"
9
10namespace openmsx {
11
12class CommandController;
13class MSXEventDistributor;
14class StateChangeDistributor;
15
16class KeyJoystick final : public JoystickDevice, private MSXEventListener
17 , private StateChangeListener
18{
19public:
20 enum ID { ID1, ID2, UNKNOWN };
21
22public:
23 KeyJoystick(CommandController& commandController,
24 MSXEventDistributor& eventDistributor,
25 StateChangeDistributor& stateChangeDistributor,
26 ID id);
27 ~KeyJoystick() override;
28
29 template<typename Archive>
30 void serialize(Archive& ar, unsigned version);
31
32private:
33 // Pluggable
34 [[nodiscard]] std::string_view getName() const override;
35 [[nodiscard]] std::string_view getDescription() const override;
36 void plugHelper(Connector& connector, EmuTime::param time) override;
37 void unplugHelper(EmuTime::param time) override;
38
39 // KeyJoystickDevice
40 [[nodiscard]] uint8_t read(EmuTime::param time) override;
41 void write(uint8_t value, EmuTime::param time) override;
42
43 // MSXEventListener
44 void signalMSXEvent(const Event& event,
45 EmuTime::param time) noexcept override;
46 // StateChangeListener
47 void signalStateChange(const StateChange& event) override;
48 void stopReplay(EmuTime::param time) noexcept override;
49
50private:
51 MSXEventDistributor& eventDistributor;
52 StateChangeDistributor& stateChangeDistributor;
54 KeyCodeSetting down;
55 KeyCodeSetting left;
56 KeyCodeSetting right;
57 KeyCodeSetting trigA;
58 KeyCodeSetting trigB;
59 const ID id;
60
61 uint8_t status;
62 bool pin8;
63};
65
66} // namespace openmsx
67
68#endif
Represents something you can plug devices into.
Definition Connector.hh:21
~KeyJoystick() override
void serialize(Archive &ar, unsigned version)
Base class for all external MSX state changing events.
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:444
#define SERIALIZE_CLASS_VERSION(CLASS, VERSION)