wgge 2.0.39 → 2.0.41

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.
@@ -1,9 +1,12 @@
1
1
  export const EASING_FLAT = (x) => x;
2
2
  export const EASING_EXPONENTIAL_IN = (x, e = 2) => Math.pow(x, e);
3
+ export const EASING_EXPONENTIAL_OUT = (x, e = 2) => 1 - Math.pow(1 - x, e);
3
4
  export const EASING_EXPONENTIAL_IN_OUT = (x, e = 2) => (x <= 0.5) ? Math.pow(x * 2, e) / 2 : 1 - Math.pow(2 - x * 2, e) / 2;
4
5
  export const EASING_QUAD_IN = EASING_EXPONENTIAL_IN;
6
+ export const EASING_QUAD_OUT = EASING_EXPONENTIAL_OUT;
5
7
  export const EASING_QUAD_IN_OUT = EASING_EXPONENTIAL_IN_OUT;
6
8
  export const EASING_CUBIC_IN = (x) => EASING_EXPONENTIAL_IN(x, 3);
9
+ export const EASING_CUBIC_OUT = (x) => EASING_EXPONENTIAL_OUT(x, 3);
7
10
  export const EASING_CUBIC_IN_OUT = (x) => EASING_EXPONENTIAL_IN_OUT(x, 3);
8
11
  export const EASING_SPHERE_IN = (v) => 1 - Math.sqrt(1 - Math.pow(v, 2));
9
12
  export const EASING_SPHERE_OUT = (v) => Math.sqrt(1 - Math.pow(1 - v, 2));
@@ -1,6 +1,7 @@
1
1
  import ControllerBase from "../../core/controller/ControllerBase";
2
2
 
3
3
  export default class ControlsController extends ControllerBase {
4
+
4
5
  dom;
5
6
 
6
7
  /**
@@ -29,7 +30,7 @@ export default class ControlsController extends ControllerBase {
29
30
 
30
31
  onKeyDown(event) {
31
32
  const key = event.keyCode ? event.keyCode : event.charCode;
32
- if (this.game.isInDebugMode.get()) console.log(key);
33
+ if (this.model.logPressedKeys.get()) console.log(`key pressed: ${key}`);
33
34
  this.model.triggerEvent(`key-down-${key}`);
34
35
  this.model.triggerEvent(`key-down`, key);
35
36
  }
@@ -47,7 +48,6 @@ export default class ControlsController extends ControllerBase {
47
48
  this.model.triggerEvent(`key-up-${key}`);
48
49
  this.model.triggerEvent(`key-up`, key);
49
50
  }
50
-
51
51
  }
52
52
 
53
53
  onMouseMove(e) {
@@ -10,6 +10,11 @@ export const EVENT_RIGHT_CLICK = 'right-click';
10
10
 
11
11
  export default class ControlsModel extends ObjectModel {
12
12
 
13
+ /**
14
+ * @type BoolValue
15
+ */
16
+ logPressedKeys;
17
+
13
18
  /**
14
19
  * @type BoolValue
15
20
  */
@@ -20,14 +25,24 @@ export default class ControlsModel extends ObjectModel {
20
25
  */
21
26
  mouseCoordinates;
22
27
 
28
+ /**
29
+ * @type BoolValue
30
+ */
23
31
  mouseDownLeft;
32
+
33
+ /**
34
+ * @type BoolValue
35
+ */
24
36
  mouseDownRight;
37
+
25
38
  leftClickTime;
39
+
26
40
  rightClickTime;
27
41
 
28
42
  constructor() {
29
43
  super();
30
44
 
45
+ this.logPressedKeys = this.addProperty('logPressedKeys', new BoolValue(false));
31
46
  this.isMouseOver = this.addProperty('isMouseOver', new BoolValue(false));
32
47
  this.mouseCoordinates = this.addProperty('mouseCoordinates', new Vector2());
33
48
  this.mouseDownLeft = this.addProperty('mouseDownLeft', new BoolValue(false));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wgge",
3
- "version": "2.0.39",
3
+ "version": "2.0.41",
4
4
  "description": "Web GL Game Engine",
5
5
  "main": "index.js",
6
6
  "devDependencies": {