|
|
@ -13,7 +13,7 @@ namespace guecs { |
|
|
|
if(text == nullptr) text = make_shared<sf::Text>(*font, content, size); |
|
|
|
if(text == nullptr) text = make_shared<sf::Text>(*font, content, size); |
|
|
|
text->setFillColor(color); |
|
|
|
text->setFillColor(color); |
|
|
|
|
|
|
|
|
|
|
|
if(centered) { |
|
|
|
if(centered || cell.center) { |
|
|
|
auto bounds = text->getLocalBounds(); |
|
|
|
auto bounds = text->getLocalBounds(); |
|
|
|
auto text_cell = lel::center(bounds.size.x, bounds.size.y, cell); |
|
|
|
auto text_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
|
|
|
|
// this stupid / 2 is because SFML renders from baseline rather than from the claimed bounding box
|
|
|
@ -57,6 +57,7 @@ namespace guecs { |
|
|
|
|
|
|
|
|
|
|
|
sf::IntRect rect{{0,0}, bounds}; |
|
|
|
sf::IntRect rect{{0,0}, bounds}; |
|
|
|
sprite = make_shared<sf::Sprite>(*sprite_texture.texture, rect); |
|
|
|
sprite = make_shared<sf::Sprite>(*sprite_texture.texture, rect); |
|
|
|
|
|
|
|
fmt::println("SPRITE centered: {}", cell.center); |
|
|
|
|
|
|
|
|
|
|
|
sprite->setPosition({float(cell.x + padding), float(cell.y + padding)}); |
|
|
|
sprite->setPosition({float(cell.x + padding), float(cell.y + padding)}); |
|
|
|
|
|
|
|
|
|
|
|