Update deps
This commit is contained in:
parent
764cd8344d
commit
d35a68caf3
4 changed files with 813 additions and 725 deletions
|
@ -13,7 +13,7 @@ export class EntityView {
|
|||
const tile = await loadImage(`resources/sprite/entity/${data.sprite}.png`);
|
||||
|
||||
const [texture, size] = mkTexture(r, tile);
|
||||
const frameSize = [size[0], size[1] / data.frames];
|
||||
const frameSize: [number, number] = [size[0], size[1] / data.frames];
|
||||
|
||||
const offset = vec2.mul(vec2.create(), frameSize, data.anchor);
|
||||
r.snapToGrid(offset, offset);
|
||||
|
|
|
@ -49,11 +49,11 @@ export class Renderer {
|
|||
return this.shaders.samplerLoc;
|
||||
}
|
||||
|
||||
public setCenter(v: vec2 | number[]): void {
|
||||
public setCenter(v: vec2): void {
|
||||
this.snapToGrid(this.center, v);
|
||||
}
|
||||
|
||||
public setTranslation(v: vec2 | number[]): void {
|
||||
public setTranslation(v: vec2): void {
|
||||
vec2.sub(this.translation, v, this.center);
|
||||
this.snapToGrid(this.translation, this.translation);
|
||||
this.gl.uniform2fv(this.shaders.translateLoc, this.translation);
|
||||
|
@ -65,7 +65,7 @@ export class Renderer {
|
|||
this.setTranslation([0, 0]);
|
||||
}
|
||||
|
||||
public snapToGrid(out: vec2, a: vec2 | number[]): void {
|
||||
public snapToGrid(out: vec2, a: vec2): void {
|
||||
vec2.scale(out, a, this.coordScale);
|
||||
vec2.round(out, out);
|
||||
vec2.scale(out, out, 1 / this.coordScale);
|
||||
|
|
Reference in a new issue