mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-11 09:11:50 +00:00
Move beginCircle to polyfills.ts
Technically not a polyfill, but neither are two existing functions in polyfills.ts.
This commit is contained in:
parent
a84837d913
commit
0670110593
@ -9,19 +9,6 @@ import { Rectangle } from "./rectangle";
|
|||||||
|
|
||||||
const logger = createLogger("draw_utils");
|
const logger = createLogger("draw_utils");
|
||||||
|
|
||||||
export function initDrawUtils() {
|
|
||||||
CanvasRenderingContext2D.prototype.beginCircle = function (x, y, r) {
|
|
||||||
this.beginPath();
|
|
||||||
|
|
||||||
if (r < 0.05) {
|
|
||||||
this.rect(x, y, 1, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.arc(x, y, r, 0, 2.0 * Math.PI);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {object} param0
|
* @param {object} param0
|
||||||
|
|||||||
@ -7,3 +7,15 @@ Math.radians = function (degrees: number): number {
|
|||||||
Math.degrees = function (radians: number): number {
|
Math.degrees = function (radians: number): number {
|
||||||
return (radians * 180.0) / Math.PI;
|
return (radians * 180.0) / Math.PI;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Begins a path and draws a circle.
|
||||||
|
CanvasRenderingContext2D.prototype.beginCircle = function (x: number, y: number, r: number): void {
|
||||||
|
this.beginPath();
|
||||||
|
|
||||||
|
if (r < 0.05) {
|
||||||
|
this.rect(x, y, 1, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.arc(x, y, r, 0, 2.0 * Math.PI);
|
||||||
|
};
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import "./mods/modloader";
|
|||||||
|
|
||||||
import { Application } from "./application";
|
import { Application } from "./application";
|
||||||
import { IS_DEBUG } from "./core/config";
|
import { IS_DEBUG } from "./core/config";
|
||||||
import { initDrawUtils } from "./core/draw_utils";
|
|
||||||
import { createLogger, logSection } from "./core/logging";
|
import { createLogger, logSection } from "./core/logging";
|
||||||
import { initComponentRegistry } from "./game/component_registry";
|
import { initComponentRegistry } from "./game/component_registry";
|
||||||
import { initGameModeRegistry } from "./game/game_mode_registry";
|
import { initGameModeRegistry } from "./game/game_mode_registry";
|
||||||
@ -43,7 +42,6 @@ console.log("%cDEVCODE BUILT IN", "color: #f77");
|
|||||||
|
|
||||||
logSection("Boot Process", "#f9a825");
|
logSection("Boot Process", "#f9a825");
|
||||||
|
|
||||||
initDrawUtils();
|
|
||||||
initComponentRegistry();
|
initComponentRegistry();
|
||||||
initItemRegistry();
|
initItemRegistry();
|
||||||
initMetaBuildingRegistry();
|
initMetaBuildingRegistry();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user