summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/screen-browser.hh
blob: eb662661eb1be00d56bf58576e0b24928f13bd1d (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
29
30
31
32
#pragma once

#include "nes/app/ui/screen.hh"
#include "nes/app/ui/selection.hh"

namespace nes::app
{
	class input_device_keyboard;

	/// An interface which allows the user to browse the filesystem for a game.
	class screen_browser final : public screen
	{
		class selection_impl final : public selection<i32, 5>
		{
		public:
			using selection::selection;

		protected:
			auto render_item(renderer&, i32 const&, i32 x, i32 y, u32 width, color) const -> void override;
			auto load_page(i32(&)[5], u32 page) -> u32 override;
		};

		input_device_keyboard& keyboard_;
		selection_impl selection_{ 2, 5, 28 };

	public:
		explicit screen_browser(input_device_keyboard&);

		auto render(renderer&) -> void override;
		auto process_events() -> action override;
	};
} // namespace nes::app