本文整理汇总了C#中GuiRenderer.AddRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# GuiRenderer.AddRectangle方法的具体用法?C# GuiRenderer.AddRectangle怎么用?C# GuiRenderer.AddRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiRenderer
的用法示例。
在下文中一共展示了GuiRenderer.AddRectangle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderScreenUI
public void RenderScreenUI(GuiRenderer renderer)
{
for (int viewIndex = 0; viewIndex < views.Count; viewIndex++)
{
View view = views[viewIndex];
//draw view on screen
if (view.Opacity > 0)
{
renderer.PushTextureFilteringMode(GuiRenderer.TextureFilteringModes.Point);
renderer.AddQuad(view.Rectangle, new Rect(0, 0, 1, 1), view.Texture,
new ColorValue(1, 1, 1, view.Opacity), true);
renderer.PopTextureFilteringMode();
}
//draw debug info
if (drawDebugInfo)
{
Viewport screenViewport = renderer.ViewportForScreenGuiRenderer;
Vec2 pixelOffset = 1.0f / screenViewport.DimensionsInPixels.Size.ToVec2();
ColorValue color = new ColorValue(1, 1, 0);
renderer.AddRectangle(new Rect(
view.Rectangle.LeftTop + pixelOffset,
view.Rectangle.RightBottom - pixelOffset * 2),
color);
renderer.AddLine(view.Rectangle.LeftTop, view.Rectangle.RightBottom, color);
renderer.AddLine(view.Rectangle.RightTop, view.Rectangle.LeftBottom, color);
if (debugFont == null)
debugFont = FontManager.Instance.LoadFont("Default", .03f);
string sizeString = "";
if (view.Texture != null)
sizeString = string.Format("{0}x{1}", view.Texture.Size.X, view.Texture.Size.Y);
string text = string.Format("View {0}, {1}", viewIndex, sizeString);
Vec2 position = new Vec2(view.Rectangle.Right - pixelOffset.X * 5, view.Rectangle.Top);
AddTextWithShadow(renderer, debugFont, text, position, HorizontalAlign.Right,
VerticalAlign.Top, new ColorValue(1, 1, 1));
}
}
}
示例2: Draw2DRectangles
void Draw2DRectangles( GuiRenderer renderer )
{
Rect rect = new Rect( .01f, .9f, .25f, .99f );
renderer.AddQuad( rect, new ColorValue( .5f, .5f, .5f, .5f ) );
Rect rect2 = rect;
rect2.Expand( new Vec2( .005f / renderer.AspectRatio, .005f ) );
renderer.AddRectangle( rect2, new ColorValue( 1, 1, 0 ) );
AddTextWithShadow( renderer, fontMedium, "2D GUI Drawing", rect.GetCenter(), HorizontalAlign.Center,
VerticalAlign.Center, new ColorValue( 1, 1, 1 ) );
}
示例3: DrawDebug
public void DrawDebug(Rect r, GuiRenderer g)
{
float windScale = 0.1f;
float forceScale = 0.2f;
float positionScale = 5.0f;
// Box around
g.AddRectangle(r, new ColorValue(0.416f, 0.133f, 0.494f));
// Aerofoil
float controlAngle = MathFunctions.DegToRad(debugControl);
g.AddLine(
Utils.TR(r, new Vec2(0.5f - MathFunctions.Cos(controlAngle) * 0.25f, 0.5f - MathFunctions.Sin(controlAngle) * 0.25f)),
Utils.TR(r, new Vec2(0.5f + MathFunctions.Cos(controlAngle) * 0.25f, 0.5f + MathFunctions.Sin(controlAngle) * 0.25f)),
new ColorValue(0.416f, 0.553f, 0.576f)
);
// Wind
Vec2 windStart = Utils.TR(r, new Vec2(0.5f - debugWind.Y * windScale, 0.5f - debugWind.Z * windScale));
Vec2 windEnd = Utils.TR(r, new Vec2(0.5f, 0.5f));
DrawVector(g, windStart, windEnd, new ColorValue(0.196f, 0.384f, 0.337f));
// Lift
Vec2 liftStart = Utils.TR(r, new Vec2(0.5f + debugLinearPosition * positionScale, 0.5f));
Vec2 liftEnd = liftStart + new Vec2(0, -debugLift.Z * forceScale);
DrawVector(g, liftStart, liftEnd, new ColorValue(0.333f, 0.973f, 0.969f));
// Drag
Vec2 dragStart = Utils.TR(r, new Vec2(0.5f + debugLinearPosition * positionScale, 0.5f + 0.01f));
Vec2 dragEnd = dragStart + new Vec2(-debugDrag.Y * forceScale, 0);
DrawVector(g, dragStart, dragEnd, new ColorValue(0.486f, 0.184f, 0.184f));
// Pitch
Vec2 pitchStart = Utils.TR(r, new Vec2(0.5f, 0.5f - debugPitchPosition * positionScale));
Vec2 pitchEnd = pitchStart + new Vec2(0, -debugPitchForce.Z * forceScale);
DrawVector(g, pitchStart, pitchEnd, new ColorValue(0.388f, 0.769f, 0.373f));
}