buildStructure({
        surface,
        overlay
    }) {
        // game surface
        const mSurface = new ManagedElement(surface);
        this._surface = mSurface;
        mSurface.autoStretch();

        // overlay
        if (!!overlay) {
            const mOverlay = new ManagedElement(overlay);
            this._overlay = mOverlay;
            mOverlay.width = mSurface.width;
            mOverlay.height = mSurface.height;
            mOverlay.autoStretch();
        }
        window.addEventListener('resize', () => {
            this._surface.autoStretch();
            if (!!this._overlay) {
                this._overlay.autoStretch();
            }
        });
    }
/**
     * Screen and overlay initialization.
     * Will imbue specified canvas with auto-stretch capabilities.
     */
Screen and overlay initialization.
Will imbue specified canvas with auto-stretch capabilities.
Screen and overlay initialization . Will imbue specified canvas with auto - stretch capabilities .
buildStructure({
        surface,
        overlay
    }) {
        const mSurface = new ManagedElement(surface);
        this._surface = mSurface;
        mSurface.autoStretch();
        if (!!overlay) {
            const mOverlay = new ManagedElement(overlay);
            this._overlay = mOverlay;
            mOverlay.width = mSurface.width;
            mOverlay.height = mSurface.height;
            mOverlay.autoStretch();
        }
        window.addEventListener('resize', () => {
            this._surface.autoStretch();
            if (!!this._overlay) {
                this._overlay.autoStretch();
            }
        });
    }
buildStructure ( { surface , overlay } ) { const mSurface = new ManagedElement ( surface ) ; this . _surface = mSurface ; mSurface . autoStretch ( ) ; if ( ! ! overlay ) { const mOverlay = new ManagedElement ( overlay ) ; this . _overlay = mOverlay ; mOverlay . width = mSurface . width ; mOverlay . height = mSurface . height ; mOverlay . autoStretch ( ) ; } window . addEventListener ( 'resize' , ( ) => { this . _surface . autoStretch ( ) ; if ( ! ! this . _overlay ) { this . _overlay . autoStretch ( ) ; } } ) ; }
Screen and overlay initialization.
Screen and overlay initialization .
// game surface // overlay