1 /** 2 * @class text2d 3 * @extends component 4 * @description 5 * Component that can be used to draw high-quality text on-screen. 6 * 7 */ 8 function text2d() { 9 10 /** 11 * Returns the pixel position of the i'th character 12 * in the stored string. 13 * 14 * Often, it is useful to get the extents of the the text that you wish to render. 15 * This will tell you at what pixel offset from the text2d node's position the character's 16 * top-left corner will be. The first character is always (0, 0). 17 * @param {Number} i The index of the character to get the position of. 18 * @returns {vector} The position 19 */ 20 this.getCharPosition = function(){}; 21 22 /** 23 * Returns the bounding box dimensions 24 * of the rendered text in pixels. 25 * @returns {vector} 26 */ 27 this.getDimensions = function(){}; 28 29 30 31 32 /** 33 * Color of the text. 34 * @type {color} 35 */ 36 this.color = {}; 37 38 /** 39 * The Text to display. 40 * @type {String} 41 */ 42 this.text = ""; 43 44 /** 45 * The size of the font, in "points" 46 * @type {Number} 47 */ 48 this.fontSize = 0.0; 49 50 51 /** 52 * See {@link sandboxe.text2d.spacingMode} 53 * @type {Number} 54 */ 55 this.spacingMode = 0; 56 57 58 /** 59 * The font asset to use. See {@link snadboxe.assets.load} 60 * @type {asset} 61 */ 62 this.font = {}; 63 64 65 /** 66 * The rendering mode. See {@link sandboxe.render2d.renderMode} 67 * @type {Number} 68 */ 69 this.mode = 0; 70 71 72 /** 73 * Whether the shape should be drawn using the absolute positions 74 * of its geometry. If absolute, node information is ignored. 75 * @type {Boolean} 76 */ 77 this.absolute = false; 78 79 80 /** 81 * The transform of the shape component. 82 * @type {transform} 83 */ 84 this.node = {}; 85 86 87 88 89 return this; 90 } 91