SFML community forums

Help => Graphics => Topic started by: shotoreaper on October 03, 2013, 09:16:52 pm

Title: renderwindow.getPosition() return different value
Post by: shotoreaper on October 03, 2013, 09:16:52 pm
Hi!
If I get the position of window with window.getPosition() method, I received a different value that sometimes changes it;

    window.create(sf::VideoMode(windowSize.x, windowSize.y, colordepth), windowTitle, (fullscreen ? sf::Style::Fullscreen : sf::Style::Resize|sf::Style::Close));


    window.setPosition(sf::Vector2i(50,50));
    std::cout<<window.getPosition().x<<std::endl; // return sometimes 10, other 640


    handle = window.getSystemHandle();

    window.setFramerateLimit(framerate);
Title: Re: renderwindow.getPosition() return different value
Post by: Laurent on October 03, 2013, 10:13:50 pm
Does a small delay between setPosition and getPosition changes anything? What's your OS?
Title: Re: renderwindow.getPosition() return different value
Post by: shotoreaper on October 04, 2013, 09:41:03 am
No, there is no delay to change the values. It return different values, but the window remains in the correct position I specify
My OS is Linux Fedora 19.
Title: Re: renderwindow.getPosition() return different value
Post by: Laurent on October 04, 2013, 09:56:53 am
Quote
No, there is no delay to change the values.
Just to make sure that you understood me, I meant this:
window.setPosition(sf::Vector2i(50,50));
sf::sleep(sf::seconds(1));
std::cout<<window.getPosition().x<<std::endl;
Title: Re: renderwindow.getPosition() return different value
Post by: shotoreaper on October 04, 2013, 03:12:19 pm
Aaaaa ok, sorry. at any rate, it doesn't work. I get other values with window.getPosition().x yet.
Title: Re: renderwindow.getPosition() return different value
Post by: Laurent on October 04, 2013, 03:44:11 pm
Quote
I get other values with window.getPosition().x yet
What kind of values?
Title: Re: renderwindow.getPosition() return different value
Post by: shotoreaper on October 05, 2013, 01:14:57 pm
window.getPosition().x returns the value '10'. At any case, I resolved the problem change from SFML 2.0 to SFML 2.1
Title: Re: renderwindow.getPosition() return different value
Post by: Laurent on October 05, 2013, 07:29:08 pm
Ah, great :)