MCPcopy
hub / github.com/KilledByAPixel/LittleJS / debugPoly

Function debugPoly

src/engineDebug.js:101–115  ·  view source on GitHub ↗

Draw a debug poly in world space * @param {Vector2} pos * @param {Array } points * @param {Color|string} [color] * @param {number} [time] * @param {number} [angle] * @param {boolean} [fill] * @param {boolean} [screenSpace] * @memberof Debug

(pos, points, color=WHITE, time=0, angle=0, fill=false, screenSpace=false)

Source from the content-addressed store, hash-verified

99 * @param {boolean} [screenSpace]
100 * @memberof Debug */
101function debugPoly(pos, points, color=WHITE, time=0, angle=0, fill=false, screenSpace=false)
102{
103 ASSERT(isVector2(pos), 'pos must be a vec2');
104 ASSERT(isArray(points), 'points must be an array');
105 ASSERT(isStringLike(color) || isColor(color), 'color is invalid');
106 ASSERT(isNumber(time), 'time must be a number');
107 ASSERT(isNumber(angle), 'angle must be a number');
108
109 if (isColor(color))
110 color = color.toString();
111 pos = pos.copy();
112 points = points.map(p=>p.copy());
113 const timer = new Timer(time);
114 debugPrimitives.push({pos, points, color, timer, angle, fill, screenSpace});
115}
116
117/** Draw a debug circle in world space
118 * @param {Vector2} pos

Callers 1

updateMethod · 0.50

Calls 8

isVector2Function · 0.85
isArrayFunction · 0.85
isStringLikeFunction · 0.85
isColorFunction · 0.85
isNumberFunction · 0.85
ASSERTFunction · 0.70
toStringMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected