Game Development Reference
In-Depth Information
The RenderToBillBoard() function renders the text that is set by the SetText() function to the
bitmap texture in the Composite input variable at location XOffset, YOffset on the bitmap, with
0,0 indicating the upper left-hand corner of the texture. Each character graphic is drawn on the
Composite using the DrawFontToComposite() function. (See Listing 6-24.)
Listing 6-24. Rendering the Text to a BillBoard
void RenderToBillBoard(BillBoard Composite, int XOffset, int YOffset)
{
int Length = m_Text.length;
for (int i = 0; i < Length; i++)
{
BillBoardFont Character = m_TextBillBoard[i];
if (Character != null)
{
// Draw this font to the composite by copying the bitmap image data
Texture Tex = Character.GetTexture(0);
Bitmap Image = Tex.GetTextureBitMap();
int Width = Image.getWidth();
int XCompositeOffset = XOffset + (Width * i);
DrawFontToComposite(Character, XCompositeOffset, YOffset, Composite);
}
}
}
Creating the HUDItem Class
The HUDItem class holds the data for an individual HUD item, such as a score or health statistic.
If this HUDItem is in use and valid, then m_ItemValid is true; otherwise, it is false.
private boolean m_ItemValid;
The name that is used to reference this HUD item is held in m_ItemName .
private String m_ItemName;
The numeric value associated with this HUD item, if there is one, is held in m_NumericalValue .
private int m_NumericalValue;
The text value associated with this HUD item, if any, is held in m_TextValue .
private String m_TextValue = null;
The position of the HUD item in local HUD coordinates with x = 0 and y = 0 being the center of the
camera view.
private Vector3 m_ScreenPosition;
 
Search WWH ::




Custom Search