summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/screen-browser.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-02 20:59:36 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-02 20:59:36 +0100
commit4fe67b36e3bbe6ea5505ed7233c245be9374f0ce (patch)
treef5cfe88f252ee2e9830162a1673441a704e6ea37 /lib/nes/app/ui/screen-browser.hh
parent8062afc25e895cb49e76f6e26e51a7d4a1ad2df2 (diff)
refactor selection
Diffstat (limited to 'lib/nes/app/ui/screen-browser.hh')
-rw-r--r--lib/nes/app/ui/screen-browser.hh32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/nes/app/ui/screen-browser.hh b/lib/nes/app/ui/screen-browser.hh
new file mode 100644
index 0000000..eb66266
--- /dev/null
+++ b/lib/nes/app/ui/screen-browser.hh
@@ -0,0 +1,32 @@
+#pragma once
+
+#include "nes/app/ui/screen.hh"
+#include "nes/app/ui/selection.hh"
+
+namespace nes::app
+{
+ class input_device_keyboard;
+
+ /// An interface which allows the user to browse the filesystem for a game.
+ class screen_browser final : public screen
+ {
+ class selection_impl final : public selection<i32, 5>
+ {
+ public:
+ using selection::selection;
+
+ protected:
+ auto render_item(renderer&, i32 const&, i32 x, i32 y, u32 width, color) const -> void override;
+ auto load_page(i32(&)[5], u32 page) -> u32 override;
+ };
+
+ input_device_keyboard& keyboard_;
+ selection_impl selection_{ 2, 5, 28 };
+
+ public:
+ explicit screen_browser(input_device_keyboard&);
+
+ auto render(renderer&) -> void override;
+ auto process_events() -> action override;
+ };
+} // namespace nes::app \ No newline at end of file