|
|
|
@ -33,7 +33,7 @@ int GUI::main_loop(GameEngine &game, std::function<bool()> runner) { |
|
|
|
|
|
|
|
|
|
auto status = Renderer([&] { |
|
|
|
|
return vbox({ |
|
|
|
|
paragraph(fmt::format("HP {}", game.hit_points)), |
|
|
|
|
text(fmt::format("HP {}", game.hit_points)), |
|
|
|
|
separator(), |
|
|
|
|
hbox({ |
|
|
|
|
text("HP "), |
|
|
|
@ -52,20 +52,33 @@ int GUI::main_loop(GameEngine &game, std::function<bool()> runner) { |
|
|
|
|
return vbox(output); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
auto scrollable_content = Renderer(content, |
|
|
|
|
auto game_stuff = Renderer([&] { |
|
|
|
|
return vbox({ |
|
|
|
|
text("Welcome to...Turing's Tarpit!"), |
|
|
|
|
separator(), |
|
|
|
|
hbox({ |
|
|
|
|
text("left") | border | flex , |
|
|
|
|
text("middle") | border | flex, |
|
|
|
|
text("right") | border | flex, |
|
|
|
|
}) | yflex_grow |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
auto build_log = Renderer(content, |
|
|
|
|
[&, content] { |
|
|
|
|
return content->Render() |
|
|
|
|
| focusPositionRelative(scroll_x, scroll_y) |
|
|
|
|
| frame | flex; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
auto component = Renderer(scrollable_content, [&] { |
|
|
|
|
auto component = Renderer(build_log, [&] { |
|
|
|
|
return vbox({ |
|
|
|
|
status->Render(), |
|
|
|
|
game_stuff->Render() | flex, |
|
|
|
|
separator(), |
|
|
|
|
build_log->Render() | vscroll_indicator | yframe | flex, |
|
|
|
|
separator(), |
|
|
|
|
scrollable_content->Render() | vscroll_indicator | yframe | size(HEIGHT, LESS_THAN, 20), |
|
|
|
|
}) | |
|
|
|
|
border; |
|
|
|
|
status->Render() |
|
|
|
|
}) | border; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
component |= CatchEvent([&](Event) -> bool { |
|
|
|
|