diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-02 20:59:36 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-02 20:59:36 +0100 |
| commit | 4fe67b36e3bbe6ea5505ed7233c245be9374f0ce (patch) | |
| tree | f5cfe88f252ee2e9830162a1673441a704e6ea37 /lib/nes/app/ui/screen-title.hh | |
| parent | 8062afc25e895cb49e76f6e26e51a7d4a1ad2df2 (diff) | |
refactor selection
Diffstat (limited to 'lib/nes/app/ui/screen-title.hh')
| -rw-r--r-- | lib/nes/app/ui/screen-title.hh | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/nes/app/ui/screen-title.hh b/lib/nes/app/ui/screen-title.hh index 2ebc78a..6384c3e 100644 --- a/lib/nes/app/ui/screen-title.hh +++ b/lib/nes/app/ui/screen-title.hh @@ -1,10 +1,11 @@ #pragma once #include "nes/app/ui/screen.hh" +#include "nes/app/ui/selection.hh" namespace nes::app { - class input_manager; + class input_device_keyboard; /// The main title screen for the emulator, used as an entrypoint for the UI. /// @@ -18,11 +19,21 @@ namespace nes::app help, }; - input_manager& input_manager_; - item selected_item_{ item::load_game }; + class selection_impl final : public selection<item, 3> + { + public: + using selection::selection; + + protected: + auto render_item(renderer&, item const&, i32 x, i32 y, u32 width, color) const -> void override; + auto load_page(item(&)[3], u32 page) -> u32 override; + }; + + input_device_keyboard& keyboard_; + selection_impl selection_{ 10, 16, 11 }; public: - explicit screen_title(input_manager&); + explicit screen_title(input_device_keyboard&); auto render(renderer&) -> void override; auto process_events() -> action override; |
