Game Development Reference
In-Depth Information
if (Slot >= 0)
{
Item = m_HUDItems[Slot];
}
return Item;
}
The DeleteHUDItem() function deletes a HUD item named ItemName from the HUD, if it exists, by
setting its state to invalid. It then returns true. If the HUD item could not be found, the function
returns false. (See Listing 6-31.)
Listing 6-31. Deleting an Item in the HUD
boolean DeleteHUDItem(String ItemName)
{
boolean result = false;
int Slot = FindHUDItem(ItemName);
if (Slot >= 0)
{
m_HUDItems[Slot].SetItemValidState(false);
result = true;
}
return result;
}
The UpdateHUDItemNumericalValue() function finds and updates the numerical value of the HUD
item that matches ID. It also sets the dirty status to true, so that the updated graphics data will be
copied to the m_HUDImage billboard texture associated with the HUD item. (See Listing 6-32.)
Listing 6-32. Updating Numerical HUD Items
void UpdateHUDItemNumericalValue(String ID, int NumericalValue)
{
int Slot = FindHUDItem(ID);
HUDItem HItem = m_HUDItems[Slot];
if (HItem != null)
{
// Update Key fields in HUDItem
HItem.SetNumericalValue(NumericalValue);
HItem.SetDirty(true);
}
}
 
Search WWH ::




Custom Search