Game Development Reference
In-Depth Information
// Set Intial Position and Orientation
Vector3 Position = new Vector3(0.0f, 3.0f, 0.0f);
Vector3 Scale = new Vector3(1.0f,0.1f,0.01f);
m_HUDComposite.m_Orientation.SetPosition(Position);
m_HUDComposite.m_Orientation.SetScale(Scale);
m_HUDComposite.GetObjectPhysics().SetGravity(false);
// Set black portion of HUD to transparent
m_HUDComposite.GetMaterial().SetAlpha(1.0f);
m_HUDComposite.SetBlend(true);
}
The CreateCharacterSet() function creates a new BillBoardCharacterSet object for use in our HUD.
For each character, number, or other symbol we want to add to our character set, we create a new
BillBoardFont object and initialize it with the texture and text value associated with it. Then we call
AddToCharacterSet() with the newly created font to add this font into our character set. Also note
that we use a different fragment shader than normal, which is R.raw.fsonelightnodiffuse . This
fragment shader only uses the color of the texture to determine the final color of the fragment.
(See Listing 6-39.)
Listing 6-39. Creating the Character Set
void CreateCharacterSet(Context iContext)
{
//Create Shader
Shader Shader = new Shader(iContext, R.raw.vsonelight, R.raw.fsonelightnodiffuse);
// ok
// Create Debug Local Axis Shader
MeshEx Mesh = new MeshEx(8,0,3,5,Cube.CubeData, Cube.CubeDrawOrder);
// Create Material for this object
Material Material1 = new Material();
Material1.SetEmissive(1.0f, 1.0f, 1.0f);
// Create Texture
CreateCharacterSetTextures(iContext);
// Setup HUD
SetUpHUDComposite(iContext);
m_CharacterSet = new BillBoardCharacterSet();
int NumberCharacters = 43;
char[] Characters = new char[BillBoardCharacterSet.MAX_CHARACTERS];
Characters[0] = '1';
Characters[1] = '2';
Characters[2] = '3';
Characters[3] = '4';
Characters[4] = '5';
Characters[5] = '6';
 
Search WWH ::




Custom Search