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

Function debugText

src/engineDebug.js:205–220  ·  view source on GitHub ↗

Draw debug text in world space * @param {string|number} text * @param {Vector2} pos * @param {number} [size] * @param {Color|string} [color] * @param {number} [time] * @param {number} [angle] * @param {string} [font] * @param {boolean} [screenSpace] * @memberof Debug

(text, pos, size=1, color=WHITE, time=0, angle=0, font='monospace', screenSpace=false)

Source from the content-addressed store, hash-verified

203 * @param {boolean} [screenSpace]
204 * @memberof Debug */
205function debugText(text, pos, size=1, color=WHITE, time=0, angle=0, font='monospace', screenSpace=false)
206{
207 ASSERT(isStringLike(text), 'text must be a string');
208 ASSERT(isVector2(pos), 'pos must be a vec2');
209 ASSERT(isNumber(size), 'size must be a number');
210 ASSERT(isStringLike(color) || isColor(color), 'color is invalid');
211 ASSERT(isNumber(time), 'time must be a number');
212 ASSERT(isNumber(angle), 'angle must be a number');
213 ASSERT(isStringLike(font), 'font must be a string');
214
215 if (isColor(color))
216 color = color.toString();
217 pos = pos.copy();
218 const timer = new Timer(time);
219 debugPrimitives.push({text, pos, size, color, timer, angle, font, screenSpace});
220}
221
222/** Clear all debug primitives in the list
223 * @memberof Debug */

Callers 3

debugRenderFunction · 0.70
gameUpdateFunction · 0.50
updateMethod · 0.50

Calls 7

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

Tested by

no test coverage detected