diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-04 23:11:08 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-04 23:11:08 +0100 |
| commit | 79553ab1fa3d707612e80dd03bf95ca65fa0c411 (patch) | |
| tree | f44bec41548d569cfca43c44e0e4ffa7b72ed4ed /app/mac/impl/input-device-serial-controller.hh | |
| parent | 9c45e9c7df1efa5bc1c8e73b6eaef4726b828d3e (diff) | |
refactor file browser
Diffstat (limited to 'app/mac/impl/input-device-serial-controller.hh')
| -rw-r--r-- | app/mac/impl/input-device-serial-controller.hh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/mac/impl/input-device-serial-controller.hh b/app/mac/impl/input-device-serial-controller.hh new file mode 100644 index 0000000..2022ed2 --- /dev/null +++ b/app/mac/impl/input-device-serial-controller.hh @@ -0,0 +1,29 @@ +#pragma once + +#include "nes/app/input/input-device-controller.hh" + +namespace nes::app::mac +{ + /// Input device for an NES controller plugged in via serial port. + class input_device_serial_controller final : public input_device_controller + { + char const* path_; + int fd_{ -1 }; + sys::button_mask current_{}; + index index_{ index::unused }; + + public: + explicit input_device_serial_controller(char const* path); + ~input_device_serial_controller() override; + + auto is_reliable() const -> bool override; + auto get_name() const -> std::string_view override { return path_; } + auto get_index() const -> index override { return index_; } + auto set_index(index const v) -> void override { index_ = v; } + auto read_buttons() -> sys::button_mask override; + + private: + auto set_up() -> bool; + auto close() -> void; + }; +} // namespace nes::app:mac
\ No newline at end of file |
