SFML community forums
Help => General => Topic started by: ingwik on November 23, 2011, 09:01:50 am
-
Environment: win 7Enterprise 64 bit, SFML 1.6, VC++ 2010 express
I have problems with the sf:Renderwindow in animations. The problem is that when I put an animation sequence inside a function and call the renderwindow inside the function, the animationframes are stacked on top of each other. To circumvent that I can call renderwindow.clear() between each frame, but that will disrupt the game que and delete everything in the game while the animation runs.
The code for the animation I created can be found here:
http://www.sfml-dev.org/forum/viewtopic.php?t=6282
Is there a solution to how you can make an animation inside a function and run it without halting the game completely while the animation run? Since I see animations of explosions in other games that don't disrupt the game I know there must be a solution even though I can't figure it out myself.
-
This is not a bug in SFML, you just haven't coded it right. On each frame you should clear the window and redraw everything. You shouldn't just play an animation in a separate function, instead at each frame, update each animation as you see fit, then draw everything again in its current state.
Try Nexus's Thor library, it has a nice animation class.