function DisplayList()
{
    this.m_aDisplayList = [];
}

DisplayList.prototype.Add = function(cGameObject){
    this.m_aDisplayList.push(cGameObject);
};

DisplayList.prototype.Remove = function(cGameObject){
    this.m_aDisplayList.splice(this.m_aDisplayList.indexOf(cGameObject), 1);
};

DisplayList.prototype.Draw = function(cRenderer){
    this.m_aDisplayList.sort(function(a, b){
        return a.zIndex - b.zIndex;
    });

    this.m_aDisplayList.forEach(function(cGameObject){
        cGameObject.Draw(cRenderer);
    });
};

EN.DisplayList = DisplayList;
//# sourceURL=engine/rendering/displaylist.js
@@ -1,60 +1,214 @@
-function DisplayList()%0A%7B%0A    this.m_aDisplayList = %5B%5D;%0A%7D
+var s_fSortFunction = function(a, b)%7B%0A    return a.zIndex - b.zIndex;%0A%7D;%0A%0Afunction DisplayList()%0A%7B%0A    this.m_aDisplayList = %5B%5D;%0A%7D%0A%0ADisplayList.SetSortFunction = function(fSort)%7B%0A    s_fSortFunction = fSort;%0A%7D;
 %0A%0ADi
@@ -521,68 +521,25 @@
 ort(
-function(a, b)%7B%0A        return a.zIndex - b.zIndex;%0A    %7D);%0A
+s_fSortFunction);
 %0A   

support for alternate sorting function