openMSX
Paddle.hh
Go to the documentation of this file.
1#ifndef PADDLE_HH
2#define PADDLE_HH
3
4#include "EmuTime.hh"
5#include "JoystickDevice.hh"
6#include "MSXEventListener.hh"
8#include <cstdint>
9
10namespace openmsx {
11
12class MSXEventDistributor;
13class StateChangeDistributor;
14
15class Paddle final : public JoystickDevice, private MSXEventListener
16 , private StateChangeListener
17{
18public:
19 Paddle(MSXEventDistributor& eventDistributor,
20 StateChangeDistributor& stateChangeDistributor);
21 ~Paddle() override;
22
23 template<typename Archive>
24 void serialize(Archive& ar, unsigned version);
25
26private:
27 // Pluggable
28 [[nodiscard]] std::string_view getName() const override;
29 [[nodiscard]] std::string_view getDescription() const override;
30 void plugHelper(Connector& connector, EmuTime::param time) override;
31 void unplugHelper(EmuTime::param time) override;
32
33 // JoystickDevice
34 [[nodiscard]] uint8_t read(EmuTime::param time) override;
35 void write(uint8_t value, EmuTime::param time) override;
36
37 // MSXEventListener
38 void signalMSXEvent(const Event& event,
39 EmuTime::param time) noexcept override;
40 // StateChangeListener
41 void signalStateChange(const StateChange& event) override;
42 void stopReplay(EmuTime::param time) noexcept override;
43
44private:
45 MSXEventDistributor& eventDistributor;
46 StateChangeDistributor& stateChangeDistributor;
47
48 EmuTime lastPulse = EmuTime::zero();
49 uint8_t analogValue = 128;
50 uint8_t lastInput = 0;
51};
52
53} // namespace openmsx
54
55#endif
Represents something you can plug devices into.
Definition Connector.hh:21
~Paddle() override
Definition Paddle.cc:38
void serialize(Archive &ar, unsigned version)
Definition Paddle.cc:120
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