Using this code
#include <iostream>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window ( sf::VideoMode ( 1212, 800 ), "View resize test" );
sf::View view ( sf::Vector2f ( 606, 400 ), sf::Vector2f ( 1212, 800 ) );
window.setView ( view );
sf::Texture tex;
tex.loadFromFile ( "image.png", sf::IntRect ( 92, 343, 1138, 168 ) );
sf::Sprite sprite;
sprite.setTexture ( tex );
while ( window.isOpen() ) {
sf::Event event;
while ( window.pollEvent ( event ) ) {
if ( event.type == sf::Event::Closed ) {
window.close();
} else if ( event.type == sf::Event::Resized ) {
view.setCenter ( event.size.width / 2, event.size.height / 2 );
view.setSize ( event.size.width, event.size.height );
window.setView(view);
std::cout << "New size is: width = " << event.size.width << " height = " << event.size.height << std::endl;
}
}
window.clear();
window.draw ( sprite );
window.display();
}
}
and the attached "image.png", when I press the resize button, the sprite stays exactly the same size as expected, however some parts of it are changed, and this looks very weird in my full project, especially since everything is drawn to line up at the pixel level. I've attached the image used, as well as a screenshot from before, and one from after with red circles identifying some of the weird bits. I am on windows 10 using a version of SFML I build myself last July with CMake and MinGW 5.1.
EDIT: I forgot to say, the console output says that the new width is 1920 and the new height is 1001.