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)
| 203 | * @param {boolean} [screenSpace] |
| 204 | * @memberof Debug */ |
| 205 | function 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 */ |