KtxGame
An equivalent of com.badlogic.gdx.Game delegating game events to a Screen. On contrary to Game
, KtxGame maintains a collection of screens mapped by their type and allows to change screens knowing only their type with setScreen. Thanks to this, its easier to cache screens without maintaining a singleton with all Screen instances manually. ScreenType generic type allows to users to use an extended specific base class (or interface) for all screens, without locking into Screen.
Parameters
will be immediately used by the application. Note that it cannot use any resources initiated by the libGDX (like the OpenGL context) in the constructor, as the screen will be created before the application is launched. Defaults to an empty, mock-up screen implementation that should be replaced with the first setScreen method call in create. Note: firstScreen
still has to be explicitly registered with addScreen if you want it to be accessible with getScreen.
if true (the default), clearScreen will be called before screen rendering.
common base interface or class of all screens. Allows to use custom extended Screen API.
See also
Properties
Functions
Checks if screen of the given type is registered.
Disposes of all registered screens with Screen.dispose. Catches thrown errors and logs them with libGDX application API by default. Override onScreenDisposalError method to change error handling behavior. Should be called automatically by libGDX application lifecycle handler.
Removes cached instance of Screen of the selected type. Note that this method does not dispose of the screen and will not affect shownScreen.
Replaces current screen with the registered screen instance of the passed type.
Replaces current screen with the registered screen instance of the passed type. Calls hide
method of the previous screen and show
method of the current screen. Override this method to control screen transitions.