Skip to content

Commit

Permalink
feat: use @wowserhq/[email protected] removing overrides (#19)
Browse files Browse the repository at this point in the history
* feat: use @wowserhq/[email protected] removing overrides
* chore: remove unused Vector2, Vector3 and Matrix4 overrides
* fix: correct Vector2 constructors to match Float32Array
* fix: use TypedArray.prototype.set directly to copy values
  • Loading branch information
timkurvers authored Jun 30, 2020
1 parent 77add91 commit cc3bbb2
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 97 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"wow"
],
"dependencies": {
"@wowserhq/math": "0.2.0",
"@wowserhq/math": "0.2.2",
"fengari": "0.1.4"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions src/math/Matrix4.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion src/math/Rect.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Rect {
this.maxX = maxX;
}

copy(other) {
set(other) {
this.minY = other.minY;
this.minX = other.minX;
this.maxY = other.maxY;
Expand Down
36 changes: 0 additions & 36 deletions src/math/Vector2.mjs

This file was deleted.

34 changes: 0 additions & 34 deletions src/math/Vector3.mjs

This file was deleted.

5 changes: 2 additions & 3 deletions src/math/index.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export { Matrix4, Vector2, Vector3 } from '@wowserhq/math';

export { default as EdgeRect } from './EdgeRect';
export { default as Matrix4 } from './Matrix4';
export { default as Rect } from './Rect';
export { default as Vector2 } from './Vector2';
export { default as Vector3 } from './Vector3';

export const EPSILON1 = 0.00000023841858;
export const EPSILON2 = 0.00000999999970;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/abstract/FramePoint/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class FramePoint {
constructor(relative, type, offsetX, offsetY) {
this.relative = relative;
this.type = type;
this.offset = new Vector2(offsetX, offsetY);
this.offset = new Vector2([offsetX, offsetY]);

// TODO: Is this value correct?
this.flags = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/components/abstract/LayoutFrame/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class LayoutFrame {
}

const rect = new Rect();
rect.copy(this.rect);
rect.set(this.rect);
return rect;
}

Expand Down Expand Up @@ -426,7 +426,7 @@ class LayoutFrame {
return true;
}

const prevRect = new Rect().copy(this.rect);
const prevRect = new Rect().set(this.rect);

this.rect.minY = rect.minY;
this.rect.minX = rect.minX;
Expand Down
24 changes: 12 additions & 12 deletions src/ui/components/simple/Texture/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class Texture extends Region {
this.shader = Device.instance.shaders.pixelShaderFor(ImageMode.UI);
this.texture = null;
this.textureCoords = [
new Vector2(0, 0),
new Vector2(0, 1),
new Vector2(1, 0),
new Vector2(1, 1),
new Vector2([0, 0]),
new Vector2([0, 1]),
new Vector2([1, 0]),
new Vector2([1, 1]),
];
this.tileHorizontally = false;
this.tileVertically = false;
Expand Down Expand Up @@ -177,10 +177,10 @@ class Texture extends Region {

if (valid) {
const coords = [
new Vector2(rect.left, rect.top),
new Vector2(rect.left, rect.bottom),
new Vector2(rect.right, rect.top),
new Vector2(rect.right, rect.bottom),
new Vector2([rect.left, rect.top]),
new Vector2([rect.left, rect.bottom]),
new Vector2([rect.right, rect.top]),
new Vector2([rect.right, rect.bottom]),
];

this.setTextureCoords(coords);
Expand Down Expand Up @@ -282,10 +282,10 @@ class Texture extends Region {
}

setTextureCoords(coords) {
this.textureCoords[0].copy(coords[0]);
this.textureCoords[1].copy(coords[1]);
this.textureCoords[2].copy(coords[2]);
this.textureCoords[3].copy(coords[3]);
this.textureCoords[0].set(coords[0]);
this.textureCoords[1].set(coords[1]);
this.textureCoords[2].set(coords[2]);
this.textureCoords[3].set(coords[3]);
}

draw(batch) {
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
filename: 'wowser-client-[chunkhash:8].js',
},
resolve: {
extensions: ['.js', '.mjs'],
extensions: ['.mjs', '.js'],
},
devtool: 'source-map',
plugins: [
Expand Down

0 comments on commit cc3bbb2

Please sign in to comment.