From 4fe67b36e3bbe6ea5505ed7233c245be9374f0ce Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sun, 2 Feb 2025 20:59:36 +0100 Subject: refactor selection --- lib/nes/app/ui/screen-title.hh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'lib/nes/app/ui/screen-title.hh') 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 + { + 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; -- cgit v1.3.1