Issue
What should come first: dispose() or setScreen() ?
myMethod(){
myGame.setScreen(new Screen());
dispose();
}
or
myMethod(){
dispose();
myGame.setScreen(new Screen());
}
Solution
In most cases it shouldn't matter. dispose()
happens instantly. setScreen()
queues the screen that will be drawn in the next frame, so the effect of calling it is deferred until after dispose()
is complete anyway.
I say "most" cases, because I suppose it's possible you're doing something weird in dispose()
that relies on checking what the current screen is.
Answered By - Tenfour04
Answer Checked By - Marilyn (JavaFixing Volunteer)