addScreen

inline fun <Type : ScreenType> addScreen(screen: Type)

Registers an instance of Screen.

Parameters

Type

concrete class of the Screen instance. The implementation assumes that screens are singletons and only one implementation of each class will be registered.

screen

instance of Type. After invocation of this method, setScreen can be used with the appropriate class to change current screen to this object.

See also

Throws

GdxRuntimeException

if a screen of selected type is already registered. Use removeScreen first to replace the screen.


open fun <Type : ScreenType> addScreen(type: Class<Type>, screen: Type)

Registers an instance of Screen. Override this method to change the way screens are registered.

Parameters

type

concrete class of the Screen instance. The implementation assumes that screens are singletons and only one implementation of each class will be registered.

screen

instance of Type. After invocation of this method, setScreen can be used with the appropriate class to change current screen to this object.

See also