Fixed how sprites/textures are loaded so tehy default to frame 0 of any multi-frame textures.
This commit is contained in:
parent
6d73c87c4e
commit
b832bbd78a
7 changed files with 294 additions and 70 deletions
|
@ -28,14 +28,16 @@ namespace guecs {
|
|||
|
||||
void Sprite::init(lel::Cell &cell) {
|
||||
auto sprite_texture = textures::get(name);
|
||||
texture = sprite_texture.texture;
|
||||
sprite = make_shared<sf::Sprite>(*texture);
|
||||
|
||||
sprite = make_shared<sf::Sprite>(
|
||||
*sprite_texture.texture,
|
||||
sprite_texture.sprite->getTextureRect());
|
||||
|
||||
sprite->setPosition({
|
||||
float(cell.x + padding),
|
||||
float(cell.y + padding)});
|
||||
|
||||
auto bounds = sprite->getGlobalBounds();
|
||||
auto bounds = sprite->getLocalBounds();
|
||||
|
||||
sprite->setScale({
|
||||
float(cell.w - padding * 2) / bounds.size.x,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue