summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/screen-prompt-key.hh
blob: 337e1b6327a9c556785aba759dc1d2114506bd3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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