Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I know many people in this site may not know esenthel engine at all and my question may be better answered at engine forum but I'm putting it here to share the name of a real easy to code gameengine with all of you:

you can easily add a Button for example to your GUI class (gui is it's shared instance) with Gui += buttonInstance.create("click on me") but I'm just wondering how can you remove an on object from from Gui members.

as far as I know there is no such a method as removeChild or getChildren or anything similar.

share|improve this question
    
And before/after you downvote I really recommend you take a look at this engine! It's the most easy to prototype engine I've ever seen! and it's free to evaluate. –  Ali.S Jun 25 '11 at 20:35
    
Have you checked the docs? –  The Communist Duck Jun 25 '11 at 20:54
    
not recently, I was working with this engine around 9 months ago and that time I just skiped removing object from GUI, just made them invisible I can do the same thing again, but i'm just looking for some better replacement to that. –  Ali.S Jun 25 '11 at 21:38
6  
Then check the docs. –  The Communist Duck Jun 26 '11 at 9:27

1 Answer 1

up vote 1 down vote accepted

Well, seeing as you use the += operator to add a button, perhaps you use the -= operator to remove one? So something like the following pseudocode:

mybutton = buttonInstance.create("click on me")
Gui += mybutton
// when it comes time to remove the button...
Gui -= mybutton

I'm just speculating here, but I would be surprised to find otherwise, because it would strike me as inconsistent for + to add but - not to remove.


According to Gajet in the comments, Gui.desktop()->removeChild(mybutton) is the proper code to remove a GUI element.

share|improve this answer
    
no there is no -= opreator implemented but when i looked for that operator I saw there was the implementatoin on += there. I'm not sure if it's correct but it's how i'm managing to remove objects from Gui Gui.desktop()->removeChild(myButton). I guess technicaly you have to get my accept (since your answer gave me the idea to have deep look into header file) but you need to edit your answer before first! –  Ali.S Jun 25 '11 at 22:16
    
I'm glad you found it! Now file a bug report and ask for the -= operator to be implemented. :) –  Ricket Jun 26 '11 at 12:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.