import Phaser from 'phaser'
import LU from '../display/layout';

export default class PageTurn extends Phaser.Group {
    constructor(game, parent, name) {
        super(game, parent, name);

        this.pageWidth = 960;
        this.pageHeight = 640;

        this.create();
    }

    create() {
        this.gfx = this.game.add.graphics(0, 0);
        this.gfx.beginFill("0x000000");

        if (LU.LEFT_OFFSET != 0) {
            //left and right rectangles
            this.gfx.drawRect(LU.LEFT_OFFSET, 0, -LU.LEFT_OFFSET, this.pageHeight);
            this.gfx.drawRect(this.pageWidth, 0, -LU.LEFT_OFFSET, this.pageHeight);
        }
        else {
            //top and bottom rectangles
            this.gfx.drawRect(0, LU.TOP_OFFSET + 1, this.pageWidth, -LU.TOP_OFFSET + 1);
            this.gfx.drawRect(0, this.pageHeight - 1, this.pageWidth, -LU.TOP_OFFSET + 1);
        }

        this.add(this.gfx);

        // console.log(this.gfx);
    }
}
