summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/action.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-02 22:49:01 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-02 22:49:01 +0100
commit0f22ed2ef160eef2da6080782943b22c9539650d (patch)
tree1b43aada2d0183273e79b4d1db7b1e60dd809855 /lib/nes/app/ui/action.hh
parent4fe67b36e3bbe6ea5505ed7233c245be9374f0ce (diff)
wip: hacky file browser
Diffstat (limited to 'lib/nes/app/ui/action.hh')
-rw-r--r--lib/nes/app/ui/action.hh43
1 files changed, 36 insertions, 7 deletions
diff --git a/lib/nes/app/ui/action.hh b/lib/nes/app/ui/action.hh
index 52e5ba6..b701606 100644
--- a/lib/nes/app/ui/action.hh
+++ b/lib/nes/app/ui/action.hh
@@ -1,15 +1,44 @@
#pragma once
+#include <string_view>
+
namespace nes::app
{
/// An action for the application to process after a scene has handled its events.
- enum class action
+ class action
{
- none,
- go_to_title,
- go_to_browser,
- go_to_settings,
- go_to_help,
- launch_game,
+ public:
+ enum class type
+ {
+ none,
+ go_to_title,
+ go_to_browser,
+ go_to_settings,
+ go_to_help,
+ launch_game,
+ };
+
+ private:
+ type type_{ type::none };
+ std::string_view file_name_;
+
+ public:
+ explicit action() = default;
+
+ static auto go_to_title() -> action { return action{ type::go_to_title, "" }; }
+ static auto go_to_browser() -> action { return action{ type::go_to_browser, "" }; }
+ static auto go_to_settings() -> action { return action{ type::go_to_settings, "" }; }
+ static auto go_to_help() -> action { return action{ type::go_to_help, "" }; }
+ static auto launch_game(std::string_view const file_name) -> action { return action{ type::launch_game, file_name }; }
+
+ auto get_type() const -> type { return type_; }
+ auto get_file_name() const -> std::string_view { return file_name_; }
+
+ private:
+ explicit action(type const type, std::string_view const file_name)
+ : type_{ type }
+ , file_name_{ file_name }
+ {
+ }
};
} // namespace nes::app \ No newline at end of file