|
|
@ -33,10 +33,10 @@ int GUI::main_loop(GameEngine &game, std::function<bool()> runner) { |
|
|
|
|
|
|
|
|
|
|
|
auto status = Renderer([&] { |
|
|
|
auto status = Renderer([&] { |
|
|
|
return vbox({ |
|
|
|
return vbox({ |
|
|
|
paragraph(fmt::format("HP {}", game.hit_points)), |
|
|
|
text(fmt::format("HP {}", game.hit_points)), |
|
|
|
separator(), |
|
|
|
separator(), |
|
|
|
hbox({ |
|
|
|
hbox({ |
|
|
|
text("HP"), |
|
|
|
text("HP "), |
|
|
|
gauge(game.hit_points / 100.0f), |
|
|
|
gauge(game.hit_points / 100.0f), |
|
|
|
}), |
|
|
|
}), |
|
|
|
}); |
|
|
|
}); |
|
|
@ -52,20 +52,33 @@ int GUI::main_loop(GameEngine &game, std::function<bool()> runner) { |
|
|
|
return vbox(output); |
|
|
|
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] { |
|
|
|
[&, content] { |
|
|
|
return content->Render() |
|
|
|
return content->Render() |
|
|
|
| focusPositionRelative(scroll_x, scroll_y) |
|
|
|
| focusPositionRelative(scroll_x, scroll_y) |
|
|
|
| frame | flex; |
|
|
|
| frame | flex; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
auto component = Renderer(scrollable_content, [&] { |
|
|
|
auto component = Renderer(build_log, [&] { |
|
|
|
return vbox({ |
|
|
|
return vbox({ |
|
|
|
status->Render(), |
|
|
|
game_stuff->Render() | flex, |
|
|
|
|
|
|
|
separator(), |
|
|
|
|
|
|
|
build_log->Render() | vscroll_indicator | yframe | flex, |
|
|
|
separator(), |
|
|
|
separator(), |
|
|
|
scrollable_content->Render() | vscroll_indicator | yframe | size(HEIGHT, LESS_THAN, 20), |
|
|
|
status->Render() |
|
|
|
}) | |
|
|
|
}) | border; |
|
|
|
border; |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
component |= CatchEvent([&](Event) -> bool { |
|
|
|
component |= CatchEvent([&](Event) -> bool { |
|
|
|