MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SetText

Method SetText

engine/Poseidon/UI/Controls/UIControls3D.cpp:220–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218 _textCls = &cls; // set after SetText since SetText clears it
219}
220
221void C3DStatic::SetText(RString text)
222{
223 const int type = _style & ST_TYPE;
224 const RString visibleText = type == ST_PICTURE ? text : Decode3DControlText(text);
225 if (!strcmp(_text, visibleText))
226 {
227 return;
228 }
229
230 _textCls = nullptr; // diverged from resource template
231 _text = visibleText;
232 if (type == ST_PICTURE)
233 {
234 const std::filesystem::path path = Poseidon::FilesystemPathFromUtf8(text.Data());
235 if (!path.is_absolute() || !Poseidon::FileExistsUtf8(text))
236 {
237 text = Poseidon::FindPicture(text);
238 text.Lower();
239 }
240 _texture = GlobLoadTexture(text);
241 if (_texture)
242 {
243 _texture->SetMaxSize(1024); // no limits
244 }
245 }
246 else if (type == ST_MULTI)
247 {
248 FormatText();

Callers 1

UpdateSortCaretFunction · 0.45

Calls 5

Decode3DControlTextFunction · 0.85
FindPictureFunction · 0.85
GlobLoadTextureFunction · 0.85
LowerMethod · 0.80
SetMaxSizeMethod · 0.80

Tested by

no test coverage detected