Game Development Reference
In-Depth Information
Bitmap Image = Tex.GetTextureBitMap();
Height = Image.getHeight();
}
return Height;
}
The AddToCharacterSet() function adds a BillBoardFont object to the character set. The function
returns true if it is successfully added or false if there is not enough room. (See Listing 6-20.)
Listing 6-20. Adding BillBoardFont Object to the Character Set
boolean AddToCharacterSet(BillBoardFont Character)
{
if (m_NumberCharacters < MAX_CHARACTERS)
{
m_CharacterSet[m_NumberCharacters] = Character;
m_NumberCharacters++;
return true;
}
else
{
Log.e("BILLBOARD CHARACTER SET" , "NOT ENOUGH ROOM TO ADD ANOTHER CHARACTER TO
CHARACTER SET");
return false;
}
}
The FindBillBoardCharacter() function searches for the input character within the character set.
If it is found, then the corresponding BillBoardFont object is returned. Null is returned otherwise.
(See Listing 6-21.)
Listing 6-21. Searching the Character Set
BillBoardFont FindBillBoardCharacter(char character)
{
BillBoardFont Font = null;
for (int i = 0; i < m_NumberCharacters; i++)
{
if (m_CharacterSet[i].IsFontCharacter(character))
{
Font = m_CharacterSet[i];
}
}
return Font;
}
The SetText() function converts an array of characters to the corresponding array of BillBoardFont
objects stored in the m_TextBillBoard array. (See Listing 6-22.)
 
Search WWH ::




Custom Search