Tutorial: Screen Pages Stages

Screen Pages Stages

ScreenPage has few different loading stages:

  1. constructor() - the default class stage, is called once right after page has registered in the app with System.registerPage.
    Nothing special happens here.

  2. register() - here SystemInterface, includes SystemSettings (systemSettings), SystemAudioInterface(audio) and SystemSocketConnection(network) are attached to the ScreenPage.
    This is a place where assets should be added: Assets Manager, How to add and use audio

  3. init() - is called after the SystemInterface.startScreenPage() is called, this stage called only once pear game. Assets, which were added at the register(2) stage, will be already loaded and ready to be used here.
    start() - is called right after init() the stage. If the page will be stopped with the SystemInterface stopScreenPage() and then restarted again it will be called without the init() on the second start.

  4. stop() - is called after SystemInterface.stopScreenPage() is called. Can be used for shutdown the page, remove listeners etc.

All methods above can be overwritten.