Exemple #1
0
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);
}
Exemple #2
0
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);
}