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

Author Topic: Blinking screen when using massive view.move ?  (Read 7691 times)

0 Members and 3 Guests are viewing this topic.

bisthebis

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Blinking screen when using massive view.move ?
« Reply #15 on: August 13, 2015, 09:36:43 am »
In fact I have no idea of how to educe it more...

Geheim

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Email
Re: Blinking screen when using massive view.move ?
« Reply #16 on: August 13, 2015, 11:35:09 am »
Despite the code being far from minimal, it is also incomplete. In BackgroundTileMap::WriteToFile you forgot the return statement and tileset_castle.png is missing.

However I took a quick look and could find the problem for your blinking:
Line 133 in main.cpp -> wheelPos = window.mapPixelToCoords(sf::Mouse::getPosition(window));

That should be removed, because you should only set the reference position once you press the middle mouse button, otherwise the program uses the destination position as the new reference position, going back and forth everytime you move, which results in your blinking.

You also have a ton of C type casts, even on things that are already the desired type (like in line 131, main.cpp). Use static_cast instead where needed. I am not here to judge the code, but that was an eye catcher.
Failing to succeed does not mean failing to progress!

bisthebis

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Blinking screen when using massive view.move ?
« Reply #17 on: August 13, 2015, 12:20:26 pm »
That was this, thanks :)
The next time I'll try do provide a real minimal+functional code  :D
And I'll look into static_cast for the future !