Remove twgl

This commit is contained in:
schmelczerandras 2020-07-19 22:15:18 +02:00
parent 13942af41c
commit ac66c91000
16 changed files with 364 additions and 154 deletions

View file

@ -1,23 +1,22 @@
import { GameObject } from '../game-object';
import { DrawCommand } from '../../commands/types/draw';
import { Vec2 } from '../../math/vec2';
import { MoveToCommand } from '../../commands/types/move-to';
export class Camera extends GameObject {
private inViewWidth = 1500;
constructor() {
super();
this._boundingBoxSize = new Vec2(1200, 800);
this.addCommandExecutor(DrawCommand, this.draw.bind(this));
this.addCommandExecutor(MoveToCommand, this.moveTo.bind(this));
}
private draw(e: DrawCommand) {
e.drawer.setCameraPosition(this.position);
e.drawer.setViewBoxSize(this.boundingBoxSize);
private draw(c: DrawCommand) {
c.drawer.setCameraPosition(this.position);
this._boundingBoxSize = c.drawer.setInViewWidth(this.inViewWidth);
}
private moveTo(e: MoveToCommand) {
this._position = e.position;
private moveTo(c: MoveToCommand) {
this._position = c.position;
}
}

View file

@ -17,6 +17,6 @@ export class InfoText extends GameObject {
private draw(e: DrawCommand) {
let text = '';
InfoText.records.forEach((v, k) => (text += `${k}\n\t${v}\n`));
e.drawer.drawCornerText(text);
e.drawer.drawInfoText(text);
}
}