1
Graphics / Maintaining background image through window.clear()
« on: June 19, 2013, 02:22:58 am »
I'm very new to SFML, so this question will probably be a bit basic
I'm trying to do some basic animation, so i've created a sprite and everytime i click my mouse, the window will clear the screen with black and redraw the sprite at my mouse position (as far as i know, this is usually how you animate things?)
But the problem comes when i try to use a background image; the window.clear() function only allows me to clear with an RGB color, so upon clearing, the background image gets cleared as well.
I've thought about fixing this by simply loading the background right after clearing, but does SFML have a way to make certain images persist after the frame is cleared?
I'm trying to do some basic animation, so i've created a sprite and everytime i click my mouse, the window will clear the screen with black and redraw the sprite at my mouse position (as far as i know, this is usually how you animate things?)
But the problem comes when i try to use a background image; the window.clear() function only allows me to clear with an RGB color, so upon clearing, the background image gets cleared as well.
I've thought about fixing this by simply loading the background right after clearing, but does SFML have a way to make certain images persist after the frame is cleared?