SFML community forums

Help => General => Topic started by: Gus Gus on March 21, 2016, 04:29:31 pm

Title: Destroy all objects in the render window.
Post by: Gus Gus on March 21, 2016, 04:29:31 pm
Hello everyone,
I'm working on a very small project on SFML, where I spawn square shapes in the render window using left mouse button. However, I have been trying for days to find a way to assign the R button for basically erase or destroy every object on the render window and start again. basically a restart button , without being forced to close the render window.

I appreciate your help:).
Title: Re: Destroy all objects in the render window.
Post by: Jesper Juhl on March 21, 2016, 05:52:02 pm
Wouldn't that be as simple as; 0. Detect a RMB down event.  1. clear() the screen (which you should be doing every frame anyway).  2. Clear the container holding the objects you draw every frame.
??
Title: Re: Destroy all objects in the render window.
Post by: Hapax on March 21, 2016, 11:50:48 pm
[instruction list starting with zero]
You've been coding too long ;)
Title: Re: Destroy all objects in the render window.
Post by: DarkRoku12 on March 22, 2016, 02:48:56 am
[instruction list starting with zero]
You've been coding too long ;)

This is a problem if you are a Lua programmer.  ::)
..Just saying.