Hi guys! I have a question that makes me thinking: is it possible to detach an appstate inside an appstate?
An example: I have the GameplayAppState, and I want to switch to the menu. Something like stateManager.getState(GameplayAppState).detach(). I have been using the cleanup() method, but the update() loop keeps running. How do I do it?
Yeah, I know. But I can’t do stateManager.detach(GameplayAppState.class). I must declare a class field somewhere. Should I declare it inside the appstate or in another place?
I tried to do that, but I detach my appstate inside the onAction() method of the ActionListener. In that case, this refers to ActionListener. But can I make this refer to the appstate inside that method?
That’s not enough code. I can’t tell you how to reference the outer instance unless I know what the class is called. Err… maybe I should write my response like this:
“ugh code. I can’t tell you how to refere”
I’ve on this forum actively for like 4 years now and not ONCE has anyone complained about too much information… but 95% of posts request more information.
re: Code formatting… maybe we should put a stick post right on the front page of the forum… oh wait. We did.
Three back ticks ` before and after the code is the best way, though… I’ll save you some reading through irrelevant options.