My "engine" is not using parts of your code, so I must implement my own fix hahah
I took a look at your code just to see how are you handling the events
So, this is a RAII problem
This does sometimes, somehow work
That´s weird
The bug in my code had the same behavior
Why would the event queue be broken?
... trying to poll a new event from the event queue things blow up (sometimes), mostly because the locally declared sf::Event object gets destroyed with the state
Exactly
I also did merge the HandleEvent and Update functions
In a real game, particularly in the Play state, this can be a hell of a mess in one function :S
and I gave the GameState base class directly a reference to the GameEngine, so there's no need to pass that thing around every draw/update call
That´s what I do in my "engine"
Now I think you should add an
initialization function to your states, instead of loading files in the state constructor
I hope that you really used parts of my code otherwise this all won't help you
No, but I get the idea, thank you for sharing the fix.
The most important thing is not to break the event handling loop
The guy that wrote the SDL tutorial doesn´t have this problem because he is using evil singletons