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"
7#include "serialize_meta.hh"
8
9namespace openmsx {
10
11class MSXEventDistributor;
12class StateChangeDistributor;
13
14class ArkanoidPad final : public JoystickDevice, private MSXEventListener
15 , private StateChangeListener
16{
17public:
18 explicit ArkanoidPad(MSXEventDistributor& eventDistributor,
19 StateChangeDistributor& stateChangeDistributor);
20 ~ArkanoidPad() override;
21
22 template<typename Archive>
23 void serialize(Archive& ar, unsigned version);
24
25private:
26 // Pluggable
27 [[nodiscard]] std::string_view getName() const override;
28 [[nodiscard]] 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 [[nodiscard]] uint8_t read(EmuTime::param time) override;
34 void write(uint8_t value, EmuTime::param time) override;
35
36 // MSXEventListener
37 void signalMSXEvent(const Event& event,
38 EmuTime::param time) noexcept override;
39 // StateChangeListener
40 void signalStateChange(const StateChange& event) override;
41 void stopReplay(EmuTime::param time) noexcept override;
42
43private:
44 MSXEventDistributor& eventDistributor;
45 StateChangeDistributor& stateChangeDistributor;
46 int shiftReg = 0; // the 9 bit shift degrades to 0
47 int dialPos;
48 uint8_t buttonStatus = 0x3E;
49 uint8_t lastValue = 0;
50};
52
53} // namespace openmsx
54
55#endif
~ArkanoidPad() override
void serialize(Archive &ar, unsigned version)
Represents something you can plug devices into.
Definition Connector.hh:21
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:445
#define SERIALIZE_CLASS_VERSION(CLASS, VERSION)