I do not know if this is a bug with SFML or not, but the sf::Window::setSize function does not resize the window if the sf::Style::Resize flag is not passed to sf::Window::Create, as shown below.
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
int main()
{
// Create the window
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML works!", sf::Style::Titlebar | sf::Style::Close /*| sf::Style::Resize*/);
window.setSize(sf::Vector2u(320,240));
// Create a simple shape
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
shape.setPosition(400, 240);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(shape);
window.display();
}
return 0;
}
If sf::Style::Resize is uncommented, the window will resize just fine. Is this expected behaviour? If it is, how would you allow the window to be resizeable, but not allow the user to resize it directly (by dragging the corner of the window)?