diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 18:24:59 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 18:24:59 +0100 |
| commit | d060e3a50c987d10799ccc739bdbf9d7d7a13c10 (patch) | |
| tree | 4b5585383ada85608b57bcf76e5828817962fddf /lib/nes/app/ui/screen-settings.hh | |
| parent | dbed1c0fa5599b1b96c221b89b10f1e350351645 (diff) | |
implement settings
Diffstat (limited to 'lib/nes/app/ui/screen-settings.hh')
| -rw-r--r-- | lib/nes/app/ui/screen-settings.hh | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/lib/nes/app/ui/screen-settings.hh b/lib/nes/app/ui/screen-settings.hh index 8f510ca..8910c5c 100644 --- a/lib/nes/app/ui/screen-settings.hh +++ b/lib/nes/app/ui/screen-settings.hh @@ -1,16 +1,51 @@ -// -// Created by Hannes Schulze on 06.02.25. -// +#pragma once -#ifndef SCREEN_SETTINGS_HH -#define SCREEN_SETTINGS_HH +#include "nes/app/ui/screen.hh" +#include "nes/app/ui/selection.hh" +namespace nes::app +{ + class input_manager; + class preferences; + /// Screen used to configure various emulator options. + class screen_settings final : public screen + { + static constexpr auto page_size = u32{ 8 }; -class screen_settings { + enum class item + { + controller_1, + controller_2, + fps_counter, + }; -}; + class selection_impl final : public selection<item, page_size> + { + input_manager& input_manager_; + preferences& preferences_; + public: + explicit selection_impl(input_manager& input_manager, preferences& preferences) + : selection{ 2, 5, 28 } + , input_manager_{ input_manager } + , preferences_{ preferences } + { + } + protected: + auto render_item(renderer&, item const&, i32 x, i32 y, u32 width, color) const -> void override; + auto load_page(item(&)[page_size], u32 page) -> u32 override; + }; -#endif //SCREEN_SETTINGS_HH + input_manager& input_manager_; + preferences& preferences_; + selection_impl selection_; + + public: + explicit screen_settings(input_manager&, preferences&); + + auto render(renderer&) -> void override; + auto process_events() -> action override; + }; +} // namespace nes::app
\ No newline at end of file |
