summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/screen-prompt-key.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-12 23:57:32 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-12 23:57:32 +0100
commitdd22e1ab7ab7b5bac841dae2b62bfa200b36c4d8 (patch)
tree900781940d2ed92df1d87cc7dd6209853492e07f /lib/nes/app/ui/screen-prompt-key.hh
parent0de4957a22dd408793d0526351bcb7d61786fe86 (diff)
add encryption/decryption
Diffstat (limited to 'lib/nes/app/ui/screen-prompt-key.hh')
-rw-r--r--lib/nes/app/ui/screen-prompt-key.hh28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/nes/app/ui/screen-prompt-key.hh b/lib/nes/app/ui/screen-prompt-key.hh
new file mode 100644
index 0000000..337e1b6
--- /dev/null
+++ b/lib/nes/app/ui/screen-prompt-key.hh
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "nes/app/ui/screen.hh"
+#include "nes/common/containers/string-builder.hh"
+#include "nes/common/containers/string-view.hh"
+
+namespace nes::app
+{
+ class input_device_keyboard;
+
+ /// Prompts the user for a decryption key.
+ class screen_prompt_key final : public screen
+ {
+ static constexpr auto max_key_length = u32{ 23 };
+
+ input_device_keyboard& keyboard_;
+ string_view file_name_;
+ string_buffer<max_key_length> key_;
+
+ public:
+ explicit screen_prompt_key(input_device_keyboard&);
+
+ auto reset(string_view file_name) -> void;
+
+ auto render(renderer&) -> void override;
+ auto process_events() -> action override;
+ };
+} // namespace nes::app \ No newline at end of file