Add some more WebGl
This commit is contained in:
parent
c9b924d228
commit
066314ede8
23 changed files with 462 additions and 199 deletions
21
frontend/src/scripts/math/rectangle.ts
Normal file
21
frontend/src/scripts/math/rectangle.ts
Normal 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
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue