/*
* 2016 Maciej Wiecierzewski
*/
/**
* @constructor
* @extends Dialog
*/
function MenuDialog()
{
Dialog.call(this);
this.playButton = new Button("Play", "20px Arial", "#fff", "#000");
Dialog.onClick(this.playButton.container, 'gotoGameplay');
this.playButton.appendTo(this.container);
this.title = new createjs.Text("OperatorMaster", "bold 36px Arial");
this.container.addChild(this.title);
this.description = new createjs.Text("Find out the right order of operations", "20px Arial");
this.container.addChild(this.description);
}
MenuDialog.prototype = Object.create(Dialog.prototype);
/** Resizes the dialog */
MenuDialog.prototype.resize = function()
{
var width = Dialog.stage.canvas.width;
var height = Dialog.stage.canvas.height;
if(width > 500)
{
if(height > 230)
{
this.playButton.resize(0.6*width, 0.4*(height-120), 0.35*width, 160);
this.title.x = 10;
this.title.y = 0.4*(height-120);
this.description.x = 10;
this.description.y = 0.4*(height-120)+60;
}
else
{
this.playButton.resize(0.6*width, 0.1*height, 0.35*width, 0.8*height);
this.title.x = 10;
this.title.y = 0.1*height;
this.description.x = 10;
this.description.y = 0.1*height+60;
}
}
else
{
var buttonWidth = Math.min(width-40, 400);
this.playButton.resize((width-buttonWidth)/2, 0.3*height, buttonWidth, 80);
this.title.x = (width-this.title.getMeasuredWidth())/2;
this.title.y = 50;
this.description.x = (width-this.description.getMeasuredWidth())/2;
this.description.y = 0.3*height+120;
}
}