class MenuLayer extends PH.Layer {
    game: Game;
    bestScore: number;

    constructor(game: Game) {
        super();
        this.game = game;
        this.bestScore = this.game.getBestScore();
    }

    draw() {
        let dims = this.game.getDims();
        this.game.titleFont.drawCenteredText(this.game.ctx, "Rail", dims.cx, dims.cy - dims.scale);
        let highScoreMessage = "Best so far: ";
        if(this.game.newHighScore) {
            highScoreMessage = "New high score! ";
        }
        this.game.mainFont.drawCenteredText(this.game.ctx, highScoreMessage + this.bestScore.toString(), dims.cx, dims.cy + 0.75 * dims.scale);
        this.game.mainFont.drawCenteredText(this.game.ctx, "Click to start", dims.cx, dims.cy + 1.5 * dims.scale);
    }

    handleClick(): boolean {
        this.game.endMenu();
        return false;
    }
}