| 88 | * @category Objects > Text |
| 89 | */ |
| 90 | export class TextRuntimeObject |
| 91 | extends gdjs.RuntimeObject |
| 92 | implements gdjs.TextContainer, gdjs.OpacityHandler |
| 93 | { |
| 94 | _characterSize: number; |
| 95 | _fontName: string; |
| 96 | _bold: boolean; |
| 97 | _italic: boolean; |
| 98 | _underlined: boolean; |
| 99 | _color: integer[]; |
| 100 | _useGradient: boolean = false; |
| 101 | _gradient: Array<Array<integer>> = []; |
| 102 | _gradientType: string = ''; |
| 103 | opacity: float = 255; |
| 104 | _textAlign: string; |
| 105 | _verticalTextAlignment: string; |
| 106 | _wrapping: boolean = false; |
| 107 | // A wrapping of 1 makes games crash on Firefox |
| 108 | _wrappingWidth: float = 100; |
| 109 | |
| 110 | _isOutlineEnabled: boolean; |
| 111 | _outlineThickness: float; |
| 112 | _outlineColor: integer[]; |
| 113 | |
| 114 | _shadow: boolean; |
| 115 | _shadowColor: integer[]; |
| 116 | _shadowOpacity: float; |
| 117 | _shadowDistance: float; |
| 118 | _shadowAngle: float; |
| 119 | _shadowBlur: float; |
| 120 | |
| 121 | _lineHeight: float; |
| 122 | |
| 123 | _padding: integer = 5; |
| 124 | _str: string; |
| 125 | _renderer: gdjs.TextRuntimeObjectRenderer; |
| 126 | |
| 127 | // We can store the scale as nothing else can change it. |
| 128 | _scaleX: number = 1; |
| 129 | _scaleY: number = 1; |
| 130 | |
| 131 | /** |
| 132 | * @param instanceContainer The container the object belongs to. |
| 133 | * @param textObjectData The initial properties of the object |
| 134 | */ |
| 135 | constructor( |
| 136 | instanceContainer: gdjs.RuntimeInstanceContainer, |
| 137 | textObjectData: TextObjectData, |
| 138 | instanceData?: InstanceData |
| 139 | ) { |
| 140 | super(instanceContainer, textObjectData, instanceData); |
| 141 | const content = textObjectData.content; |
| 142 | this._characterSize = Math.max(1, content.characterSize); |
| 143 | this._fontName = content.font; |
| 144 | this._bold = content.bold; |
| 145 | this._italic = content.italic; |
| 146 | this._underlined = content.underlined; |
| 147 | this._color = gdjs.rgbOrHexToRGBColor(content.color); |
nothing calls this directly
no outgoing calls
no test coverage detected