Newer
Older
lostmynuts / shared / js / Engine / GameBase.js
Engine.GameBase = class
{

	getUILayer() { return this.UILayer;}
	getTutorialLayer() { return this.tutorialLayer; }
	getOverLayer() { return this.overLayer; }

	constructor(rootDrawable /*Drawable*/)
	{

		this.root = rootDrawable;
		this.UILayer = new Engine.Drawable();
		this.tutorialLayer = new Engine.Drawable();
		this.overLayer = new Engine.Drawable();

		this.screenController = new Engine.ScreenController(this);
		
		rootDrawable.addChild(this.UILayer);
		rootDrawable.addChild(this.tutorialLayer);
		rootDrawable.addChild(this.overLayer);
		Engine.EnterFrameManagerInstance.add(this, this.update);
		
		Engine.DialogManagerInstance.setUILayer(this.UILayer);
		Engine.DialogManagerInstance.setTutorialLayer(this.tutorialLayer);
		Engine.DialogManagerInstance.setOverLayer(this.overLayer);
		Engine.DialogManagerInstance.enable();
		
	}

	update(timeElapsed /*float*/)
	{
		if (this.screenController != null) this.screenController.update(timeElapsed);
	}

	resolutionChanged(width /*int*/, height /*int*/)
	{
		if (this.screenController != null)
		{
			if (this.screenController.activeScreen != null)
			{
				this.screenController.activeScreen.resize(width,height);
			}
		}
		Engine.DialogManagerInstance.resolutionChanged(width, height);
	}

	closing() {}

}