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

Method CButton

engine/Poseidon/UI/Controls/UIControls.cpp:2206–2234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2204 }
2205
2206 char temp[8];
2207 p = _text + CopyTextElement(_text, static_cast<int>(q - (const char*)_text), _font->GetLangID(), temp,
2208 sizeof(temp));
2209 width += GLOB_ENGINE->GetTextWidth(size, _font, temp);
2210
2211 if (width > lineWidth)
2212 {
2213 if (n > 0)
2214 {
2215 p = word;
2216 }
2217 else
2218 {
2219 p = q;
2220 }
2221 _lines.Add(p - (const char*)_text);
2222 break;
2223 }
2224 }
2225 }
2226}
2227
2228CButton::CButton(ControlsContainer* parent, const ParamEntry& cls, float x, float y, float w, float h)
2229 : Control(parent, CT_BUTTON, cls >> "idc", cls >> "style", x, y, w, h)
2230{
2231 _text = DecodeControlText(cls >> "text");
2232 _ftColor = GetPackedColor(cls >> "colorText");
2233 _font = GLOB_ENGINE->LoadFont(GetFontID(cls >> "font"));
2234 const ParamEntry* entry = cls.FindEntry("size");
2235 if (entry)
2236 {
2237 _size = (float)(*entry) * _font->Height();

Callers

nothing calls this directly

Calls 7

DecodeControlTextFunction · 0.85
GetPackedColorFunction · 0.85
GetFontIDFunction · 0.85
GetValueFunction · 0.85
LoadFontMethod · 0.45
FindEntryMethod · 0.45
HeightMethod · 0.45

Tested by

no test coverage detected