r3-legacy/src/game-lib-system-gui.js

36 lines
869 B
JavaScript
Raw Normal View History

2017-06-19 15:54:02 +02:00
/**
* System takes care of updating all the entities (based on their component data)
* @param apiSystem GameLib.API.System
* @constructor
*/
GameLib.System.GUI = function(
apiSystem
) {
GameLib.System.call(
this,
apiSystem
);
};
GameLib.System.GUI.prototype = Object.create(GameLib.System.prototype);
GameLib.System.GUI.prototype.constructor = GameLib.System.GUI;
GameLib.System.GUI.prototype.start = function() {
var guis = GameLib.EntityManager.Instance.queryComponents(GameLib.GUI);
guis.map(function(gui){
gui.domElement.instance.parentElement.appendChild(gui.instance.domElement);
})
};
GameLib.System.GUI.prototype.stop = function() {
var guis = GameLib.EntityManager.Instance.queryComponents(GameLib.GUI);
guis.map(function(gui){
gui.domElement.instance.parentElement.removeChild(gui.instance.domElement);
})
};