當前位置: 首頁>>代碼示例>>C#>>正文


C# SpriteBatch.DrawOutline方法代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.Graphics.SpriteBatch.DrawOutline方法的典型用法代碼示例。如果您正苦於以下問題:C# SpriteBatch.DrawOutline方法的具體用法?C# SpriteBatch.DrawOutline怎麽用?C# SpriteBatch.DrawOutline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.Xna.Framework.Graphics.SpriteBatch的用法示例。


在下文中一共展示了SpriteBatch.DrawOutline方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Draw

 public void Draw(SpriteBatch sb, Game1 game)
 {
     if (layer != null)
     {
         for (int i = 0; i < layer.parts.Count; i++)
         {
             if (selectedPart == i)
             {
                 MapPart fp = layer.parts[selectedPart];
                 sb.DrawOutline(pixel, Util.RotateRectangle(fp.origin, fp.position, fp.scale, fp.rotation), Color.White * 0.5f);
             }
         }
         if (selectedPart == -1)
         {
             for (int i = layer.parts.Count - 1; i >= 0; i--)
             {
                 MapPart fp = layer.parts[i];
                 if (Util.RotateRectangle(fp.origin, fp.position, fp.scale, fp.rotation).Contains(game.MPos.X, game.MPos.Y))
                 {
                     sb.Draw(pixel, Util.RotateRectangle(fp.origin, fp.position, fp.scale, fp.rotation), Color.Red * 0.1f);
                     sb.DrawOutline(pixel, Util.RotateRectangle(fp.origin, fp.position, fp.scale, fp.rotation), Color.Red * 0.8f);
                     break;
                 }
             }
         }
     }
 }
開發者ID:eriksk,項目名稱:NibLibMapEditor,代碼行數:27,代碼來源:LayerComponent.cs

示例2: Draw

 public void Draw(SpriteBatch sb)
 {
     if (k.IsKeyDown(Keys.LeftShift))
     {
         sb.Draw(pixel, rect, Color.Black * 0.2f);
         sb.DrawOutline(pixel, rect, Color.Black);
         sb.Draw(texture, rect, Color.White * 0.8f);
         if (rect.Contains(m.X, m.Y))
         {
             if (m.LeftButton == ButtonState.Pressed || om.LeftButton == ButtonState.Pressed)
             {
                 sb.DrawOutline(pixel, new Rectangle(rect.X + source.X, rect.Y + source.Y, source.Width, source.Height), Color.Red);
             }
         }
     }
 }
開發者ID:eriksk,項目名稱:Animet,代碼行數:16,代碼來源:TextureContainer.cs

示例3: Draw

 public void Draw(SpriteBatch sb)
 {
     sb.Draw(pixel, rect, bgColor);
     sb.DrawOutline(pixel, rect, Color.Black);
     if (anim != null)
     {
         anim.Draw(sb, new Vector2(rect.Center.X, rect.Center.Y), false);
     }
 }
開發者ID:eriksk,項目名稱:Animet,代碼行數:9,代碼來源:AnimationComponent.cs

示例4: Draw

 public void Draw(SpriteBatch sb)
 {
     sb.Draw(pixel, rect, bgColor);
     sb.DrawOutline(pixel, rect, Color.Black);
     if (rect.Contains(m.X, m.Y))
     {
         sb.Draw(pixel, rect, Color.White * 0.5f);
     }
     sb.DrawString(font, text, new Vector2(rect.X + padding, rect.Y + padding), Color.White);
 }
開發者ID:eriksk,項目名稱:Animet,代碼行數:10,代碼來源:Button.cs

示例5: Draw

 public void Draw(SpriteBatch sb)
 {
     sb.Draw(pixel, rect, bgColor);
     sb.DrawOutline(pixel, rect, Color.Black);
     if (frame != null)
     {
         sb.DrawOutline(pixel, new Rectangle(rect.Left, rect.Center.Y, rect.Width, 1), Color.Black * 0.5f);
         sb.DrawOutline(pixel, new Rectangle(rect.Center.X, rect.Top, 1, rect.Height), Color.Black * 0.5f);
         Vector2 pos = new Vector2(rect.Center.X, rect.Center.Y);
         frame.Draw(sb, pos, false);
         for (int i = 0; i < frame.parts.Count; i++)
         {
             if (selectedPart == i)
             {
                 FramePart fp = frame.parts[selectedPart];
                 sb.DrawOutline(pixel, Util.RotateRectangle(fp.origin, pos + fp.position, fp.scale, fp.rotation), Color.White * 0.5f);
             }
         }
     }
 }
開發者ID:eriksk,項目名稱:Animet,代碼行數:20,代碼來源:FrameContainer.cs

示例6: Draw

        public void Draw(SpriteBatch sb, Game1 game)
        {
            for (int i = 0; i < ledges.Count; i++)
            {
                ledges[i].Draw(sb, pixel, selectedLedge == i);
            }

            for (int i = 0; i < grid.GetLength(0); i++)
            {
                for (int j = 0; j < grid.GetLength(1); j++)
                {
                    if (grid[i, j] != 0)
                    {
                        sb.Draw(pixel, new Rectangle(i * Map.CELL_SIZE, j * Map.CELL_SIZE, Map.CELL_SIZE, Map.CELL_SIZE), Color.Red * 0.2f);
                    }
                    else
                    {
                        sb.DrawOutline(pixel, new Rectangle(i * Map.CELL_SIZE, j * Map.CELL_SIZE, Map.CELL_SIZE, Map.CELL_SIZE), Color.Red * 0.2f);
                    }
                }
            }
        }
開發者ID:eriksk,項目名稱:NibLibMapEditor,代碼行數:22,代碼來源:CollisionComponent.cs

示例7: Draw

 public void Draw(SpriteBatch sb)
 {
     sb.Draw(pixel, rect, bgColor);
     sb.DrawOutline(pixel, rect, Color.Black);
     sb.DrawString(font, nameable.Name + (showCursor ? "" : "|"), new Vector2(rect.X + padding, rect.Y + padding), Color.White);
 }
開發者ID:eriksk,項目名稱:Animet,代碼行數:6,代碼來源:TextBox.cs


注:本文中的Microsoft.Xna.Framework.Graphics.SpriteBatch.DrawOutline方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。