void MechListBox::initIcon( LogisticsMech* pMech, aObject& mechIcon ) { mechIcon = (MechListBoxItem::s_templateItem->mechIcon); long index = pMech->getIconIndex(); long xIndex = index % 10; long yIndex = index / 10; float fX = xIndex; float fY = yIndex; float width = mechIcon.width(); float height = mechIcon.height(); float u = (fX * width); float v = (fY * height); fX += 1.f; fY += 1.f; float u2 = (fX * width); float v2 = (fY * height); mechIcon.setFileWidth(256.f); mechIcon.setUVs( u, v, u2, v2 ); }
void LogisticsPilotListBox::makeUVs(LogisticsPilot* pPilot, aObject& icon) { icon = LogisticsPilotListBoxItem::s_templateItem->icon; // need to set the UV's int32_t index = pPilot->getPhotoIndex(); int32_t xIndex = index % 12; int32_t yIndex = index / 12; float fX = xIndex; float fY = yIndex; float width = icon.width(); float height = icon.height(); float u = (fX * width); float v = (fY * height); fX += 1.f; fY += 1.f; float u2 = (fX * width); float v2 = (fY * height); icon.setFileWidth(256.f); icon.setUVs(u, v, u2, v2); }