コード例 #1
0
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 );

}
コード例 #2
0
void LogisticsMechIcon::renderObject( aObject& obj, long animIndex, long xOffset, long yOffset )
{
	long color = 0xffffffff;

	if ( animIndex != -1 )
	{
		color = animations[animIndex].getCurrentColor(animations[animIndex].getState());
	}

	obj.setColor( color );
	obj.render( xOffset, yOffset );
}
コード例 #3
0
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);
}