Combat UI is alright but need to now make a few common widgets.
This commit is contained in:
parent
cfe56bbf99
commit
7c1f05c801
4 changed files with 16 additions and 8 deletions
|
@ -23,8 +23,8 @@ namespace gui {
|
|||
sf::RectangleShape shape;
|
||||
shape.setPosition({float(cell.x + 3), float(cell.y + 3)});
|
||||
shape.setSize({float(cell.w - 6), float(cell.h - 6)});
|
||||
shape.setFillColor({100, 100, 100});
|
||||
shape.setOutlineColor({200, 200, 200});
|
||||
shape.setFillColor(ColorValue::DARK_MID);
|
||||
shape.setOutlineColor(ColorValue::MID);
|
||||
shape.setOutlineThickness(1);
|
||||
|
||||
if(name.starts_with("button_")) {
|
||||
|
@ -35,7 +35,15 @@ namespace gui {
|
|||
label.setPosition({float(label_cell.x), float(label_cell.y) - label_cell.h / 2});
|
||||
$labels.push_back(label);
|
||||
} else if(name == "bar_hp") {
|
||||
shape.setFillColor({50, 200, 50});
|
||||
shape.setFillColor({150, 30, 30});
|
||||
} else if(name == "label_hp") {
|
||||
sf::Text label($font, "hp:");
|
||||
label.scale({0.8, 0.8});
|
||||
auto bounds = label.getGlobalBounds();
|
||||
auto label_cell = lel::center(bounds.size.x, bounds.size.y, cell);
|
||||
// this stupid / 2 is because SFML renders from baseline rather than from the claimed bounding box
|
||||
label.setPosition({float(label_cell.x), float(label_cell.y + bounds.size.y)});
|
||||
$labels.push_back(label);
|
||||
}
|
||||
|
||||
$shapes.insert_or_assign(name, shape);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue