@woosh/meep-engine 2.126.6 → 2.126.9
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/package.json +1 -1
- package/src/engine/ecs/guid/UUID.d.ts +6 -1
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -1
- package/src/engine/ecs/guid/UUID.js +13 -1
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +1 -0
- package/src/engine/ecs/storage/BinaryBufferSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +5 -2
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +19 -4
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.126.
|
|
8
|
+
"version": "2.126.9",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -92,10 +92,15 @@ export class UUID {
|
|
|
92
92
|
*/
|
|
93
93
|
toString(): string;
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
95
|
+
* Sets this UUID to hold the same value as the other
|
|
96
96
|
* @param {UUID} other
|
|
97
97
|
*/
|
|
98
98
|
copy(other: UUID): void;
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @return {UUID}
|
|
102
|
+
*/
|
|
103
|
+
clone(): UUID;
|
|
99
104
|
/**
|
|
100
105
|
*
|
|
101
106
|
* @param {UUID} other
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IA2HI;;;OAGG;IACH,aAFY,IAAI,CAQf;IA2BD;;;OAGG;IACH,aAFa,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFY,MAAM,CAIjB;IA6CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IAxOD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,UAAU,GAAC,SAAS,CAAC,MAAM,CAAC,EAO/C;IAED;;;OAGG;IACH,YAFa,UAAU,CAItB;IAED;;;;;;;;OAQG;IACH,eALY,MAAM,CAUjB;IAED;;;;OAIG;IACH,OAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,MAFa,IAAI,CAwEhB;IAcD;;;OAGG;IACH,MAFa,IAAI,CAqBhB;IAuBD;;;OAGG;IACH,cAFW,MAAM,QAuChB;IAeD;;;;;;OAMG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAcnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAYlB;IAIL;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IA2HI;;;OAGG;IACH,aAFY,IAAI,CAQf;IA2BD;;;OAGG;IACH,aAFa,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFY,MAAM,CAIjB;IA6CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IAxOD;;;OAGG;IACH,gBAFW,MAAM,EAAE,GAAC,UAAU,GAAC,SAAS,CAAC,MAAM,CAAC,EAO/C;IAED;;;OAGG;IACH,YAFa,UAAU,CAItB;IAED;;;;;;;;OAQG;IACH,eALY,MAAM,CAUjB;IAED;;;;OAIG;IACH,OAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,MAFa,IAAI,CAwEhB;IAcD;;;OAGG;IACH,MAFa,IAAI,CAqBhB;IAuBD;;;OAGG;IACH,cAFW,MAAM,QAuChB;IAeD;;;;;;OAMG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;OAGG;IACH,SAFY,IAAI,CAQf;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAcnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAYlB;IAIL;;OAEG;IACH,uBAzFiB,MAAM,CAyFF;IAErB;;OAEG;IACH,4BAzJe,MAAM,UAyJE;IAQvB;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CAtBpB;;kBAcS,MAAM"}
|
|
@@ -316,13 +316,25 @@ export class UUID {
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
/**
|
|
319
|
-
*
|
|
319
|
+
* Sets this UUID to hold the same value as the other
|
|
320
320
|
* @param {UUID} other
|
|
321
321
|
*/
|
|
322
322
|
copy(other) {
|
|
323
323
|
this.#data.set(other.#data);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
/**
|
|
327
|
+
*
|
|
328
|
+
* @return {UUID}
|
|
329
|
+
*/
|
|
330
|
+
clone() {
|
|
331
|
+
const r = new UUID();
|
|
332
|
+
|
|
333
|
+
r.copy(this);
|
|
334
|
+
|
|
335
|
+
return r;
|
|
336
|
+
}
|
|
337
|
+
|
|
326
338
|
/**
|
|
327
339
|
*
|
|
328
340
|
* @param {UUID} other
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryBufferDeSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferDeSerializer.js"],"names":[],"mappings":";AAQA;;GAEG;AACH,uCAFa,GAAG;IAGZ;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;;;;OAMG;IACH,gBALW,YAAY,WACZ,GAAG,WACH,sBAAsB,GACpB,IAAI,
|
|
1
|
+
{"version":3,"file":"BinaryBufferDeSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferDeSerializer.js"],"names":[],"mappings":";AAQA;;GAEG;AACH,uCAFa,GAAG;IAGZ;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;;;;OAMG;IACH,gBALW,YAAY,WACZ,GAAG,WACH,sBAAsB,GACpB,IAAI,CA+BhB;CACJ;iBArDgB,oCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryBufferSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferSerializer.js"],"names":[],"mappings":";AAmDA;IACI;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;OAGG;IACH,QAFU,MAAM,GAAC,IAAI,CAEP;IAEd;;;;OAIG;IACH,gBAFW,YAAY,WADZ,sBAAsB,
|
|
1
|
+
{"version":3,"file":"BinaryBufferSerializer.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/storage/BinaryBufferSerializer.js"],"names":[],"mappings":";AAmDA;IACI;;;OAGG;IACH,UAFU,2BAA2B,CAErB;IAEhB;;;OAGG;IACH,QAFU,MAAM,GAAC,IAAI,CAEP;IAEd;;;;OAIG;IACH,gBAFW,YAAY,WADZ,sBAAsB,QA6HhC;CACJ"}
|
|
@@ -55,7 +55,7 @@ class BinaryBufferSerializer {
|
|
|
55
55
|
* @type {BinarySerializationRegistry}
|
|
56
56
|
*/
|
|
57
57
|
registry = null;
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
/**
|
|
60
60
|
*
|
|
61
61
|
* @type {Engine|null}
|
|
@@ -81,7 +81,10 @@ class BinaryBufferSerializer {
|
|
|
81
81
|
|
|
82
82
|
const typeCountAddress = buffer.position;
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const FORMAT_VERSION = 0;
|
|
85
|
+
|
|
86
|
+
buffer.writeUint16(FORMAT_VERSION)
|
|
87
|
+
buffer.writeUint16(numSerializableTypes);
|
|
85
88
|
|
|
86
89
|
const collectionSerializer = new BinaryCollectionSerializer();
|
|
87
90
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyboardDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/KeyboardDevice.js"],"names":[],"mappings":";AAYA
|
|
1
|
+
{"version":3,"file":"KeyboardDevice.d.ts","sourceRoot":"","sources":["../../../../../src/engine/input/devices/KeyboardDevice.js"],"names":[],"mappings":";AAYA;;;;GAIG;AACH;IA4BI;;;OAGG;IACH,wBAHW,WAAW,GAAC,OAAO,EAgC7B;IA3DD;;OAEG;IACH;QACI;;;WAGG;cADO,MAAM,CAAC,aAAa,CAAC;QAG/B;;;WAGG;YADO,MAAM,CAAC,aAAa,CAAC;MAGjC;IAEF;;;;;;;OAOG;IACH,mBAAU;IAkBN;;;OAGG;IACH,YAFU,WAAW,CAEO;IA8FhC;;;OAGG;IACH,SAFa,IAAI,CAMhB;IAED;;;OAGG;IACH,QAFa,IAAI,CAMhB;;CAEJ;mBAnLkB,uCAAuC"}
|
|
@@ -13,6 +13,7 @@ const codeToKeyNameMap = [];
|
|
|
13
13
|
/**
|
|
14
14
|
* Provides keyboard input.
|
|
15
15
|
* Listens for key events on a DOM element and provides signals and state for key presses.
|
|
16
|
+
* NOTE: when losing focus of the application, any "pressed" keys will be automatically released. For example, if you hold "A" and click over into another application window - A will be forcibly released with appropriate signal
|
|
16
17
|
*/
|
|
17
18
|
class KeyboardDevice {
|
|
18
19
|
|
|
@@ -102,12 +103,12 @@ class KeyboardDevice {
|
|
|
102
103
|
|
|
103
104
|
button.press();
|
|
104
105
|
|
|
105
|
-
if(button.down.hasHandlers()){
|
|
106
|
+
if (button.down.hasHandlers()) {
|
|
106
107
|
should_prevent_default = true;
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
if(should_prevent_default){
|
|
111
|
+
if (should_prevent_default) {
|
|
111
112
|
event.preventDefault();
|
|
112
113
|
}
|
|
113
114
|
}
|
|
@@ -132,18 +133,30 @@ class KeyboardDevice {
|
|
|
132
133
|
|
|
133
134
|
button.release();
|
|
134
135
|
|
|
135
|
-
if(button.down.hasHandlers()){
|
|
136
|
+
if (button.down.hasHandlers()) {
|
|
136
137
|
should_prevent_default = true;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
if(should_prevent_default){
|
|
142
|
+
if (should_prevent_default) {
|
|
142
143
|
event.preventDefault();
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @param {FocusEvent} event
|
|
151
|
+
*/
|
|
152
|
+
#handleGlobalBlurEvent(event) {
|
|
153
|
+
// Element lost focus, we won't be able to capture key-up events
|
|
154
|
+
// release all keys
|
|
155
|
+
for (let keyName in KeyCodes) {
|
|
156
|
+
this.keys[keyName].release();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
147
160
|
/**
|
|
148
161
|
* Starts listening for keyboard events on the associated DOM element.
|
|
149
162
|
* @returns {void}
|
|
@@ -151,6 +164,7 @@ class KeyboardDevice {
|
|
|
151
164
|
start() {
|
|
152
165
|
this.domElement.addEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
|
|
153
166
|
this.domElement.addEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
|
|
167
|
+
window.addEventListener('blur', this.#handleGlobalBlurEvent);
|
|
154
168
|
}
|
|
155
169
|
|
|
156
170
|
/**
|
|
@@ -160,6 +174,7 @@ class KeyboardDevice {
|
|
|
160
174
|
stop() {
|
|
161
175
|
this.domElement.removeEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
|
|
162
176
|
this.domElement.removeEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
|
|
177
|
+
window.removeEventListener('blur', this.#handleGlobalBlurEvent);
|
|
163
178
|
}
|
|
164
179
|
|
|
165
180
|
}
|