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

Author Topic: renderwindow.getPosition() return different value  (Read 2185 times)

0 Members and 1 Guest are viewing this topic.

shotoreaper

  • Newbie
  • *
  • Posts: 11
    • View Profile
renderwindow.getPosition() return different value
« 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);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: renderwindow.getPosition() return different value
« Reply #1 on: October 03, 2013, 10:13:50 pm »
Does a small delay between setPosition and getPosition changes anything? What's your OS?
Laurent Gomila - SFML developer

shotoreaper

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: renderwindow.getPosition() return different value
« Reply #2 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: renderwindow.getPosition() return different value
« Reply #3 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;
Laurent Gomila - SFML developer

shotoreaper

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: renderwindow.getPosition() return different value
« Reply #4 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: renderwindow.getPosition() return different value
« Reply #5 on: October 04, 2013, 03:44:11 pm »
Quote
I get other values with window.getPosition().x yet
What kind of values?
Laurent Gomila - SFML developer

shotoreaper

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: renderwindow.getPosition() return different value
« Reply #6 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: renderwindow.getPosition() return different value
« Reply #7 on: October 05, 2013, 07:29:08 pm »
Ah, great :)
Laurent Gomila - SFML developer