Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Destroy all objects in the render window.  (Read 1668 times)

0 Members and 2 Guests are viewing this topic.

Gus Gus

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Destroy all objects in the render window.
« 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:).
« Last Edit: March 21, 2016, 04:57:37 pm by Gus Gus »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Destroy all objects in the render window.
« Reply #1 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.
??

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Destroy all objects in the render window.
« Reply #2 on: March 21, 2016, 11:50:48 pm »
[instruction list starting with zero]
You've been coding too long ;)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

DarkRoku12

  • Full Member
  • ***
  • Posts: 203
  • Lua coder.
    • View Profile
    • Email
Re: Destroy all objects in the render window.
« Reply #3 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.
I would like a spanish/latin community...
Problems building for Android? Look here

 

anything