Quickly pulled out some of the magic numbers but this isn't the ideal way to configure this stuff.
This commit is contained in:
parent
e04c03b381
commit
f2b7871d12
3 changed files with 25 additions and 12 deletions
10
guecs.cpp
10
guecs.cpp
|
@ -1,5 +1,4 @@
|
|||
#include "guecs.hpp"
|
||||
#include "constants.hpp"
|
||||
|
||||
namespace guecs {
|
||||
UI::UI() {
|
||||
|
@ -55,9 +54,14 @@ namespace guecs {
|
|||
auto sprite_texture = textures.get(sprite.name);
|
||||
sprite.texture = sprite_texture.texture;
|
||||
sprite.sprite = make_shared<sf::Sprite>(*sprite.texture);
|
||||
sprite.sprite->setPosition({float(cell.x + 5), float(cell.y + 5)});
|
||||
sprite.sprite->setPosition({
|
||||
float(cell.x + GUECS_PADDING),
|
||||
float(cell.y + GUECS_PADDING)});
|
||||
|
||||
auto size = sprite.texture->getSize();
|
||||
sprite.sprite->setScale({float(cell.w - 10) / size.x, float(cell.h - 10) / size.y});
|
||||
sprite.sprite->setScale({
|
||||
float(cell.w - GUECS_PADDING * 2) / size.x,
|
||||
float(cell.h - GUECS_PADDING * 2) / size.y});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue