Setup formatting

This commit is contained in:
schmelczerandras 2020-10-07 16:40:21 +02:00
parent d34f25295c
commit dd850d11d1
45 changed files with 230 additions and 190 deletions

View file

@ -36,8 +36,8 @@ export class TouchListener extends CommandGenerator {
this.sendCommandToSubcribers(
new MoveActionCommand(
vec2.subtract(vec2.create(), position, this.previousPosition)
)
vec2.subtract(vec2.create(), position, this.previousPosition),
),
);
this.previousPosition = position;
@ -49,7 +49,7 @@ export class TouchListener extends CommandGenerator {
event.touches,
(center: vec2, touch: Touch) =>
vec2.add(center, center, vec2.fromValues(-touch.clientX, touch.clientY)),
vec2.create()
vec2.create(),
);
return vec2.scale(center, center, 1 / event.touches.length);

View file

@ -70,7 +70,7 @@ export class Game {
new MouseListener(this.canvas),
new TouchListener(this.canvas),
],
[this.gameObjects, new CommandReceiverSocket(this.socket)]
[this.gameObjects, new CommandReceiverSocket(this.socket)],
);
}
@ -105,7 +105,7 @@ export class Game {
shadowTraceCount: 16,
paletteSize: 10,
enableStopwatch: true,
}
},
);
this.renderer.setRuntimeSettings({
@ -151,7 +151,7 @@ export class Game {
// todo: Should only send aspect ratio
this.socket.emit(
TransportEvents.PlayerToServer,
serialize(new SetViewAreaActionCommand(this.gameObjects.camera.viewArea))
serialize(new SetViewAreaActionCommand(this.gameObjects.camera.viewArea)),
);
}

View file

@ -6,7 +6,7 @@ export class DeltaTimeCalculator {
}
public getNextDeltaTimeInMilliseconds(
currentTime: DOMHighResTimeStamp
currentTime: DOMHighResTimeStamp,
): DOMHighResTimeStamp {
if (this.previousTime === null) {
this.previousTime = currentTime;

View file

@ -23,12 +23,12 @@ export class Camera extends GameObject {
this._viewArea.topLeft = vec2.fromValues(
this.center.x - this._viewArea.size.x / 2,
this.center.y + this._viewArea.size.y / 2
this.center.y + this._viewArea.size.y / 2,
);
this._viewArea.size = vec2.fromValues(
Math.sqrt(Camera.inViewAreaSize * canvasAspectRatio),
Math.sqrt(Camera.inViewAreaSize / canvasAspectRatio)
Math.sqrt(Camera.inViewAreaSize / canvasAspectRatio),
);
c.renderer.setViewArea(this._viewArea.topLeft, this._viewArea.size);

View file

@ -26,7 +26,7 @@ export class GameObjectContainer extends CommandReceiver {
this.addObject(this.camera);
},
[StepCommand.type]: (c: StepCommand) => {
[StepCommand.type]: (_: StepCommand) => {
if (this.player) {
this.camera.center = this.player.position;
}

View file

@ -115,12 +115,12 @@ export class BlobShape extends Drawable {
leftFootCenter: vec2.transformMat2d(
vec2.create(),
this.leftFoot.center,
transform2d
transform2d,
),
rightFootCenter: vec2.transformMat2d(
vec2.create(),
this.rightFoot.center,
transform2d
transform2d,
),
headRadius: this.head.radius * transform1d,
footRadius: this.leftFoot.radius * transform1d,