package;

import flixel.FlxG;
import flixel.text.FlxText;
import flixel.ui.FlxButton;
import flixel.FlxSprite;
import flixel.FlxSubState;


class GameOverWindow extends FlxSubState {

    var bg:FlxSprite;
    var titleText:FlxText;
    var descriptionText:FlxText;
    var buttonLeft:FlxButton;
    var buttonRight:FlxButton;


    public function new() {
        super();

        bg = new FlxSprite(0, 0, "assets/images/upgrade_window.png");
        bg.camera = PlayState.cameraHUD;
        add(bg);

        titleText = new FlxText(0, 180, FlxG.width, "GAME OVER", 24);
		titleText.alignment = FlxTextAlign.CENTER;
		titleText.font = "assets/data/PressStart2P.ttf";
		titleText.camera = PlayState.cameraHUD;
		add(titleText);


        descriptionText = new FlxText(325, 228, 355, "It is a mournful night, for the forces of darkness have prevailed.", 12);
        descriptionText.alignment = FlxTextAlign.CENTER;
        descriptionText.font = "assets/data/PressStart2P.ttf";
        descriptionText.camera = PlayState.cameraHUD;
        add(descriptionText);
        
        buttonLeft = new FlxButton(427, 300, "", onButtonLeft);
        buttonLeft.label.text = "Try Again";
        buttonLeft.label.font = "assets/data/PressStart2P.ttf";
        buttonLeft.label.size = 12;
        buttonLeft.label.alignment = FlxTextAlign.CENTER;
        //buttonLeft.label.camera = PlayState.cameraHUD;
        buttonLeft.label.offset.y = -20;
        buttonLeft.label.color = 0xffffffff;
        buttonLeft.loadGraphic("assets/images/continue_button.png", true, 153, 67);
        buttonLeft.camera = PlayState.cameraHUD;
        add(buttonLeft);
    }

    override public function update(elapsed:Float) {
        super.update(elapsed);

        
    }

    function onButtonLeft() {
        close();
        FlxG.switchState(new PlayState());
    }

}