summaryrefslogtreecommitdiff
path: root/lib/nes/app/input/input-device.hh
blob: bd2f7c22d6d8ed42cdb4a69860609461847eafd2 (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 "nes/common/containers/string-view.hh"

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 -> string_view = 0;

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