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

Author Topic: Window Position Bug  (Read 1423 times)

0 Members and 1 Guest are viewing this topic.

to2g

  • Newbie
  • *
  • Posts: 2
    • View Profile
Window Position Bug
« on: February 09, 2015, 04:01:43 pm »
I wrote a simple 2d game with collision, all works fine, but when I resize, move game window or make game fullscreen my players and enemies coordinates are changing and this is makes them out of range of my map, only in windows , on linux all worked fine

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Window Position Bug
« Reply #1 on: February 09, 2015, 04:22:07 pm »
this is really a bug?
may be you need to handle the resize event?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Window Position Bug
« Reply #2 on: February 09, 2015, 04:23:32 pm »
You're not providing any significant information.

Since it's like to be a problem in your code, you shloud provide a minimal and compilable example.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Window Position Bug
« Reply #3 on: February 09, 2015, 04:39:26 pm »
When you resize the window, by default the contents are stretched to map the new size. Which means that the default view no longer maps to the window size, and that you must call the mapPixelToCoord / mapCoordToPixel functions whenever you need interaction between the scene and the window (mouse).

Since you give no detail about what you do on resize, how your collisions work, and what exactly happens when the problem occurs, there's nothing more we can say.
Laurent Gomila - SFML developer

to2g

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Window Position Bug
« Reply #4 on: February 09, 2015, 04:44:59 pm »
//
« Last Edit: February 15, 2015, 05:23:02 pm by to2g »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Window Position Bug
« Reply #5 on: February 09, 2015, 10:22:13 pm »
It's neither minimal nor compilable.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything