本文整理汇总了C++中CUnit::GetIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ CUnit::GetIcon方法的具体用法?C++ CUnit::GetIcon怎么用?C++ CUnit::GetIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUnit
的用法示例。
在下文中一共展示了CUnit::GetIcon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawUnitInfo_portrait
static void DrawUnitInfo_portrait(const CUnit &unit)
{
const CUnitType &type = *unit.Type;
#ifdef USE_MNG
if (type.Portrait.Num) {
type.Portrait.Mngs[type.Portrait.CurrMng]->Draw(
UI.SingleSelectedButton->X, UI.SingleSelectedButton->Y);
if (type.Portrait.Mngs[type.Portrait.CurrMng]->iteration == type.Portrait.NumIterations) {
type.Portrait.Mngs[type.Portrait.CurrMng]->Reset();
// FIXME: should be configurable
if (type.Portrait.CurrMng == 0) {
type.Portrait.CurrMng = (SyncRand() % (type.Portrait.Num - 1)) + 1;
type.Portrait.NumIterations = 1;
} else {
type.Portrait.CurrMng = 0;
type.Portrait.NumIterations = SyncRand() % 16 + 1;
}
}
return;
}
#endif
if (UI.SingleSelectedButton) {
const PixelPos pos(UI.SingleSelectedButton->X, UI.SingleSelectedButton->Y);
const int flag = (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor == 0) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
//Wyrmgus start
// type.Icon.Icon->DrawUnitIcon(*UI.SingleSelectedButton->Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
unit.GetIcon().Icon->DrawUnitIcon(*UI.SingleSelectedButton->Style, flag, pos, "", unit.RescuedFrom ? unit.RescuedFrom->Index : unit.Player->Index);
//Wyrmgus end
}
}
示例2: DrawUnitInfo_inventory
//Wyrmgus start
static void DrawUnitInfo_inventory(CUnit &unit)
{
CUnit *uins = unit.UnitInside;
size_t j = 0;
for (int i = 0; i < unit.InsideCount; ++i, uins = uins->NextContained) {
if (!uins->Type->BoolFlag[ITEM_INDEX].value || j >= UI.InventoryButtons.size()) {
continue;
}
CIcon &icon = *uins->Type->Icon.Icon;
int flag = (ButtonAreaUnderCursor == ButtonAreaInventory && static_cast<size_t>(ButtonUnderCursor) == j) ?
IconActive : 0;
if (flag && ((MouseButtons & LeftButton) || (MouseButtons & RightButton))) {
flag |= IconClicked;
}
flag |= IconCommandButton;
if (unit.IsItemEquipped(uins)) {
flag |= IconSelected;
}
const PixelPos pos(UI.InventoryButtons[j].X, UI.InventoryButtons[j].Y);
uins->GetIcon().Icon->DrawUnitIcon(*UI.InventoryButtons[j].Style, flag, pos, "", unit.Player->Index);
if (ButtonAreaUnderCursor == ButtonAreaInventory
&& static_cast<size_t>(ButtonUnderCursor) == j) {
//Wyrmgus start
// UI.StatusLine.Set(uins->Type->Name);
if (!Preference.NoStatusLineTooltips) {
UI.StatusLine.Set(uins->GetTypeName());
}
//hackish way to make the popup appear correctly for the inventory item
ButtonAction *ba = new ButtonAction;
if (!uins->Name.empty()) {
ba->Hint = uins->Name;
} else {
ba->Hint = uins->GetTypeName();
}
ba->Pos = j;
ba->Level = unit.Type->ButtonLevelForInventory;
ba->Action = ButtonUnit;
ba->Value = UnitNumber(*uins);
ba->Popup = "popup-item-inventory";
DrawPopup(*ba, UI.InventoryButtons[j], UI.InventoryButtons[j].X, UI.InventoryButtons[j].Y);
delete ba;
LastDrawnButtonPopup = NULL;
//Wyrmgus end
}
++j;
}
}
示例3: DrawUnitInfo_transporter
static void DrawUnitInfo_transporter(CUnit &unit)
{
CUnit *uins = unit.UnitInside;
size_t j = 0;
for (int i = 0; i < unit.InsideCount; ++i, uins = uins->NextContained) {
//Wyrmgus start
// if (!uins->Boarded || j >= UI.TransportingButtons.size()) {
if (!uins->Boarded || j >= UI.TransportingButtons.size() || (unit.Player != ThisPlayer && uins->Player != ThisPlayer)) {
//Wyrmgus end
continue;
}
CIcon &icon = *uins->Type->Icon.Icon;
int flag = (ButtonAreaUnderCursor == ButtonAreaTransporting && static_cast<size_t>(ButtonUnderCursor) == j) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
const PixelPos pos(UI.TransportingButtons[j].X, UI.TransportingButtons[j].Y);
//Wyrmgus start
// icon.DrawUnitIcon(*UI.TransportingButtons[j].Style, flag, pos, "", uins->RescuedFrom ? uins->RescuedFrom->Index : uins->Player->Index);
uins->GetIcon().Icon->DrawUnitIcon(*UI.TransportingButtons[j].Style, flag, pos, "", uins->RescuedFrom ? uins->RescuedFrom->Index : uins->Player->Index);
//Wyrmgus end
UiDrawLifeBar(*uins, pos.x, pos.y);
//Wyrmgus start
// if (uins->Type->CanCastSpell && uins->Variable[MANA_INDEX].Max) {
if (uins->Type->CanCastSpell && uins->Variable[MANA_INDEX].Enable && uins->Variable[MANA_INDEX].Max) {
//Wyrmgus end
//Wyrmgus start
// UiDrawManaBar(*uins, pos.x, pos.y);
// don't draw the mana bar when within transporters, as there's not enough space for it
//Wyrmgus end
}
if (ButtonAreaUnderCursor == ButtonAreaTransporting
&& static_cast<size_t>(ButtonUnderCursor) == j) {
//Wyrmgus start
// UI.StatusLine.Set(uins->Type->Name);
if (!Preference.NoStatusLineTooltips) {
UI.StatusLine.Set(uins->GetMessageName());
}
//Wyrmgus end
}
++j;
}
}