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

Function debugRect

src/engineDebug.js:78–90  ·  view source on GitHub ↗

Draw a debug rectangle in world space * @param {Vector2} pos * @param {Vector2} [size=vec2(0)] * @param {Color|string} [color] * @param {number} [time] * @param {number} [angle] * @param {boolean} [fill] * @param {boolean} [screenSpace] * @memberof Debug

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

Source from the content-addressed store, hash-verified

76 * @param {boolean} [screenSpace]
77 * @memberof Debug */
78function debugRect(pos, size=vec2(), color=WHITE, time=0, angle=0, fill=false, screenSpace=false)
79{
80 ASSERT(isVector2(pos), 'pos must be a vec2');
81 ASSERT(isVector2(size), 'size must be a vec2');
82 ASSERT(isStringLike(color) || isColor(color), 'color is invalid');
83 ASSERT(isNumber(time), 'time must be a number');
84 ASSERT(isNumber(angle), 'angle must be a number');
85
86 if (isColor(color))
87 color = color.toString();
88 const timer = new Timer(time);
89 debugPrimitives.push({pos:pos.copy(), size:size.copy(), color, timer, angle, fill, screenSpace});
90}
91
92/** Draw a debug poly in world space
93 * @param {Vector2} pos

Callers 15

debugPointFunction · 0.70
debugLineFunction · 0.70
debugOverlapFunction · 0.70
debugRenderFunction · 0.70
engineObjectsRaycastFunction · 0.70
collisionRaycastMethod · 0.70
updateMethod · 0.70
updateMethod · 0.70
renderMethod · 0.70
updatePhysicsMethod · 0.70
renderDebugInfoMethod · 0.70
boxCastAllMethod · 0.50

Calls 8

vec2Function · 0.85
isVector2Function · 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