Game Development Reference
In-Depth Information
Listing 6-14. BillBoardFont() Constructor
BillBoardFont(Context iContext, MeshEx iMeshEx, Texture[] iTextures, Material iMaterial, Shader
iShader, char Character)
{
super(iContext, iMeshEx, iTextures, iMaterial, iShader );
m_Character = Character;
}
The GetCharacter() function returns the character that this billboard is associated with.
char GetCharacter() {return m_Character;}
The SetCharacter() function sets the character that will be associated with this billboard.
void SetCharacter(char value) { m_Character = value;}
The IsFontCharacter() function returns true if the input parameter value is the alphanumeric
character that this billboard texture represents and false otherwise. (See Listing 6-15.)
Listing 6-15. Testing for a Character Value
boolean IsFontCharacter(char value)
{
if (m_Character == value)
{
return true;
}
else
{
return false;
}
}
Modifying the Texture Class
Next, we have to modify the Texture class to add a new function.
The CopySubTextureToTexture() function copies the texture in the input parameter BitmapImage to
the bitmap associated with the Texture object. The main purpose in using this function is to update
the data on the HUD, such as score, health, etc. Each letter and number that is displayed on the
HUD has a separate graphic bitmap associated with it. For example, the HUD item for score has a
billboard texture associated with it. When the score has to be updated, individual bitmaps are copied
to the billboard texture using the CopySubTextureToTexture() function and placed at XOffset, YOffset
location on the bitmap. (See Listing 6-16.)
 
Search WWH ::




Custom Search