action-engine-js 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actionengine/core/app.js +5 -1
- package/actionengine/display/canvasmanager.js +8 -9
- package/actionengine/display/gl/programmanager.js +572 -569
- package/actionengine/display/gl/shaders/lineshader.js +25 -0
- package/actionengine/display/gl/shaders/objectshader.js +1768 -1755
- package/actionengine/display/gl/shaders/particleshader.js +10 -0
- package/actionengine/display/gl/shaders/spriteshader.js +109 -99
- package/actionengine/display/gl/shaders/watershader.js +77 -66
- package/actionengine/display/graphics/lighting/actiondirectionalshadowlight.js +868 -868
- package/actionengine/display/graphics/lighting/lightmanager.js +0 -5
- package/actionengine/display/graphics/renderers/actionrenderer3D/actionrenderer3D.js +654 -654
- package/actionengine/display/graphics/renderers/actionrenderer3D/debugrenderer3D.js +496 -500
- package/actionengine/display/graphics/renderers/actionrenderer3D/objectrenderer3D.js +799 -789
- package/actionengine/display/graphics/renderers/actionrenderer3D/spriteRenderer3D.js +290 -265
- package/actionengine/display/graphics/renderers/actionrenderer3D/sunrenderer3D.js +18 -1
- package/actionengine/display/graphics/renderers/actionrenderer3D/waterrenderer3D.js +178 -172
- package/actionengine/display/graphics/renderers/actionrenderer3D/weatherrenderer3D.js +5 -0
- package/actionengine/network/client/ActionNetManagerGUI.js +3 -2
- package/dist/action-engine.min.js +147 -74
- package/package.json +1 -1
package/actionengine/core/app.js
CHANGED
|
@@ -334,7 +334,11 @@ canvas {
|
|
|
334
334
|
|
|
335
335
|
class App {
|
|
336
336
|
constructor(options = {}) {
|
|
337
|
-
|
|
337
|
+
// Check if Game class specifies resolution (allows per-game configuration)
|
|
338
|
+
const width = Game.WIDTH || 800;
|
|
339
|
+
const height = Game.HEIGHT || 600;
|
|
340
|
+
|
|
341
|
+
this.threelayersystem = new CanvasManager(width, height);
|
|
338
342
|
const canvases = this.threelayersystem.getCanvases();
|
|
339
343
|
this.audio = new ActionAudioManager();
|
|
340
344
|
this.input = new ActionInputHandler(this.audio, canvases);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// actionengine/display/canvasmanager.js
|
|
2
2
|
class CanvasManager {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
constructor() {
|
|
3
|
+
constructor(width = 800, height = 600) {
|
|
4
|
+
this.width = width;
|
|
5
|
+
this.height = height;
|
|
7
6
|
this.container = document.getElementById("appContainer");
|
|
8
7
|
|
|
9
8
|
// Create the three canvases with explicit roles
|
|
@@ -25,8 +24,8 @@ class CanvasManager {
|
|
|
25
24
|
createCanvas(id) {
|
|
26
25
|
const canvas = document.createElement("canvas");
|
|
27
26
|
canvas.id = id;
|
|
28
|
-
canvas.width =
|
|
29
|
-
canvas.height =
|
|
27
|
+
canvas.width = this.width;
|
|
28
|
+
canvas.height = this.height;
|
|
30
29
|
this.container.appendChild(canvas);
|
|
31
30
|
return canvas;
|
|
32
31
|
}
|
|
@@ -51,10 +50,10 @@ class CanvasManager {
|
|
|
51
50
|
const containerWidth = this.container.clientWidth;
|
|
52
51
|
const containerHeight = this.container.clientHeight;
|
|
53
52
|
|
|
54
|
-
const scale = Math.min(containerWidth /
|
|
53
|
+
const scale = Math.min(containerWidth / this.width, containerHeight / this.height);
|
|
55
54
|
|
|
56
|
-
const scaledWidth =
|
|
57
|
-
const scaledHeight =
|
|
55
|
+
const scaledWidth = this.width * scale;
|
|
56
|
+
const scaledHeight = this.height * scale;
|
|
58
57
|
|
|
59
58
|
// Apply scaling to all canvases
|
|
60
59
|
[this.gameCanvas, this.guiCanvas, this.debugCanvas].forEach((canvas) => {
|