BlueGit

timfa frameworkv3

at some point do left top

timfa wsadhelios · pushed by timfa

Authored 2022-10-20 · 4 years ago

Hash
44cb64970fe0cedcc1079a42caf7ef8ecd893458
Parent
fc3febb8
1 file changed +14 −5
framework/engine/scene.js +14 −5
@@ -9,6 +9,7 @@ class Scene
9 9 real_size = null;
10 10 cameraPosition = null;
11 11 parentScene = null;
12 renderBackground = true;
12 13
13 14 g_primary = false;
14 15
@@ -149,13 +150,21 @@ class Scene
149 150 this.real_size.y = this.size.y;
150 151 }
151 152
152 this.canvas.width = this.real_size.x;
153 this.canvas.height = this.real_size.y;
153 if (this.canvas.width != this.real_size.x)
154 this.canvas.width = this.real_size.x;
154 155
155 this.canvas.style = 'position: absolute; left: ' + this.real_position.x + 'px; top: ' + this.real_position.y + 'px;'; //todo: only call when changed?
156 if (this.canvas.height != this.real_size.y)
157 this.canvas.height = this.real_size.y;
156 158
157 this.context.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with
158 this.context.fillRect(0, 0, this.real_size.x, this.real_size.y);
159 if (this.renderBackground)
160 {
161 this.context.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with
162 this.context.fillRect(0, 0, this.real_size.x, this.real_size.y);
163 }
164 else
165 {
166 this.context.clearRect(0, 0, this.real_size.x, this.real_size.y);
167 }
159 168
160 169 for (var i = 0; i < this.activeObjects.length; i++)
161 170 {
@@ -9,6 +9,7 @@ class Scene
9 real_size = null;
9 real_size = null;
10 cameraPosition = null;
10 cameraPosition = null;
11 parentScene = null;
11 parentScene = null;
12 renderBackground = true;
12
13
13 g_primary = false;
14 g_primary = false;
14
15
@@ -149,13 +150,21 @@ class Scene
149 this.real_size.y = this.size.y;
150 this.real_size.y = this.size.y;
150 }
151 }
151
152
152 this.canvas.width = this.real_size.x;
153 if (this.canvas.width != this.real_size.x)
153 this.canvas.height = this.real_size.y;
154 this.canvas.width = this.real_size.x;
154
155
155 this.canvas.style = 'position: absolute; left: ' + this.real_position.x + 'px; top: ' + this.real_position.y + 'px;'; //todo: only call when changed?
156 if (this.canvas.height != this.real_size.y)
157 this.canvas.height = this.real_size.y;
156
158
157 this.context.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with
159 if (this.renderBackground)
158 this.context.fillRect(0, 0, this.real_size.x, this.real_size.y);
160 {
161 this.context.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with
162 this.context.fillRect(0, 0, this.real_size.x, this.real_size.y);
163 }
164 else
165 {
166 this.context.clearRect(0, 0, this.real_size.x, this.real_size.y);
167 }
159
168
160 for (var i = 0; i < this.activeObjects.length; i++)
169 for (var i = 0; i < this.activeObjects.length; i++)
161 {
170 {