MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / createTooltip

Method createTooltip

source/frontend/StarMerchantInterface.cpp:127–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127PanePtr MerchantPane::createTooltip(Vec2I const& screenPosition) {
128 if (m_tabSet->selectedTab() == 0) {
129 for (size_t i = 0; i < m_itemGuiList->numChildren(); ++i) {
130 auto entry = m_itemGuiList->itemAt(i);
131 if (entry->getChildAt(screenPosition)) {
132 auto itemConfig = m_itemList.get(i);
133 ItemPtr item = Root::singleton().itemDatabase()->itemShared(ItemDescriptor(itemConfig.get("item")));
134 return ItemTooltipBuilder::buildItemTooltip(item, m_player);
135 }
136 }
137 } else {
138 if (auto item = m_itemGrid->itemAt(screenPosition))
139 return ItemTooltipBuilder::buildItemTooltip(item, m_player);
140 }
141 return {};
142}
143
144void MerchantPane::update(float dt) {
145 Pane::update(dt);

Callers

nothing calls this directly

Calls 9

singletonClass · 0.85
ItemDescriptorClass · 0.85
selectedTabMethod · 0.80
numChildrenMethod · 0.80
itemSharedMethod · 0.80
itemDatabaseMethod · 0.80
itemAtMethod · 0.45
getChildAtMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected