summaryrefslogtreecommitdiff
path: root/lib/nes/app/application.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-01-30 16:43:06 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-01-31 00:02:26 +0100
commit307e07d6513f9524b7fcab5134494bd175465cd1 (patch)
treece025db2ea998bdcd8980a0ed443083f0daf8d35 /lib/nes/app/application.hh
parent5959349f341a2380c0c3f41ec40a1e8e0d969d00 (diff)
handle input devices in the c++ application
Diffstat (limited to 'lib/nes/app/application.hh')
-rw-r--r--lib/nes/app/application.hh37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/nes/app/application.hh b/lib/nes/app/application.hh
new file mode 100644
index 0000000..9f6bd16
--- /dev/null
+++ b/lib/nes/app/application.hh
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "nes/app/input/input-manager.hh"
+#include "nes/sys/nes.hh"
+#include <chrono>
+
+namespace nes
+{
+ class display;
+
+ /// 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_;
+ 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 \ No newline at end of file