summaryrefslogtreecommitdiff
path: root/lib/nes/app/application.hh
blob: 5cd6ac71df343e6d17d7e526ca23be1c322848bb (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
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "nes/app/input/input-manager.hh"
#include "nes/sys/nes.hh"
#include <chrono>

namespace nes
{
	class display;
} // namespace nes

namespace nes::app
{
	/// Entrypoint for the application.
	///
	/// This class takes care of presenting a UI screen or the emulator, handling any errors and implementing the main
	/// application logic.
	///
	/// It delegates some platform-specific tasks to interfaces.
	class application
	{
		display& display_;
		input_manager input_manager_;
		sys::nes console_;

	public:
		explicit application(display&, input_device_keyboard&);

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

		/// Request a new frame for the application.
		auto frame(std::chrono::microseconds elapsed_time) -> void;

		auto add_controller(input_device_controller& c) -> void { input_manager_.add_controller(c); }
		auto remove_controller(input_device_controller& c) -> void { input_manager_.remove_controller(c); }
	};
} // namespace nes::app