So okay, my idea is this:
Make an Interface like this:
Code:
public interface Pausable {
pauseUpdate();
pauseRender();
unpauseUpdate();
unpauseRender();
isUpdatePaused();
isRenderPaused();
setUpdatePaused(boolean pause);
setRenderPaused(boolean pause);
}
So render really should be paused too. Actually is the art of trolling if we would tell teh dev: "Hey man, you can pause update but not render, but SLick2D is very flexible".
Both the GameState class and the StateBasedGame implement this Interface. So to stop a game state, one just gets it by ID and pauses it. And he can also global pause all state updating/rendering by using the StateBasedGame methods. So the user has full controll ofver what to stop. And also making uodate and render at least not final. It's simply not good design because we force the dev to to use our transition system and our way to treat states. This is very static and the only way out is to copy all the code from StateBasedGame into your own code.
I also suggest not making the pause methods final. final is nice to say: "Yay, I'm pretty sure that this can be final since no one ever will have a better idea then me". But that's not us. Slick2D should be flexible in that manner.
If the user can switch states while pausing... this is a good question. Of course not hard to implement but it's a good idea. So one state is paused and we switch to another keeping the old one paused, then return to that state. Much like a Menu <-> Gameplay Thingi.
Question is. Has anybody an idea how we implement this into the Gamestate? Currently update and render are both abstract. My idea is to check that in the StateBasedGame. if it's paused. don't call the states update/render method.
_________________
Current Projects:
Mr. Hat I
Vegan Vs. ZombiesProjects:RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!