Draw text in world space using the image font * @param {string|number} text * @param {Vector2} pos * @param {Vector2|number} [size] * @param {boolean} [center=true] * @param {Color} [color=WHITE] * @param {boolean} [useWebGL=glEnable] * @param {CanvasRenderi
(text, pos, size=1, center, color, useWebGL, context)
| 1328 | * @param {CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D} [context] |
| 1329 | */ |
| 1330 | drawText(text, pos, size=1, center, color, useWebGL, context) |
| 1331 | { |
| 1332 | ASSERT(isVector2(size) || typeof size === 'number', 'size must be a vec2 or number'); |
| 1333 | |
| 1334 | if (typeof size === 'number') |
| 1335 | { |
| 1336 | // if size is a number, make it a vector |
| 1337 | ASSERT(size > 0); |
| 1338 | size *= cameraScale; |
| 1339 | size = new Vector2(size, size); |
| 1340 | } |
| 1341 | else |
| 1342 | size = size.scale(cameraScale); |
| 1343 | this.drawTextScreen(text, worldToScreen(pos), size, center, color, useWebGL, context); |
| 1344 | } |
| 1345 | |
| 1346 | /** Draw text in screen space using the image font |
| 1347 | * @param {string|number} text |
no test coverage detected