1
Window / Re: [BUG] [Linux] Calling Window.setSize() while resizing makes the window grow
« on: June 13, 2024, 08:08:28 pm »
Sorry for bringing up an old topic, but I am having this exact same issue with Ubuntu 24.04, g++14. Here is a link to a video showing the issue: https://drive.google.com/file/d/12NNll-IviG9l_DNPJ6k5ZhanWEakC7MS/view?usp=sharing.
My resize handling code is equivalent to:
Edit: Using SFML 2.6.1
My resize handling code is equivalent to:
if( event.type == sf::Event::Resized )
{
Vector2u size { std::max( event.size.width, MinWindowWidth ), std::max( event.size.height, MinWindowHeight ) };
if( size.x != event.size.width || size.y != event.size.height )
{
m_window->setSize( size );
continue;
}
sf::View view = m_window->getView();
Vector2f tl = view.getCenter() - ( view.getSize() * 0.5f );
view.setSize( Vector2f( static_cast<float>( event.size.width ), static_cast<float>( event.size.height ) ) );
view.setCenter( tl + Vector2f( view.getSize() * 0.5f ) );
view.setViewport( { { 0.f, 0.f }, { 1.f, 1.f } } );
m_window->setView( view );
}
{
Vector2u size { std::max( event.size.width, MinWindowWidth ), std::max( event.size.height, MinWindowHeight ) };
if( size.x != event.size.width || size.y != event.size.height )
{
m_window->setSize( size );
continue;
}
sf::View view = m_window->getView();
Vector2f tl = view.getCenter() - ( view.getSize() * 0.5f );
view.setSize( Vector2f( static_cast<float>( event.size.width ), static_cast<float>( event.size.height ) ) );
view.setCenter( tl + Vector2f( view.getSize() * 0.5f ) );
view.setViewport( { { 0.f, 0.f }, { 1.f, 1.f } } );
m_window->setView( view );
}
Edit: Using SFML 2.6.1