Skip to content

Screens

Perses Games edited this page Apr 26, 2017 · 2 revisions

Screens

You start a game with:

    Game.start(<Screen>)

Implement the screen class and off you go, screen class:

abstract class Screen {

    open fun loadResources() {}

    open fun unloadResources() {}

    abstract fun update(time: Float, delta: Float)

    abstract fun render()

}

See the starter project for an example implementation.

When you want to switch to another screen (from menu to game for example), just call:

    Game.setScreen(<new screen>)

This will unload the resources in the old screen, switch the screen and start loading the resources in the new screen.

Clone this wiki locally