The next little game in the series where I make a fancy rogue game.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "panel.hpp"
|
|
|
|
|
|
|
|
void Panel::resize(int width, int height) {
|
|
|
|
$dirty = true;
|
|
|
|
// $screen = ScreenInteractive::FixedSize(width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Panel::set_renderer(std::function< Element()> render) {
|
|
|
|
$dirty = true;
|
|
|
|
$component = Renderer(render);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Panel::render() {
|
|
|
|
$dirty = true;
|
|
|
|
if($must_clear) $screen.Clear();
|
|
|
|
Render($screen, $component->Render());
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::wstring& Panel::to_string() {
|
|
|
|
if($dirty) {
|
|
|
|
std::string as_text = $screen.ToString();
|
|
|
|
$screenout = $converter.from_bytes(as_text);
|
|
|
|
$dirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $screenout;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Screen &Panel::screen() {
|
|
|
|
return $screen;
|
|
|
|
}
|