本文整理汇总了C#中GuiRenderer.AddTextWordWrap方法的典型用法代码示例。如果您正苦于以下问题:C# GuiRenderer.AddTextWordWrap方法的具体用法?C# GuiRenderer.AddTextWordWrap怎么用?C# GuiRenderer.AddTextWordWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiRenderer
的用法示例。
在下文中一共展示了GuiRenderer.AddTextWordWrap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawArea_RenderUI
//.........这里部分代码省略.........
if( step != 0 )
{
ColorValue color = colors[ step % colors.Length ];
ColorValue color2 = color;
color2.Alpha = 0;
triangles.Add( new GuiRenderer.TriangleVertex( rectangle.GetCenter(), color ) );
triangles.Add( new GuiRenderer.TriangleVertex( lastPosition, color2 ) );
triangles.Add( new GuiRenderer.TriangleVertex( pos, color2 ) );
}
angle += ( MathFunctions.PI * 2 ) / steps;
lastPosition = pos;
}
renderer.AddTriangles( triangles );
}
//draw quads
if( GetDrawAreaMode() == DrawAreaModes.Quads )
{
//draw background
{
Texture texture = TextureManager.Instance.Load( "Gui\\Various\\Logo.png" );
renderer.AddQuad( rectangle, new Rect( 0, -.3f, 1, 1.4f ), texture,
new ColorValue( 1, 1, 1 ), true );
}
//draw bars
{
float time = EngineApp.Instance.Time;
EngineRandom random = new EngineRandom( 0 );
int count = 15;
float stepOffset = rectangle.GetSize().X / count;
float size = stepOffset * .9f;
for( int n = 0; n < count; n++ )
{
float v = MathFunctions.Cos( time * random.NextFloat() );
float v2 = ( v + 1 ) / 2;
ColorValue color = colors[ n % colors.Length ];
Rect rect = new Rect(
rectangle.Left + stepOffset * n, rectangle.Bottom - rectangle.GetSize().Y * v2,
rectangle.Left + stepOffset * n + size, rectangle.Bottom );
renderer.AddQuad( rect, color );
}
}
}
//draw lines
if( GetDrawAreaMode() == DrawAreaModes.Lines )
{
float maxDistance;
{
Vec2 s = rectangle.GetSize() / 2;
maxDistance = MathFunctions.Sqrt( s.X * s.X + s.Y * s.Y );
}
int step = 0;
float distance = 0;
Radian angle = -EngineApp.Instance.Time;
Vec2 lastPosition = Vec2.Zero;
while( distance < maxDistance )
{
Vec2 localPos = new Vec2( MathFunctions.Cos( angle ), MathFunctions.Sin( angle ) ) * distance;
Vec2 pos = rectangle.GetCenter() + new Vec2( localPos.X, localPos.Y * renderer.AspectRatio );
if( step != 0 )
{
ColorValue color = colors[ step % colors.Length ];
renderer.AddLine( lastPosition, pos, color );
}
step++;
angle += MathFunctions.PI / 10;
distance += .001f;
lastPosition = pos;
}
}
//draw text
if( GetDrawAreaMode() == DrawAreaModes.Text )
{
//draw text with specified font.
renderer.AddText( drawAreaBigFont, "Big Font Sample", rectangle.LeftTop, HorizontalAlign.Left,
VerticalAlign.Top, new ColorValue( 1, 1, 1 ) );
//draw text with word wrap.
string text = "Test Test Test.\n\nThe expandable user interface system is a unified system " +
"for the creation of end-user controls, menus, dialogues, windows and HUD screens. " +
"With the help of this system the end-user exercises control over the application.";
renderer.AddTextWordWrap( text, rectangle, HorizontalAlign.Right, false, VerticalAlign.Bottom, 0,
new ColorValue( 1, 1, 0 ) );
}
if( clipRectangle )
renderer.PopClipRectangle();
}
示例2: DrawArea_RenderUI
//.........这里部分代码省略.........
ColorValue color2 = color;
color2.Alpha = 0;
triangles.Add(new GuiRenderer.TriangleVertex(rectangle.GetCenter(), color));
triangles.Add(new GuiRenderer.TriangleVertex(lastPosition, color2));
triangles.Add(new GuiRenderer.TriangleVertex(pos, color2));
}
angle += (MathFunctions.PI * 2) / steps;
lastPosition = pos;
}
renderer.AddTriangles(triangles);
}
//draw quads
if (GetDrawAreaMode() == DrawAreaModes.Quads)
{
//draw background
{
Texture texture = TextureManager.Instance.Load("GUI\\Textures\\NeoAxisLogo.png");
renderer.AddQuad(rectangle, new Rect(0, -.3f, 1, 1.4f), texture,
new ColorValue(1, 1, 1), true);
}
//draw bars
{
float time = EngineApp.Instance.Time;
EngineRandom random = new EngineRandom(0);
int count = 15;
float stepOffset = rectangle.GetSize().X / count;
float size = stepOffset * .9f;
for (int n = 0; n < count; n++)
{
float v = MathFunctions.Cos(time * random.NextFloat());
float v2 = (v + 1) / 2;
ColorValue color = colors[n % colors.Length];
Rect rect = new Rect(
rectangle.Left + stepOffset * n, rectangle.Bottom - rectangle.GetSize().Y * v2,
rectangle.Left + stepOffset * n + size, rectangle.Bottom);
renderer.AddQuad(rect, color);
}
}
}
//draw lines
if (GetDrawAreaMode() == DrawAreaModes.Lines)
{
float maxDistance;
{
Vec2 s = rectangle.GetSize() / 2;
maxDistance = MathFunctions.Sqrt(s.X * s.X + s.Y * s.Y);
}
int step = 0;
float distance = 0;
Radian angle = -EngineApp.Instance.Time;
Vec2 lastPosition = Vec2.Zero;
while (distance < maxDistance)
{
Vec2 localPos = new Vec2(MathFunctions.Cos(angle), MathFunctions.Sin(angle)) * distance;
Vec2 pos = rectangle.GetCenter() + new Vec2(localPos.X, localPos.Y * renderer.AspectRatio);
if (step != 0)
{
ColorValue color = colors[step % colors.Length];
renderer.AddLine(lastPosition, pos, color);
}
step++;
angle += MathFunctions.PI / 10;
distance += .001f;
lastPosition = pos;
}
}
//draw text
if (GetDrawAreaMode() == DrawAreaModes.Text)
{
string text;
//draw text with specified font.
text = "Map Editor is a tool to create worlds for your project. The tool is a complex editor to manage " +
"objects on the map.";
renderer.AddTextWordWrap(drawAreaBigFont, text, rectangle, HorizontalAlign.Left, false, VerticalAlign.Top, 0,
new ColorValue(1, 1, 1));
//draw text with word wrap.
text = "Deployment Tool is a tool to deploy the final version of your application to specified platforms. " +
"This utility is useful to automate the final product's creation.";
renderer.AddTextWordWrap(drawAreaSmallFont, text, rectangle, HorizontalAlign.Right, false, VerticalAlign.Bottom, 0,
new ColorValue(1, 1, 0));
}
if (clipRectangle)
renderer.PopClipRectangle();
}