diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-02 22:49:01 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-02 22:49:01 +0100 |
| commit | 0f22ed2ef160eef2da6080782943b22c9539650d (patch) | |
| tree | 1b43aada2d0183273e79b4d1db7b1e60dd809855 /lib/nes/app/ui/screen-browser.hh | |
| parent | 4fe67b36e3bbe6ea5505ed7233c245be9374f0ce (diff) | |
wip: hacky file browser
Diffstat (limited to 'lib/nes/app/ui/screen-browser.hh')
| -rw-r--r-- | lib/nes/app/ui/screen-browser.hh | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/nes/app/ui/screen-browser.hh b/lib/nes/app/ui/screen-browser.hh index eb66266..7a711c5 100644 --- a/lib/nes/app/ui/screen-browser.hh +++ b/lib/nes/app/ui/screen-browser.hh @@ -2,6 +2,7 @@ #include "nes/app/ui/screen.hh" #include "nes/app/ui/selection.hh" +#include "nes/app/file-browser.hh" namespace nes::app { @@ -10,21 +11,34 @@ namespace nes::app /// 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> + struct item { + bool is_parent{ false }; + file_browser::item data{ file_browser::item_type::directory, "" }; + }; + + class selection_impl final : public selection<item, 8> + { + file_browser& file_browser_; + public: - using selection::selection; + explicit selection_impl(file_browser& file_browser) + : selection{ 2, 5, 28 } + , file_browser_{ file_browser } + { + } 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; + auto render_item(renderer&, item const&, i32 x, i32 y, u32 width, color) const -> void override; + auto load_page(item(&)[8], u32 page) -> u32 override; }; input_device_keyboard& keyboard_; - selection_impl selection_{ 2, 5, 28 }; + file_browser& file_browser_; + selection_impl selection_; public: - explicit screen_browser(input_device_keyboard&); + explicit screen_browser(input_device_keyboard&, file_browser&); auto render(renderer&) -> void override; auto process_events() -> action override; |
