There are a lot of articles about how to save a state of a game and they are pretty good. But I have one conceptual misunderstanding where should I save the state?
My game has number of screens and pair of them are MainMenuScreen and MainSceneScreen these are inherited from Screen class. MainMenuScreen is shown at start of the game the MainSceneScreen little later.
What is the problem? I navigated to MainSceneScreen, forced Android to stop the application (I change a language settings on the device to achieve it, please let me know if I'm wrong). After that I select the application again and I can see MainMenuScreen is shown. But I want MainSceneScreen to be shown.
I suppose I should override resume method. But what class I should override? I have class PsGame that extends Game class of libgdx. I put breakpoints to its resume method and it turned out that method was not called. I investigated the problem and I've found little strange code in onResume method of AndroidApplication class of libgdx:
if (!firstResume) graphics.resume(); else firstResume = false;
My debugger said firstResume was true and didn't go to *graphics.resume()*line.
Sorry for a lot of words but could you answer following question:
- What did I do wrong?
- What methods should I override?
Thank you in advance.