コード例 #1
0
/*
* draw the view
*/
void CViewBitmapFaberMp::draw ()
{
	///\todo nico : draw icon
	/*xOffset+=_XReal;
	yOffset+=_YReal;
	_SheetText->setText(ucstring(toString(_SheetId.getSInt32())));
	_SheetText->draw(xOffset,yOffset+20);

	_QuantityText->setText(ucstring(toString(_Quantity.getSInt32())));
	_QuantityText->draw(xOffset,yOffset+10);

	_QualityText->setText(ucstring(toString(_Quality.getSInt32())));
	_QualityText->draw(xOffset,yOffset);
*/

	//get the item
	CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer();

	uint32 sheet = (uint32)_SheetId.getSInt64();
	CSheetId sheetId(sheet);
	CEntitySheet *pES = SheetMngr.get (sheetId);

	if ((pES != NULL) && (pES->type() == CEntitySheet::ITEM))
	{
		CItemSheet *pIS = (CItemSheet*)pES;

		if (pIS->getIconBack() != "")
		{
			if (_AccIconBackString != pIS->getIconBack())
			{
				_AccIconBackString = pIS->getIconBack();
				_AccIconBackId = rVR.getTextureIdFromName (_AccIconBackString);
			}
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal,
							_WReal, _HReal, (uint8)_Rot, _Flip,
							_AccIconBackId);
		}

		if (pIS->getIconMain() != "")
		{
			if (_AccIconMainString != pIS->getIconMain())
			{
				_AccIconMainString = pIS->getIconMain();
				_AccIconMainId = rVR.getTextureIdFromName (_AccIconMainString);
			}
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal,
							_WReal, _HReal, (uint8)_Rot, _Flip,
							_AccIconMainId);
		}

		if (pIS->getIconOver() != "")
		{
			if (_AccIconOverString != pIS->getIconOver())
			{
				_AccIconOverString = pIS->getIconOver();
				_AccIconOverId = rVR.getTextureIdFromName (_AccIconOverString);
			}
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal,
							_WReal, _HReal, (uint8)_Rot, _Flip,
							_AccIconOverId);
		}

/*		// draw wanted quantity
		{
		//draw the units
		uint units = _NeededQuantity.getSInt32() % 10;
		rVR.drawRotFlipBitmap (_RenderLayer, _XReal+xOffset+13, _YReal+yOffset,
				8, 8, (uint8)_Rot.getSInt32(), _Flip.getBool(),
				rVR.getFigurTextureId(units), _Color.getRGBA());

		//draw the tens
		uint tens = _NeededQuantity.getSInt32() / 10;
		sint32 tensId;
		if (tens > 9 || tens == 0)
			tensId = rVR.getFigurBlankTextureId();
		else
			tensId = rVR.getFigurTextureId(tens);
		rVR.drawRotFlipBitmap (_RenderLayer, _XReal+xOffset+8, _YReal+yOffset,
			8, 8, (uint8)_Rot.getSInt32(), _Flip.getBool(),
			tensId, _Color.getRGBA());
		}


		// draw current quantity
		if (_Quantity.getSInt32() > 1)
		{
			//draw the units
			uint units = _Quantity.getSInt32() % 10;
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal+xOffset+_WReal-8, _YReal+yOffset,
					8, 8, (uint8)_Rot.getSInt32(), _Flip.getBool(),
					rVR.getFigurTextureId(units), _Color.getRGBA());

			//draw the tens
			uint tens = _Quantity.getSInt32() / 10;
			sint32 tensId;
			if (tens > 9 || tens == 0)
				tensId = rVR.getFigurBlankTextureId();
			else
				tensId = rVR.getFigurTextureId(tens);
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal+xOffset+_WReal-13, _YReal+yOffset,
				8, 8, (uint8)_Rot.getSInt32(), _Flip.getBool(),
				tensId, _Color.getRGBA());
		}
		*/

		uint16 qty = (uint16) ( _NeededQuantity.getSInt32() - _Quantity.getSInt32() );
		// draw missing quantity
		if (qty > 1)
		{
			//draw the units
			uint units = qty % 10;
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal+_WReal-8, _YReal,
					8, 8, (uint8)_Rot, _Flip,
					rVR.getFigurTextureId(units), _Color);

			//draw the tens
			uint tens = qty / 10;
			sint32 tensId;
			if (tens > 9 || tens == 0)
				tensId = rVR.getFigurBlankTextureId();
			else
				tensId = rVR.getFigurTextureId(tens);
			rVR.drawRotFlipBitmap (_RenderLayer, _XReal+_WReal-13, _YReal,
				8, 8, (uint8)_Rot, _Flip,
				tensId, _Color);
		}
	}
	else
	{
		if (_TextureNoItemId == -2)
			_TextureNoItemId = rVR.getTextureIdFromName (_TextureNoItemName);
		rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal,
						_WReal, _HReal, (uint8)_Rot, _Flip,
						_TextureNoItemId, _ColorNoItem.getRGBA());
	}
}