In a Slick2D game, how can I access parameters passed to the AppletGameContainer?
I’ve got a Slick2D game that I’d like to run both as an applet, and as a standalone application.
When the game is running as an applet, I’d like to access some information passed to it. I was thinking maybe I could do an instanceof check of the GameContainer in StateBasedGame#initGameStates, but AppletGameContainer does not inherit from GameContainer.
Is there a feature of the Slick2D framework that allows for easy access to applet parameters, or better still, some layer of abstraction that will allow access to applet parameters or command-line arguments, without my game having to know which container it was started by?
AppletGameContainerdoesn’t share the same heritage, but instead defines a public inner class, the rather ambiguously-namedContainer. It is an instance of this that gets passed to theStateBasedGameimplementation.Hence the check should have been:
…and the code to acquire the parameters: