From 1d5f5482f91391a6dfee9ec0e7cb0a22ee5f0464 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sat, 1 Feb 2025 00:38:55 +0100 Subject: implement screens --- lib/nes/app/ui/screen.hh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lib/nes/app/ui/screen.hh (limited to 'lib/nes/app/ui/screen.hh') diff --git a/lib/nes/app/ui/screen.hh b/lib/nes/app/ui/screen.hh new file mode 100644 index 0000000..07e9d6f --- /dev/null +++ b/lib/nes/app/ui/screen.hh @@ -0,0 +1,31 @@ +#pragma once + +#include "nes/app/ui/action.hh" + +namespace nes::app +{ + class renderer; + + /// A part of the UI which takes care of rendering and handling input events. + /// + /// One screen may be shown at a time. It may be used as an overlay over an active game. + class screen + { + public: + virtual ~screen() = default; + + screen(screen const&) = delete; + screen(screen&&) = delete; + auto operator=(screen const&) -> screen& = delete; + auto operator=(screen&&) -> screen& = delete; + + /// Render a frame with the current UI state. + virtual auto render(renderer&) -> void = 0; + + /// Handle events and return an action for the application to execute. + virtual auto process_events() -> action = 0; + + protected: + explicit screen() = default; + }; +} // namespace nes::app \ No newline at end of file -- cgit v1.3.1