summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/screen.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-01 00:38:55 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-01 00:38:55 +0100
commit1d5f5482f91391a6dfee9ec0e7cb0a22ee5f0464 (patch)
tree80e1dff12390aa36ec532da655136e4b83b6ccf3 /lib/nes/app/ui/screen.hh
parentccb81b60dac888e44079fb0228c1d5d8542ceade (diff)
implement screens
Diffstat (limited to 'lib/nes/app/ui/screen.hh')
-rw-r--r--lib/nes/app/ui/screen.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/nes/app/ui/screen.hh b/lib/nes/app/ui/screen.hh
new file mode 100644
index 0000000..07e9d6f
--- /dev/null
+++ b/lib/nes/app/ui/screen.hh
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "nes/app/ui/action.hh"
+
+namespace nes::app
+{
+ class renderer;
+
+ /// A part of the UI which takes care of rendering and handling input events.
+ ///
+ /// One screen may be shown at a time. It may be used as an overlay over an active game.
+ class screen
+ {
+ public:
+ virtual ~screen() = default;
+
+ screen(screen const&) = delete;
+ screen(screen&&) = delete;
+ auto operator=(screen const&) -> screen& = delete;
+ auto operator=(screen&&) -> screen& = delete;
+
+ /// Render a frame with the current UI state.
+ virtual auto render(renderer&) -> void = 0;
+
+ /// Handle events and return an action for the application to execute.
+ virtual auto process_events() -> action = 0;
+
+ protected:
+ explicit screen() = default;
+ };
+} // namespace nes::app \ No newline at end of file