You now have blood on your screen when below half health.

This commit is contained in:
Zed A. Shaw 2025-02-13 13:15:20 -05:00
parent 1c8f542c21
commit d2700d2928
12 changed files with 90 additions and 13 deletions

View file

@ -25,10 +25,7 @@ namespace gui {
const auto& player_combat = $level.world->get<Combat>(player.entity);
const auto& combat = $level.world->get<Combat>(player.entity);
std::vector<Element> log_list;
log_list.push_back(text("Log messages here."));
auto log_box = vbox(log_list) | yflex_grow;
auto log_box = vbox($log_list) | yflex_grow | border;
return hbox({
hflow(
@ -45,4 +42,16 @@ namespace gui {
set_renderer(status_rend);
}
void StatusUI::log(std::string msg) {
$messages.push_front(msg);
if($messages.size() > MAX_LOG_MESSAGES) {
$messages.pop_back();
}
$log_list.clear();
for(auto msg : $messages) {
$log_list.push_back(text(msg));
}
}
}