本文整理汇总了C++中CItem::GetLifeInc方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::GetLifeInc方法的具体用法?C++ CItem::GetLifeInc怎么用?C++ CItem::GetLifeInc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItem
的用法示例。
在下文中一共展示了CItem::GetLifeInc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawStatsString
void DrawStatsString()
{
// Let's get the current selected item from the user
CItem *pItem = g_Menu.GetSelectedItem();
char szStats[kStatsMenuWidth] = {0};
// If there is an item that is selected, let's display its stats
if(pItem)
{
sprintf(szStats, "LifeInc: %d strengthInc: %d ProtectionInc: %d",
pItem->GetLifeInc(), pItem->GetStrengthInc(), pItem->GetProtectionInc());
}
else // Otherwise display blank stats
{
sprintf(szStats, "LifeInc: strengthInc: ProtectionInc: ");
}
// Draw the stats in the correct menu box at the bottom
g_Menu.DrawString(szStats, (int)strlen(szStats), kStatsMenuX + kTileWidth,
kStatsMenuY + kTileHeight-3, NULL);
// Now let's display the current player's stats. Let's create the string
sprintf(szStats, "Hp: %d Str: %d Ptc: %d",
g_Player.GetHealth(), g_Player.GetStrength(), g_Player.GetProtection());
// Draw the player's stats in the top left of the inventory menu
g_Menu.DrawString(szStats, (int)strlen(szStats), kPlrStatsMenuX, kPlrStatsMenuY, NULL);
}
示例2: DrawItemStats
void DrawItemStats()
{
// Get the selected item to draw it's stats
CItem *pItem = g_Shop.GetSelectedItem();
char szStats[kStatsMenuWidth] = {0};
// If there is an item selected, display it's stats at the bottom of the menu
if(pItem)
{
sprintf(szStats, "LifeInc: %d strengthInc: %d ProtectionInc: %d",
pItem->GetLifeInc(), pItem->GetStrengthInc(), pItem->GetProtectionInc());
}
else
{
sprintf(szStats, "LifeInc: strengthInc: ProtectionInc: ");
}
// Draw the stats string to the bottom menu dialog box
g_Shop.DrawString(szStats, (int)strlen(szStats), kStatsMenuX + 3, kStatsMenuY + 2, NULL);
// Display the players gold in the left dialog box
sprintf(szStats, "$$$: %d", g_Player.GetGold());
g_Shop.DrawString(szStats, (int)strlen(szStats), kPlrStatsMenuX, kPlrStatsMenuY, NULL);
}