tslint changes

This commit is contained in:
Jeremy Simpson
2019-08-30 01:52:40 -07:00
parent 7603879d35
commit 7f7efbb94b
446 changed files with 70650 additions and 70661 deletions
+26 -26
View File
@@ -2,69 +2,69 @@ import { tileWidth, tileHeight, tileElevation } from './constants';
import { Point, Rect } from './interfaces';
export function toScreenX(x: number) {
return Math.floor(x * tileWidth) | 0;
return Math.floor(x * tileWidth) | 0;
}
export function toScreenY(y: number) {
return Math.floor(y * tileHeight) | 0;
return Math.floor(y * tileHeight) | 0;
}
export function toScreenYWithZ(y: number, z: number) {
return Math.floor(y * tileHeight - z * tileElevation) | 0;
return Math.floor(y * tileHeight - z * tileElevation) | 0;
}
export function toWorldX(x: number) {
return x / tileWidth;
return x / tileWidth;
}
export function toWorldY(y: number) {
return y / tileHeight;
return y / tileHeight;
}
export function toWorldZ(z: number) {
return z / tileElevation;
return z / tileElevation;
}
export function pointToScreen({ x, y }: Point): Point {
return {
x: toScreenX(x),
y: toScreenY(y),
};
return {
x: toScreenX(x),
y: toScreenY(y),
};
}
export function pointToWorld({ x, y }: Point): Point {
return {
x: toWorldX(x),
y: toWorldY(y),
};
return {
x: toWorldX(x),
y: toWorldY(y),
};
}
export function rectToScreen({ x, y, w, h }: Rect): Rect {
return {
x: toScreenX(x),
y: toScreenY(y),
w: toScreenX(w),
h: toScreenY(h),
};
return {
x: toScreenX(x),
y: toScreenY(y),
w: toScreenX(w),
h: toScreenY(h),
};
}
export function roundPositionX(x: number) {
return Math.floor(x * tileWidth) / tileWidth;
return Math.floor(x * tileWidth) / tileWidth;
}
export function roundPositionY(y: number) {
return Math.floor(y * tileHeight) / tileHeight;
return Math.floor(y * tileHeight) / tileHeight;
}
export function roundPositionXMidPixel(x: number) {
return (Math.floor(x * tileWidth) + 0.5) / tileWidth;
return (Math.floor(x * tileWidth) + 0.5) / tileWidth;
}
export function roundPositionYMidPixel(y: number) {
return (Math.floor(y * tileHeight) + 0.5) / tileHeight;
return (Math.floor(y * tileHeight) + 0.5) / tileHeight;
}
export function roundPosition(point: Point) {
point.x = roundPositionX(point.x);
point.y = roundPositionY(point.y);
point.x = roundPositionX(point.x);
point.y = roundPositionY(point.y);
}