36 lines
869 B
JavaScript
36 lines
869 B
JavaScript
|
/**
|
||
|
* 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);
|
||
|
})
|
||
|
};
|
||
|
|