SFML community forums

Help => Graphics => Topic started by: PvPineapple on November 26, 2019, 09:25:12 pm

Title: Updating a Specific Sprite or View
Post by: PvPineapple on November 26, 2019, 09:25:12 pm
I have a large map that's procedural generated and places several 30x30px tiles.  This generation is in a specific view called mapView.  I have another view for the players called playerView.  First, is it possible to just combine these views and only redraw the player sprite as it moves.  If not, is it possible to just update playerView with window.display()?  It appears to be redrawing mapView each frame, making it run really slow and jagged.  I tried setting window.setView(playerView), but this still updates both views.
Title: Re: Updating a Specific Sprite or View
Post by: eXpl0it3r on November 26, 2019, 11:45:48 pm
For large maps, especially if they're changing rarely, you may want to use a render texture and draw the map to it whenever something changes. That way you won't be updating the map as often.