MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Init3tButton

Method Init3tButton

ogsr_engine/xrGame/ui/UIXmlInit.cpp:356–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354}
355
356bool CUIXmlInit::Init3tButton(CUIXml& xml_doc, const char* path, int index, CUI3tButton* pWnd)
357{
358 R_ASSERT3(xml_doc.NavigateToNode(path, index), "XML node not found", path);
359
360 InitWindow(xml_doc, path, index, pWnd);
361 InitMultiText(xml_doc, path, index, pWnd);
362 InitMultiTexture(xml_doc, path, index, pWnd);
363 InitTextureOffset(xml_doc, path, index, pWnd);
364 InitSound(xml_doc, path, index, pWnd);
365
366 pWnd->EnableHeading(!!xml_doc.ReadAttribInt(path, index, "heading", 0));
367 pWnd->SetStretchTexture(!!xml_doc.ReadAttribInt(path, index, "stretch"));
368
369 LPCSTR accel = xml_doc.ReadAttrib(path, index, "accel", NULL);
370 if (accel)
371 {
372 int acc = keyname_to_dik(accel);
373 pWnd->SetAccelerator(acc, 0);
374 }
375 accel = xml_doc.ReadAttrib(path, index, "accel_ext", NULL);
376 if (accel)
377 {
378 int acc = keyname_to_dik(accel);
379 pWnd->SetAccelerator(acc, 1);
380 }
381
382 float shadowOffsetX = xml_doc.ReadAttribFlt(path, index, "shadow_offset_x", 0);
383 float shadowOffsetY = xml_doc.ReadAttribFlt(path, index, "shadow_offset_y", 0);
384
385 pWnd->SetShadowOffset(Fvector2().set(shadowOffsetX, shadowOffsetY));
386
387 // init hint static
388 string256 hint;
389 strconcat(sizeof(hint), hint, path, ":hint");
390
391 if (xml_doc.NavigateToNode(hint, index))
392 InitStatic(xml_doc, hint, index, &pWnd->m_hint);
393
394 int r = xml_doc.ReadAttribInt(path, index, "check_mode", -1);
395 if (r != -1)
396 pWnd->SetCheckMode((r == 1));
397
398 LPCSTR text_hint = xml_doc.ReadAttrib(path, index, "hint", NULL);
399 if (text_hint)
400 pWnd->m_hint_text = CStringTable().translate(text_hint);
401
402 return true;
403}
404
405bool CUIXmlInit::InitSound(CUIXml& xml_doc, const char* path, int index, CUI3tButton* pWnd)
406{

Callers 8

InitMethod · 0.45
CUIQuestionItemMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45
InitControlsMethod · 0.45
InitMethod · 0.45
InitMethod · 0.45

Calls 12

keyname_to_dikFunction · 0.85
CStringTableClass · 0.85
NavigateToNodeMethod · 0.80
ReadAttribIntMethod · 0.80
ReadAttribMethod · 0.80
SetAcceleratorMethod · 0.80
ReadAttribFltMethod · 0.80
SetCheckModeMethod · 0.80
EnableHeadingMethod · 0.45
SetStretchTextureMethod · 0.45
setMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected