Axiom.Overlays.Elements.TextArea.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( ) : void
return void
		public override void Initialize()
		{
			if ( !isInitialized )
			{
				// Set up the render operation
				// Combine positions and texture coords since they tend to change together
				// since character sizes are different
				renderOperation.vertexData = new VertexData();
				VertexDeclaration decl = renderOperation.vertexData.vertexDeclaration;

				int offset = 0;

				// positions
				decl.AddElement( POSITION_TEXCOORD_BINDING, offset, VertexElementType.Float3, VertexElementSemantic.Position );
				offset += VertexElement.GetTypeSize( VertexElementType.Float3 );

				// texcoords
				decl.AddElement( POSITION_TEXCOORD_BINDING, offset, VertexElementType.Float2, VertexElementSemantic.TexCoords, 0 );
				offset += VertexElement.GetTypeSize( VertexElementType.Float2 );
				// colors, stored in seperate buffer since they change less often
				decl.AddElement( COLOR_BINDING, 0, VertexElementType.Color, VertexElementSemantic.Diffuse );

				renderOperation.operationType = OperationType.TriangleList;
				renderOperation.useIndices = false;
				renderOperation.vertexData.vertexStart = 0;

				// buffers are created in CheckMemoryAllocation
				CheckMemoryAllocation( DEFAULT_INITIAL_CHARS );

				isInitialized = true;
			}
		}