SFML community forums

Help => Graphics => Topic started by: xavator4 on May 21, 2020, 05:59:00 am

Title: Textures displayed before get deleted or removed when display is done again
Post by: xavator4 on May 21, 2020, 05:59:00 am
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!
Title: Re: Textures displayed before get deleted or removed when display is done again
Post by: Laurent on May 21, 2020, 09:01:23 am
You must draw everything every time. Not only stuff that moves when it moves.

Have a look at the documentation, tutorials and code examples.