Now have a nice panel to hold all the UI panels we'll use later.

This commit is contained in:
Zed A. Shaw 2024-11-11 12:23:40 -05:00
parent baaf56d4de
commit 9bc9c9007f
12 changed files with 123 additions and 83 deletions

24
panel.cpp Normal file
View file

@ -0,0 +1,24 @@
#include "panel.hpp"
void Panel::resize(int width, int height) {
$screen = Screen(width, height);
}
void Panel::set_renderer(std::function< Element()> render) {
$component = Renderer(render);
}
Screen &Panel::render() {
if($must_clear) $screen.Clear();
Render($screen, $component->Render());
return $screen;
}
std::wstring Panel::to_string() {
std::string screenout = $screen.ToString();
return $converter.from_bytes(screenout);
}
Screen &Panel::screen() {
return $screen;
}