RenderingContext:draw_number()
RenderingContext:draw_number(param_table)
RenderingContext:draw_number(value[, x[, y[, width[, height[, horizontal_alignment[, vertical_alignment]]]]]])
This method renders a formated string of a numeric value using the font and brush set in the rendering context.
Parameters
Parameter | Type | Description |
---|---|---|
param_table | table | This parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section. |
value | number | Numeric value to be rendered. |
x | number | The size of the bounding box in which the text is drawn. It specifies the X-coordinate of the top-left corner of the bounding box. The default value is 0. |
y | number | The size of the bounding box in which the text is drawn. It specifies the Y-coordinate of the top-left corner of the bounding box. The default value is 0. |
width | number | The width of the bounding box in which the text is drawn. The default value is positive infinity. |
height | number | The height of the bounding box in which the text is drawn. The default value is positive infinity. |
horizontal_alignment | string | Specifies how to horizontally align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of left , center , or right .The default is left . |
vertical_alignment | string | Specifies how to vertically align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of top , center , or bottom .The default is top . |
Parameters Table
Key | Type | Description |
---|---|---|
value | number | Numeric value to be rendered. |
x | number | The size of the bounding box in which the text is drawn. It specifies the X-coordinate of the top-left corner of the bounding box. The default value is 0. |
y | number | The size of the bounding box in which the text is drawn. It specifies the Y-coordinate of the top-left corner of the bounding box. The default value is 0. |
width | number | The width of the bounding box in which the text is drawn. The default value is positive infinity. |
height | number | The height of the bounding box in which the text is drawn. The default value is positive infinity. |
horizontal_alignment | string | Specifies how to horizontally align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of left , center , or right .The default is left . |
vertical_alignment | string | Specifies how to vertically align the rendering result within the bounding box specified by the x , y , width , and height parameters.It specifies either of top , center , or bottom .The default is top . |
precision | number | The overall precision, i.e., number of digits including both the integer and fractional parts. If this parameter is omitted, there is no constraint on precision. |
fraction_precision | number | Precision of the fractional part. If this parameter is omitted, there is no constraint on the precision of the fractional part. |
leading_zero | boolean | Specification of whether to pad the leading zeros if the number of digits is less than the specified precision. If true is specified for this parameter, leading zeros will be padded.The default is false . |
Note
If the font set in the rendering context is a BitmapFont
object, text wrapping and alignment changes within the bounding box are not possible.
The following parameters are ignored for BitmapFont
objects.
width
height
horizontal_alignment
vertical_alignment
Return Values
This method doesn't return any value.