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

Author Topic: Textures displayed before get deleted or removed when display is done again  (Read 1456 times)

0 Members and 1 Guest are viewing this topic.

xavator4

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hi,

First of all, this is my first time working with SFML or any API in general, so please, bear with me!

Anyways, here is my question. I am building a board game using SFML. The board itself is loaded as a .jpg texture and displayed in the start. However, since it's a board game, there are 'pieces' that represent players. Everytime a move is made, that piece has to be moved accordingly. However, to do this, I have to call the sf::RenderWindow::display() method again. (Ik this is a non static member, just writing it like this to clear stuff out).

The problem is that first, I call the display() method to initially print the board and the 'pieces', however, when a move is made, those pieces have to move and when I move them, the board disappears leaving behind pieces. I understand that this is because sf::RenderWindow::display() has been called again but what is the workaround for me in this case? Your help will greatly be appreciated!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
You must draw everything every time. Not only stuff that moves when it moves.

Have a look at the documentation, tutorials and code examples.
Laurent Gomila - SFML developer