MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / setTopicEntries

Method setTopicEntries

src/ui/MenuItemScrollableText.cpp:87–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void UI::MenuItemTypes::MenuItemScrollableText::setTopicEntries(std::vector<std::string>& entries)
88{
89 Daedalus::GEngineClasses::C_Menu_Item& item = getItemScriptData();
90 const UI::zFont* fnt = m_Engine.getFontCache().getFont(item.fontName);
91
92 if (!fnt)
93 return;
94
95 // Because the content viewer view instance is reused for
96 // each topic entries we have to clear all entries first
97 m_FormattedEntries.clear();
98 m_NumberOfFormattedEntries = 0;
99 m_FirstDrawnLine = 0;
100
101 for (unsigned int i = 0; i < entries.size(); i++)
102 {
103 std::vector<std::string> text = fnt->layoutText(entries.at(i), 500);
104 m_NumberOfFormattedEntries += text.size();
105 m_FormattedEntries.push_back(std::move(text));
106
107 // Add line separator not to the last entry
108 if (i + 1 < entries.size())
109 {
110 std::vector<std::string> sep;
111 sep.push_back("---");
112 m_NumberOfFormattedEntries += sep.size();
113 m_FormattedEntries.push_back(std::move(sep));
114 }
115 }
116}
117
118void UI::MenuItemTypes::MenuItemScrollableText::scrollDown()
119{

Callers 1

onInputActionMethod · 0.80

Calls 6

getFontMethod · 0.80
layoutTextMethod · 0.80
atMethod · 0.80
push_backMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected