当前位置: 首页>>代码示例>>C#>>正文


C# IRenderer.DrawLine方法代码示例

本文整理汇总了C#中IRenderer.DrawLine方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderer.DrawLine方法的具体用法?C# IRenderer.DrawLine怎么用?C# IRenderer.DrawLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderer的用法示例。


在下文中一共展示了IRenderer.DrawLine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Paint

        public override void Paint(IRenderer renderer)
        {
            if (this.Collidable)
            {
                this.Scp.Paint(renderer);
            }
            else
            {
                if (!this.Visible)
                    return;

                Vector c = this.Center;

                int w = (int) (p2.Position - p1.Position).magnitude();
                int h = 1 /*abs(p2.py()-p1.py())*/;

                renderer.DrawLine(
                    this.Radian,
                    c.X - w / 2, c.Y - h / 2,
                    c.X + w / 2, c.Y + h / 2,
                    _lineThickness, _lineColor);
            }
        }
开发者ID:tgjones,项目名称:apesharp,代码行数:23,代码来源:SpringConstraint.cs

示例2: Paint

        public override void Paint(IRenderer renderer)
        {
            base.Paint(renderer);

            // spokes
            renderer.DrawLine(
                this.Radian,
                curr.X - this.Radius,
                curr.Y,
                curr.X + this.Radius,
                curr.Y,
                _lineThickness,
                _lineColor);
            renderer.DrawLine(
                this.Radian + (float) Math.PI,
                curr.X,
                curr.Y - this.Radius,
                curr.X,
                curr.Y + this.Radius,
                _lineThickness,
                _lineColor);
        }
开发者ID:tgjones,项目名称:apesharp,代码行数:22,代码来源:WheelParticle.cs

示例3: RenderColumnFText

        // Render some text inside a rectangle. Use the special column F formatting characters (/, |).
        private void RenderColumnFText(IRenderer renderer, string s, float left, float top, float right, float bottom, RectangleF clipRect)
        {
            int index;
            bool split = false;
            bool drawDiagonalLine = false;
            string first = null, second = null;
            RectangleF rectFirst = new RectangleF(), rectSecond = new RectangleF();

            if (s == null)
                return;

            RectangleF rect = new RectangleF(left, top, right - left, bottom - top);
            if (!rect.IntersectsWith(clipRect))
                return;

            if (replaceMultiplySign)
                s = s.Replace('x', '\u00D7');           // U+00D7 is multiplication sign

            index = s.IndexOf('|');
            if (index >= 0) {
                split = true;
                drawDiagonalLine = false;
                first = s.Substring(0, index);
                second = s.Substring(index + 1);
                rectFirst = new RectangleF(left, top, right - left, (bottom - top) / 2);
                rectSecond = new RectangleF(left, top + (bottom - top) / 2, right - left, (bottom - top) / 2);
            }
            else {
                index = s.IndexOf('/');
                if (index >= 0) {
                    split = true;
                    drawDiagonalLine = true;
                    first = s.Substring(0, index);
                    second = s.Substring(index + 1);
                    rectFirst = new RectangleF(left, top, (right - left) * 0.63F, (bottom - top) / 2);
                    rectSecond = new RectangleF(left + (right - left) * 0.37F, top + (bottom - top) / 2, (right - left) * 0.63F, (bottom - top) / 2);
                }
            }

            if (split) {
                if (drawDiagonalLine)
                    renderer.DrawLine(thinPen, right, top, left, bottom);

                RenderSingleLineText(renderer, COLUMNF_DOUBLE_FONT, StringAlignment.Center, first, rectFirst.Left, rectFirst.Top, rectFirst.Right, rectFirst.Bottom, clipRect);
                RenderSingleLineText(renderer, COLUMNF_DOUBLE_FONT, StringAlignment.Center, second, rectSecond.Left, rectSecond.Top, rectSecond.Right, rectSecond.Bottom, clipRect);
            }
            else {
                RenderSingleLineText(renderer, COLUMNF_FONT, StringAlignment.Center, s, left, top, right, bottom, clipRect);
            }
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:51,代码来源:DescriptionRenderer.cs

示例4: RenderLine

        // Render a single line of the description. "lastLine" is true if this is the last line (draws the bottom line). The "thickLineCounter"
        // is used to decide when to draw the thick lines.
        // clipRect is the clipping rectangle in world coordinates. Only need to draw things that intersect it.
        private void RenderLine(IRenderer renderer, DescriptionLine descriptionLine, DescriptionKind descriptionKind, bool lastLine, bool drawThickLine, bool noTopLine, RectangleF clipRect)
        {
            float fullWidth = WidthInCells() * 100;

            // Draw top line.
            if (!noTopLine) {
                if (descriptionLine.kind != DescriptionLineKind.Normal || drawThickLine) {
                    renderer.DrawLine(thickPen, 0, 0, fullWidth, 0);
                }
                else {
                    renderer.DrawLine(thinPen, 0, 0, fullWidth, 0);
                }
            }

            // Draw bottom line, if requested
            if (lastLine)
                renderer.DrawLine(thickPen, 0, 100, fullWidth, 100);

            // Draw side lines.
            float lineTop = -DescriptionAppearance.thickDescriptionLine / 2;
            float lineBottom = 100 + DescriptionAppearance.thickDescriptionLine / 2;
            renderer.DrawLine(thickPen, 0, lineTop, 0, lineBottom);
            if (! (descriptionKind == DescriptionKind.SymbolsAndText && (descriptionLine.kind == DescriptionLineKind.Title || descriptionLine.kind == DescriptionLineKind.SecondaryTitle || descriptionLine.kind == DescriptionLineKind.Text)))
                renderer.DrawLine(thickPen, 800, lineTop, 800, lineBottom);
            if (descriptionKind == DescriptionKind.SymbolsAndText)
                renderer.DrawLine(thickPen, 1300, lineTop, 1300, lineBottom);

            switch (descriptionLine.kind) {
                case DescriptionLineKind.Title:
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[0]), 0, 0, fullWidth, 100, clipRect);
                    break;

                case DescriptionLineKind.SecondaryTitle:
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[0]), 0, 0, fullWidth, 100, clipRect);
                    break;

                case DescriptionLineKind.Header2Box:
                    renderer.DrawLine(thickPen, 300, lineTop, 300, lineBottom);
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[0]), 0, 0, 300, 100, clipRect);
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[1]), 300, 0, 800, 100, clipRect);
                    break;

                case DescriptionLineKind.Header3Box:
                    renderer.DrawLine(thickPen, 300, lineTop, 300, lineBottom);
                    renderer.DrawLine(thickPen, 600, lineTop, 600, lineBottom);
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[0]), 0, 0, 300, 100, clipRect);
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[1]), 300, 0, 600, 100, clipRect);
                    RenderSingleLineText(renderer, TITLE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[2]), 600, 0, 800, 100, clipRect);
                    break;

                case DescriptionLineKind.Directive:
                    if (descriptionKind == DescriptionKind.Text) {
                        RenderWrappedText(renderer, TEXT_FONT, StringAlignment.Near, descriptionLine.textual, 15, 0, 785, 100, clipRect);
                    }
                    else {
                        RenderSymbol(renderer, (Symbol)descriptionLine.boxes[0], 0, 0, 800, 100, clipRect);
                        RenderSingleLineText(renderer, DIRECTIVE_FONT, StringAlignment.Center, (string) (descriptionLine.boxes[1]), 300, 0, 500, 100, clipRect);
                        if (descriptionKind == DescriptionKind.SymbolsAndText)
                            RenderWrappedText(renderer, TEXT_FONT, StringAlignment.Near, descriptionLine.textual, 815, 0, 1285, 100, clipRect);
                    }

                    break;

                case DescriptionLineKind.Normal:
                    int numBoxes;
                    if (descriptionKind == DescriptionKind.Text) {
                        renderer.DrawLine(thinPen, 100, lineTop, 100, lineBottom);
                        renderer.DrawLine(thickPen, 200, lineTop, 200, lineBottom);
                        RenderWrappedText(renderer, TEXT_FONT, StringAlignment.Near, descriptionLine.textual, 215, 0, 785, 100, clipRect);
                        numBoxes = 2;
                    }
                    else {
                        renderer.DrawLine(thinPen, 100, lineTop, 100, lineBottom);
                        renderer.DrawLine(thinPen, 200, lineTop, 200, lineBottom);
                        renderer.DrawLine(thickPen, 300, lineTop, 300, lineBottom);
                        renderer.DrawLine(thinPen, 400, lineTop, 400, lineBottom);
                        renderer.DrawLine(thinPen, 500, lineTop, 500, lineBottom);
                        renderer.DrawLine(thickPen, 600, lineTop, 600, lineBottom);
                        renderer.DrawLine(thinPen, 700, lineTop, 700, lineBottom);
                        numBoxes = 8;

                        if (descriptionKind == DescriptionKind.SymbolsAndText) {
                            renderer.DrawLine(thickPen, 1300, lineTop, 1300, lineBottom);
                            RenderWrappedText(renderer, TEXT_FONT, StringAlignment.Near, descriptionLine.textual, 815, 0, 1285, 100, clipRect);
                        }
                    }

                    for (int i = 0; i < numBoxes; ++i) {
                        if (descriptionLine.boxes[i] is Symbol) {
                            RenderSymbol(renderer, (Symbol)descriptionLine.boxes[i], i * 100, 0, i * 100 + 100, 100, clipRect);
                        }
                        else if (descriptionLine.boxes[i] is String) {
                            if (i == 5)
                                RenderColumnFText(renderer, (string)descriptionLine.boxes[i], i * 100, 0, i * 100 + 100, 100, clipRect);
                            else if (i == 0)
                                RenderSingleLineText(renderer, COLUMNA_FONT, StringAlignment.Center, (string) descriptionLine.boxes[i], i * 100, 0, i * 100 + 100, 100, clipRect);
                            else
//.........这里部分代码省略.........
开发者ID:petergolde,项目名称:PurplePen,代码行数:101,代码来源:DescriptionRenderer.cs

示例5: RenderBox

        void RenderBox(IRenderer renderer, Box2d box)
        {
            renderer.PushMatrix();

              renderer.Translate(Logic2World(box.X, box.Y));
              renderer.Rotate(-Vector3.UnitY, box.Rotation);

              float amin = (float)box.Amin;
              float amax = (float)box.Amax;
              float bmin = (float)box.Bmin;
              float bmax = (float)box.Bmax;

              renderer.DrawLine(new Vector3(amin, 0, bmin), new Vector3(amin, 0, bmax));
              renderer.DrawLine(new Vector3(amax, 0, bmin), new Vector3(amax, 0, bmax));
              renderer.DrawLine(new Vector3(amin, 0, bmin), new Vector3(amax, 0, bmin));
              renderer.DrawLine(new Vector3(amin, 0, bmax), new Vector3(amax, 0, bmax));

              renderer.PopMatrix();
        }
开发者ID:Felixdev,项目名称:dogfight2008,代码行数:19,代码来源:Game.cs


注:本文中的IRenderer.DrawLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。