Fixed render issue with UIGrid / PyTexture: wasn't positioning or scaling properly after fetching sprite
This commit is contained in:
parent
20f80c4114
commit
84a8886da2
|
@ -387,7 +387,7 @@ void UIGrid::render(sf::Vector2f)
|
||||||
int left_spritepixels = center_x - (box.getSize().x / 2.0 / zoom);
|
int left_spritepixels = center_x - (box.getSize().x / 2.0 / zoom);
|
||||||
int top_spritepixels = center_y - (box.getSize().y / 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
|
sf::RectangleShape r; // for colors and overlays
|
||||||
r.setSize(sf::Vector2f(ptex->sprite_width * zoom, ptex->sprite_height * zoom));
|
r.setSize(sf::Vector2f(ptex->sprite_width * zoom, ptex->sprite_height * zoom));
|
||||||
r.setOutlineThickness(0);
|
r.setOutlineThickness(0);
|
||||||
|
@ -414,7 +414,7 @@ void UIGrid::render(sf::Vector2f)
|
||||||
|
|
||||||
auto gridpoint = at(std::floor(x), std::floor(y));
|
auto gridpoint = at(std::floor(x), std::floor(y));
|
||||||
|
|
||||||
sprite.setPosition(pixel_pos);
|
//sprite.setPosition(pixel_pos);
|
||||||
|
|
||||||
r.setPosition(pixel_pos);
|
r.setPosition(pixel_pos);
|
||||||
r.setFillColor(gridpoint.color);
|
r.setFillColor(gridpoint.color);
|
||||||
|
@ -424,7 +424,7 @@ void UIGrid::render(sf::Vector2f)
|
||||||
// if discovered but not visible, set opacity to 90%
|
// if discovered but not visible, set opacity to 90%
|
||||||
// if not discovered... just don't draw it?
|
// if not discovered... just don't draw it?
|
||||||
if (gridpoint.tilesprite != -1) {
|
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);
|
renderTexture.draw(sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue