summaryrefslogtreecommitdiff
path: root/lib/nes/app/input/input-device.hh
blob: 008825d513815268ff1edd70943011049f54506c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "nes/sys/types/button-mask.hh"
#include <string_view>

namespace nes::app
{
	/// An abstract input device which can be used to play games.
	class input_device
	{
	public:
		virtual ~input_device() = default;

		input_device(input_device const&) = delete;
		input_device(input_device&&) = delete;
		auto operator=(input_device const&) -> input_device& = delete;
		auto operator=(input_device&&) -> input_device& = delete;

		/// Read the controller button state.
		virtual auto read_buttons() -> sys::button_mask = 0;

		/// Human-readable name for the device.
		virtual auto get_name() const -> std::string_view = 0;

	protected:
		explicit input_device() = default;
	};
} // namespace nes::app