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


C# Rectangle.DrawOutline方法代码示例

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


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

示例1: Draw

        /// <summary>
        ///   Draws this triangle to the screen.
        /// </summary>
        /// <param name="debug">Draws some useful debug information.</param>
        public void Draw(bool debug)
        {
            GameServices.SpriteBatch.DrawLine(1f, Color.White, Point90, Point1);
            GameServices.SpriteBatch.DrawLine(1f, Color.White, Point90, Point2);
            GameServices.SpriteBatch.DrawLine(1f, Color.White, Point1, Point2);

            if (debug)
            {
                // Draw the line coincident to the slope. For the inverted
                // Y-axis, the slope-intercept formula, solved for x, is x = (-y
                // + b) / m
                Vector2 screenSize = GameServices.ScreenSize;
                Vector2 lineStart = new Vector2((-screenSize.Y + YIntersect) / Slope, screenSize.Y);
                Vector2 lineEnd = new Vector2(YIntersect / Slope, 0f);
                GameServices.SpriteBatch.DrawLine(1f, Color.ForestGreen, lineStart, lineEnd);

                // DrawLine is a little weird with drawing the right-triangle -
                // the bounds look visually larger than the triangle, even though
                // they are the right sizes. So we'll correct the bounds so they
                // look right.
                Rectangle drawBounds = new Rectangle((int)Bounds.X + 1, (int)Bounds.Y - 1, (int)Bounds.Width, (int)Bounds.Height);
                drawBounds.DrawOutline(Color.Red);

                // Draw some useful debug information.
                GameServices.DebugFont.DrawString(ToString(), new Vector2(Bounds.X, Bounds.Y));
            }
        }
开发者ID:smldev,项目名称:smlimitless,代码行数:31,代码来源:RightTriangle.cs


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