SFML community forums
Help => Graphics => Topic started by: BlazeCrate on May 19, 2014, 06:24:53 pm
-
Hello,
I am trying to add bullets into my space ship game. I got them working and shooting the way that I want. The bullets are working fine (with a need for a bit of fine tuning).
But when I close the game the console window gives me the error attached.
-
Taking a wild guess here: you have some global variables/objects (includes singletons) in your code?
If I'm right, then "don't do that". If I'm wrong then just ignore me ;)
-
Another guess: you call draw() after closing the window. Make sure you return immediately as soon as the window is closed, so that you don't render anymore.
Next time, please ask a clear question (http://en.sfml-dev.org/forums/index.php?topic=5559.0).
-
Sorry forgot to link my code: https://github.com/Ancell/Tractus
-
Sorry forgot to link my code: https://github.com/Ancell/Tractus
No one wants to browse your whole repository, that's why there's a rule concerning minimal complete examples (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368). Please read it carefully for future questions.
-
Well I solved the problem of not getting that output. I used your advice about exiting right after I close the window. I just added return EXIT_SUCCESS; right before window.close(); in my main class.
Thanks for the help!
P.s. I will read the rules of posting for future questions.
-
... I just added return EXIT_SUCCESS; right before window.close(); in my main class. ...
I'd say that right after would probably be closer to what you really want ;)
-
close() is not really necessary. If the window goes out of scope, the destructor will close it automatically.
So I'd write only a return statement.
-
My point (that I didn't make very well) was that putting the return before close() is pointless since close() just becomes dead code.
Either close() and then return or, as you say, just return.