Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sf::Window::setSize does not change window size without sf::Style::Resize flag  (Read 14032 times)

0 Members and 1 Guest are viewing this topic.

thomas9459

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • Email
Do you want another issue besides this one? https://github.com/SFML/SFML/issues/466

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
 ;D Sorry...
Laurent Gomila - SFML developer

Kuxe

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
I found this thread when googling around, it seems I have a related or similar issue on Win8.1 with SFML 2.1.

Inside a class which inherits a RenderWindow (and a QWidget from QT-framework)
//In scope of init-method
sf::RenderWindow::create((HWND)QWidget::winId(), getSettings());
...
//In scope of update-method
sf::RenderWindow::setSize(sf::Vector2u(5, 3));
std::cout<<sf::RenderWindow::getSize().x<<std::endl;
std::cout<<sf::RenderWindow::getSize().y<<std::endl;

This code does not print 5 and 3 as expected, instead it prints whatever size the RenderWindow was initialized with. What's even more strange, to me, is that if I print the width and height of the QWidget, it is 5 and 3!

I'm not sure if this is Qt issue or SFML issue. Seems to me it's an SFML issue when setSize() doesn't make any difference when calling getSize(). Could this be the same issue that OP had?


Edit: Recreated issue with minimum code

#include <SFML\Graphics.hpp>

int main()
{
    sf::RenderWindow renderWindow(sf::VideoMode(200, 200), "Title");

    renderWindow.setSize(sf::Vector2u(1000, 1000));
    while(renderWindow.isOpen())
    {
        sf::Event event;
        while (renderWindow.pollEvent(event))
        {
            // "close requested" event: we close the renderWindow
            if (event.type == sf::Event::Closed)
                renderWindow.close();
        }
    }
    return 0;
}
and I realized it's the window size that setSize changes, not the VideoMode settings.. So nevermind what I wrote before, I misunderstood what setSize actually does. I won't delete the post so someone else that did the same assumption as me could benefit :).

(Although it is somewhat confusing that setSize() sets the size of the window while getSize() returns whatever size renderWindow is!)
« Last Edit: January 03, 2014, 02:46:54 pm by Kuxe »

 

anything