本文整理匯總了C#中Text.SetColour方法的典型用法代碼示例。如果您正苦於以下問題:C# Text.SetColour方法的具體用法?C# Text.SetColour怎麽用?C# Text.SetColour使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Text
的用法示例。
在下文中一共展示了Text.SetColour方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Start
public void Start()
{
// Create an example triangle object.
_triangleVertices = new List<Vertex>(6)
{
new Vertex(new Vector3(-0.25f, 0.25f, 0.0f), Colour.White, new Vector2(0.0f, 0.0f)),
new Vertex(new Vector3(0.25f, -0.25f, 0.0f), Colour.White, new Vector2(1.0f, 64.0f)),
new Vertex(new Vector3(-0.25f, -0.25f, 0.0f), Colour.White, new Vector2(0.0f, 64.0f)),
new Vertex(new Vector3(-0.25f, 0.25f, 0.0f), Colour.White, new Vector2(0.0f, 0.0f)),
new Vertex(new Vector3(0.25f, 0.25f, 0.0f), Colour.White, new Vector2(1.0f, 0.0f)),
new Vertex(new Vector3(0.25f, -0.25f, 0.0f), Colour.White, new Vector2(1.0f, 64.0f))
};
_vertexBuffer = ResourceFactory.CreateVertexBufferInstance();
_vertexBuffer.SetVertices(_triangleVertices);
_pTexture = ResourceFactory.CreateTexture();
_pTexture.Load(Helpers.GetRelativePath("Textures\\font.dds"));
_pMaterial = ResourceFactory.CreateMaterial();
_pMaterial.SetTexture(_pTexture);
_pMaterial.LoadVertexShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "VSMain", "vs_5_1");
_pMaterial.LoadPixelShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "PSMain", "ps_5_1");
_pMaterial.Finalise(false);
_pTriangle = new RenderObject("triangle");
_pTriangle.SetVertexBuffer(_vertexBuffer);
_pTriangle.SetMaterial(_pMaterial);
// Create an example triangle object.
_vertices2 = new List<Vertex>(4)
{
new Vertex(new Vector3(-0.25f, 0.25f, 0.0f), Colour.White, new Vector2(0.0f, 0.0f)),
new Vertex(new Vector3(0.25f, -0.25f, 0.0f), Colour.White, new Vector2(1.0f, 1.0f)),
new Vertex(new Vector3(0.25f, 0.25f, 0.0f), Colour.White, new Vector2(1.0f, 0.0f)),
new Vertex(new Vector3(-0.25f, -0.25f, 0.0f), Colour.White, new Vector2(0.0f, 1.0f))
};
_indices = new List<int>(6)
{
1, 0, 2,
0, 1, 3
};
_vertexBuffer2 = ResourceFactory.CreateVertexBufferInstance();
_vertexBuffer2.SetVertices(_vertices2);
_indexBuffer = ResourceFactory.CreateIndexBufferInstance();
_indexBuffer.SetIndices(_indices);
_pTexture2 = ResourceFactory.CreateTexture();
_pTexture2.Load(Helpers.GetRelativePath("Textures\\test2.png"));
_pMaterial2 = ResourceFactory.CreateMaterial();
_pMaterial2.SetTexture(_pTexture2);
_pMaterial2.LoadVertexShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "VSMain", "vs_5_1");
_pMaterial2.LoadPixelShader(Helpers.GetRelativePath("Shaders\\DiffuseTexture.hlsl"), "PSMain", "ps_5_1");
_pMaterial2.Finalise(false);
_pTriangle2 = new RenderObject("triangle2");
_pTriangle2.SetIndexBuffer(_indexBuffer);
_pTriangle2.SetVertexBuffer(_vertexBuffer2);
_pTriangle2.SetMaterial(_pMaterial2);
_pFont = FontManager.LoadFont("Myriad", Helpers.GetRelativePath("Textures\\myriad.dds"), Helpers.GetRelativePath("Textures\\myriad.txt"));
_pText = new Text("text", _pFont);
_pText.SetText("test");
_pText.SetColour(Colour.Yellow);
_pText.Transform.Position = new Vector3(0.0f, 0.0f, 0.0f);
_pText2 = new Text("text2", _pFont);
_pText2.SetText("Hello world!");
_pText2.Transform.Position = new Vector3(0.0f, 20.0f, 0.0f);
_pText2.EnableWorldSpace(true);
}