wgge 0.0.3 → 0.0.5

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.
@@ -79,4 +79,8 @@ export default class Quaternion extends ObjectModel {
79
79
  this.setFromArray(state);
80
80
  }
81
81
 
82
+ asRgbaColor() {
83
+ return `rgba(${Math.round(this.x)}, ${Math.round(this.y)}, ${Math.round(this.z)}, ${Math.round(this.w)})`;
84
+ }
85
+
82
86
  }
@@ -1,6 +1,7 @@
1
1
  import RendererBase from "../RendererBase";
2
2
  import StringHelper from "../../helper/StringHelper";
3
3
  import Vector2 from "../../model/vector/Vector2";
4
+ import {SVG} from "@svgdotjs/svg.js";
4
5
 
5
6
  export default class SvgRenderer extends RendererBase {
6
7
 
@@ -78,6 +79,14 @@ export default class SvgRenderer extends RendererBase {
78
79
  element.remember('rotation', rotation);
79
80
  }
80
81
 
82
+ scale(element, scale) {
83
+ if (scale.x !== undefined && scale.y !== undefined) {
84
+ element.scale(scale.x, scale.y);
85
+ } else {
86
+ element.scale(scale, scale);
87
+ }
88
+ }
89
+
81
90
  /**
82
91
  *
83
92
  * @param {SVG.Container|null|undefined} parent
@@ -21,18 +21,6 @@ export default class GameController extends ControllerBase {
21
21
  this.addChild(new ControlsController(this.game, this.model.controls));
22
22
  this.addChild(new EditorController(this.game, this.model.editor));
23
23
 
24
- this.addAutoEvent(
25
- this.model,
26
- 'new-game',
27
- () => this.runOnUpdate(() => this.startNewGame())
28
- );
29
-
30
- this.addAutoEvent(
31
- this.model,
32
- 'show-main-menu',
33
- () => this.showMainMenu()
34
- );
35
-
36
24
  this.addAutoEvent(
37
25
  window,
38
26
  'resize',
@@ -65,17 +53,10 @@ export default class GameController extends ControllerBase {
65
53
 
66
54
  }
67
55
 
68
- activateInternal() {
69
- this.loadResourcesFromStorage().then(() => {
70
- this.model.resources.addOnDirtyListener(() => this.isResourcesDirty = true);
71
- this.showMainMenu();
72
- });
73
- }
74
-
75
56
  updateInternal(delta) {
76
57
 
77
58
  // saving of resources during debugging
78
- if (this.game.isInDebugMode.get()) {
59
+ if (this.model.isInDebugMode.get()) {
79
60
  this.resourcesTimeOut = (this.resourcesTimeOut === null) ? 3000 : this.resourcesTimeOut - delta;
80
61
  if (this.isResourcesDirty && this.resourcesTimeOut <= 0) {
81
62
  this.resourcesTimeOut = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgge",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Web GL Game Engine",
5
5
  "main": "index.js",
6
6
  "dependencies": {