const Phaser = require('phaser');
const fs = require('fs');

const { TEXT } = require('./constants');

const aztecAtlas = require('../../assets/aztec.atlas.json');


class Header extends Phaser.Scene {
    constructor() {
        super({ key: 'Header', active: true });
    }

    preload() {
        const aztecImg = new Image();
        aztecImg.src = `data:image/png;base64,${new Buffer.from(fs.readFileSync('./assets/aztec.clean.png')).toString('base64')}`;
        aztecImg.onload = () => {
            this.textures.addAtlas('aztec', aztecImg, aztecAtlas);
        };
    }

    create() {
        this.add.text(0, 0, 'cryps.gg', TEXT.HEADER);
    }
}

module.exports = Header;
