@woosh/meep-engine 2.111.8 → 2.111.10

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.111.8",
8
+ "version": "2.111.10",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -116,14 +116,21 @@ export class RowFirstTable {
116
116
  /**
117
117
  *
118
118
  * @param {Array.<number>} values
119
+ * @returns {number} index of newly added row
119
120
  */
120
- addRow(values: Array<number>): void;
121
+ addRow(values: Array<number>): number;
121
122
  /**
122
123
  *
123
124
  * @param {number} count number of rows to be added
124
125
  * @param {function(row_index:number, row:Array.<number>):*} valueSupplier supplier of row values, called with row index and an empty row to be filled
125
126
  */
126
127
  addRows(count: number, valueSupplier: any): void;
128
+ /**
129
+ * Copy a single row, value in the source row is unaffected
130
+ * @param {number} source
131
+ * @param {number} target
132
+ */
133
+ copyRow(source: number, target: number): void;
127
134
  /**
128
135
  * Copy data from another table. Specs must match.
129
136
  * NOTE: does not send onAdded signal
@@ -1 +1 @@
1
- {"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AAMA;;GAEG;AACH;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAuDjB;IA/CG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,gBAFU,qBAAsB,CAET;IAEvB;;;OAGG;IACH,MAFU,WAAW,CAEuB;IAE5C;;;OAGG;IACH,gBAFU,MAAM,CAEyB;IAEzC;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf;;;OAGG;IACH,UAFU,MAAM,CAEC;IAEjB;;;OAGG;IACH,UAFU,QAAQ,CAEE;IAEpB;;MAEC;IAKL;;OAEG;IACH,mBAiBC;IAXG;;;OAGG;IACH,sBAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEb;IAEvC;;;OAGG;IACH,uBAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEX;IAG7C;;;;OAIG;IACH,uDAMC;IAED;;;OAGG;IACH,QAFa,MAAM,CA4BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QA+ChB;IAED;;OAEG;IACH,aAEC;IAED;;;OAGG;IACH,iBAFW,MAAM,QAchB;IAED;;;;;OAKG;IACH,yBAJW,MAAM,eACN,MAAM,SACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,eACN,MAAM,GACJ,MAAM,CAclB;IAED;;;;OAIG;IACH,kBAHW,MAAM,YACN,MAAM,QAyBhB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,YACN,MAAM,QAqBhB;IAED;;;OAGG;IACH,eAFW,MAAO,MAAM,CAAC,QAexB;IAED;;;;OAIG;IACH,eAHW,MAAM,4BAoChB;IAED;;;;OAIG;IACH,YAFW,aAAa,QAsBvB;IAED;;;OAGG;IACH,cAHW,aAAa,GACX,OAAO,CAyBnB;IAED;;;;OAIG;IACH,wCAIC;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,EAAE,QAMlB;IAED;;OAEG;IACH,qBA4BC;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,wBAEC;IAED;;;OAGG;IACH,cAFa,MAAM,EAAE,EAAE,CAgBtB;IAED;;OAEG;IACH,uBAIC;CACJ;mBA3gBkB,+BAA+B"}
1
+ {"version":3,"file":"RowFirstTable.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTable.js"],"names":[],"mappings":"AAMA;;GAEG;AACH;IACI;;;;;OAKG;IACH,oDAHW,OAAO,EAuDjB;IA/CG;;;OAGG;IACH,wBAAgB;IAEhB;;;OAGG;IACH,gBAFU,qBAAsB,CAET;IAEvB;;;OAG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tB;IAED;;OAEG;IACH,uBAIC;CACJ;mBA3iBkB,+BAA+B"}
@@ -142,7 +142,7 @@ export class RowFirstTable {
142
142
  setCapacity(rowCount) {
143
143
  assert.isNonNegativeInteger(rowCount, 'rowCount');
144
144
 
145
- if(this.capacity === rowCount){
145
+ if (this.capacity === rowCount) {
146
146
  // already right size
147
147
  return;
148
148
  }
@@ -311,6 +311,7 @@ export class RowFirstTable {
311
311
  /**
312
312
  *
313
313
  * @param {Array.<number>} values
314
+ * @returns {number} index of newly added row
314
315
  */
315
316
  addRow(values) {
316
317
 
@@ -325,6 +326,8 @@ export class RowFirstTable {
325
326
  this.writeRowMethod(this.dataView, this.bytesPerRecord * rowIndex, values);
326
327
 
327
328
  this.on.added.send2(rowIndex, values);
329
+
330
+ return rowIndex;
328
331
  }
329
332
 
330
333
  /**
@@ -367,6 +370,35 @@ export class RowFirstTable {
367
370
 
368
371
  }
369
372
 
373
+ /**
374
+ * Copy a single row, value in the source row is unaffected
375
+ * @param {number} source
376
+ * @param {number} target
377
+ */
378
+ copyRow(source, target) {
379
+ assert.isNonNegativeInteger(source, 'source');
380
+ assert.isNonNegativeInteger(target, 'target');
381
+
382
+ if (source === target) {
383
+ // no operation
384
+ return;
385
+ }
386
+
387
+ // figure out addresses
388
+ const bytes_per_record = this.bytesPerRecord;
389
+
390
+ const source_address = source * bytes_per_record;
391
+ const target_address = target * bytes_per_record;
392
+
393
+ const data_view = this.dataView;
394
+
395
+ for (let i = 0; i < bytes_per_record; i++) {
396
+ const v = data_view.getUint8(source_address + i);
397
+
398
+ data_view.setUint8(target_address + i, v);
399
+ }
400
+ }
401
+
370
402
  /**
371
403
  * Copy data from another table. Specs must match.
372
404
  * NOTE: does not send onAdded signal
@@ -429,7 +461,7 @@ export class RowFirstTable {
429
461
  * @param {Array} result where row values are to be stored
430
462
  */
431
463
  getRow(index, result) {
432
- assert.isNonNegativeInteger(index,'index');
464
+ assert.isNonNegativeInteger(index, 'index');
433
465
 
434
466
  this.readRowMethod(this.dataView, this.bytesPerRecord * index, result);
435
467
  }
@@ -440,7 +472,7 @@ export class RowFirstTable {
440
472
  * @param {number[]} record
441
473
  */
442
474
  setRow(index, record) {
443
- assert.isNonNegativeInteger(index,'index');
475
+ assert.isNonNegativeInteger(index, 'index');
444
476
 
445
477
  this.writeRowMethod(this.dataView, this.bytesPerRecord * index, record);
446
478
  }