Fixed render issue with UIGrid / PyTexture: wasn't positioning or scaling properly after fetching sprite

This commit is contained in:
John McCardle 2024-03-17 16:29:33 -04:00
parent 20f80c4114
commit 84a8886da2
1 changed files with 3 additions and 3 deletions

View File

@ -387,7 +387,7 @@ void UIGrid::render(sf::Vector2f)
int left_spritepixels = center_x - (box.getSize().x / 2.0 / zoom);
int top_spritepixels = center_y - (box.getSize().y / 2.0 / zoom);
sprite.setScale(sf::Vector2f(zoom, zoom));
//sprite.setScale(sf::Vector2f(zoom, zoom));
sf::RectangleShape r; // for colors and overlays
r.setSize(sf::Vector2f(ptex->sprite_width * zoom, ptex->sprite_height * zoom));
r.setOutlineThickness(0);
@ -414,7 +414,7 @@ void UIGrid::render(sf::Vector2f)
auto gridpoint = at(std::floor(x), std::floor(y));
sprite.setPosition(pixel_pos);
//sprite.setPosition(pixel_pos);
r.setPosition(pixel_pos);
r.setFillColor(gridpoint.color);
@ -424,7 +424,7 @@ void UIGrid::render(sf::Vector2f)
// if discovered but not visible, set opacity to 90%
// if not discovered... just don't draw it?
if (gridpoint.tilesprite != -1) {
sprite = ptex->sprite(gridpoint.tilesprite); //setSprite(gridpoint.tilesprite);
sprite = ptex->sprite(gridpoint.tilesprite, pixel_pos, sf::Vector2f(zoom, zoom)); //setSprite(gridpoint.tilesprite);;
renderTexture.draw(sprite);
}
}