Add some more WebGl

This commit is contained in:
schmelczerandras 2020-07-20 21:58:31 +02:00
parent c9b924d228
commit 066314ede8
23 changed files with 462 additions and 199 deletions

View file

@ -0,0 +1,21 @@
import { Typed } from '../transport/serializable';
import { Vec2 } from './vec2';
export class Rectangle extends Typed {
public constructor(
public topLeft: Vec2 = new Vec2(),
public size: Vec2 = new Vec2()
) {
super();
}
public isInside(position: Vec2): boolean {
const translated = position.subtract(this.topLeft);
return (
0 <= translated.x &&
translated.x < this.size.x &&
0 <= translated.y &&
translated.y < this.size.y
);
}
}