BlueGit

timfa frameworkv3

allow draw override

timfa Tim · pushed by timfa

Authored 2022-10-15 · 4 years ago

Hash
f7222b47c6fe71827fb5c6c7a37731112eeac895
Parent
18952e54
2 files changed +7 −2
framework/engine/gameobject.js +5 −0
@@ -31,4 +31,9 @@ class GameObject
31 31 this.scene.removeObject(this);
32 32 }
33 33 }
34
35 draw()
36 {
37 this.renderer.draw();
38 }
34 39 }
@@ -31,4 +31,9 @@ class GameObject
31 this.scene.removeObject(this);
31 this.scene.removeObject(this);
32 }
32 }
33 }
33 }
34
35 draw()
36 {
37 this.renderer.draw();
38 }
34}
39}
framework/engine/scene.js +2 −2
@@ -84,7 +84,7 @@ class Scene
84 84
85 85 this.activeObjects.push(obj);
86 86 obj.scene = this;
87
87
88 88 obj.addedToScene && obj.addedToScene();
89 89 }
90 90
@@ -148,7 +148,7 @@ class Scene
148 148 for(var i = 0; i < this.activeObjects.length; i++)
149 149 {
150 150 if(!this.activeObjects[i].destroyed && this.activeObjects[i].renderer.visible)
151 this.activeObjects[i].renderer.draw(this.context);
151 this.activeObjects[i].draw(this.context);
152 152 }
153 153 }
154 154 }
@@ -84,7 +84,7 @@ class Scene
84
84
85 this.activeObjects.push(obj);
85 this.activeObjects.push(obj);
86 obj.scene = this;
86 obj.scene = this;
87
87
88 obj.addedToScene && obj.addedToScene();
88 obj.addedToScene && obj.addedToScene();
89 }
89 }
90
90
@@ -148,7 +148,7 @@ class Scene
148 for(var i = 0; i < this.activeObjects.length; i++)
148 for(var i = 0; i < this.activeObjects.length; i++)
149 {
149 {
150 if(!this.activeObjects[i].destroyed && this.activeObjects[i].renderer.visible)
150 if(!this.activeObjects[i].destroyed && this.activeObjects[i].renderer.visible)
151 this.activeObjects[i].renderer.draw(this.context);
151 this.activeObjects[i].draw(this.context);
152 }
152 }
153 }
153 }
154}
154}