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


C# SpriteBatch.DrawRect方法代码示例

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


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

示例1: Draw

        public void Draw(SpriteBatch batch)
        {
            if (IsAlive)
            {
                var color = Faction == Faction.Ally ? Color.Blue : Color.Red;
                batch.DrawRect(Position, 20, color);

                if (currentTarget != null)
                {
                    if (!currentTarget.Faction.IsHostile(Faction))
                        color = Color.Green;

                    var dir = currentTarget.Position - Position;
                    //dir.Normalize();
                    dir *= (AP / 100);

                    batch.DrawLine(Position, Position + dir, color, 2);
                }

            }
        }
开发者ID:xposure,项目名称:Demo,代码行数:21,代码来源:Character.cs

示例2: GoalDraw3072

 void GoalDraw3072(SpriteBatch _spriteBatch)
 {
     _spriteBatch.DrawRect(popupRect, Color.DeepSkyBlue, 2.0f);
     _spriteBatch.DrawString(Assets.daFont, "Congratulations! You made it to 3072! Press Space to remove this message or R to restart.", new Vector2(popupRect.X, popupRect.Y), Color.White);
 }
开发者ID:Coteh,项目名称:2048Clone,代码行数:5,代码来源:Game1.cs

示例3: OverlayDraw

 void OverlayDraw(SpriteBatch _spriteBatch)
 {
     _spriteBatch.DrawRect(topHUDRect, Color.Orange);
     _spriteBatch.DrawString(Assets.daFont, "Score: " + gameBoard.Score, Vector2.Zero, Color.Black);
     _spriteBatch.DrawString(Assets.daFont, "Highscore: " + gameBoard.HighScore, new Vector2(GraphicsDevice.Viewport.Width - 200,0), Color.Black);
 }
开发者ID:Coteh,项目名称:2048Clone,代码行数:6,代码来源:Game1.cs

示例4: GameOverDraw

 void GameOverDraw(SpriteBatch _spriteBatch)
 {
     _spriteBatch.DrawRect(popupRect, Color.Red, 2.0f);
     _spriteBatch.DrawString(Assets.daFont, "Game Over! Press R to try again", new Vector2(popupRect.X,popupRect.Y), Color.Black);
 }
开发者ID:Coteh,项目名称:2048Clone,代码行数:5,代码来源:Game1.cs

示例5: GoalDraw2048

 void GoalDraw2048(SpriteBatch _spriteBatch)
 {
     _spriteBatch.DrawRect(popupRect, Color.Lime, 2.0f);
     _spriteBatch.DrawString(Assets.daFont, "Congratulations! You made it to 2048! Press Space to remove this message or R to restart.", new Vector2(popupRect.X, popupRect.Y), Color.Black);
 }
开发者ID:Coteh,项目名称:2048Clone,代码行数:5,代码来源:Game1.cs

示例6: OnDraw

 protected override void OnDraw(GameTime time, SpriteBatch batch, Vector2 v2Offset)
 {
     if (_v2SelectionBoundInitial == s_v2OutOfBounds) return;
     var v2Start = CursorToFromWorld(_v2SelectionBoundInitial, false);
     var v2End   = CursorPosition;
     batch.DrawRect(v2Start, v2End, Color.Yellow, 2);
 }
开发者ID:zdawson,项目名称:Marooned,代码行数:7,代码来源:HUD.cs

示例7: DrawBoundingBox

 private void DrawBoundingBox(SpriteBatch spriteBatch, Camera camera, Color color, NonAxisAlignedBoundingBox box)
 {
     var blank = StateMachine.Owner.RenderManager.TextureCache.GetResource("blank");
     spriteBatch.DrawRect(blank, box, 5, color);
 }
开发者ID:pquinn,项目名称:time-sink,代码行数:5,代码来源:SelectionEditorState.cs

示例8: Draw

 public void Draw(SpriteBatch _spriteBatch)
 {
     for (int i = 0; i < board.GetLength(0); i++) {
         for (int j = 0; j < board.GetLength(1); j++) {
             if (board[i, j] != 0) {
                 _spriteBatch.DrawRect(tilesRectArr[i, j], colorHolder.GetColor(board[i,j]), 1);
                 _spriteBatch.DrawString(Assets.daFont, "" + board[i, j], new Vector2((i * (boardConfig.tileWidth * scale)) + ((boardConfig.tileWidth * scale) / 3) + position.X, (j * (boardConfig.tileHeight * scale)) + ((boardConfig.tileHeight * scale) / 3) + position.Y), Color.Black);
             }
         }
     }
 }
开发者ID:Coteh,项目名称:2048Clone,代码行数:11,代码来源:GameBoard.cs

示例9: Draw

 public override void Draw(GameTime time, SpriteBatch batch)
 {
     batch.DrawRect(Tile.PositionRender, Tile.PositionRender + Vector2.One * Tile.TILE_SIZE);
     Sprite.Draw(batch, Rotation, s_v2RotationCenter, float.Epsilon);
 }
开发者ID:zdawson,项目名称:Marooned,代码行数:5,代码来源:Projectile.cs

示例10: Draw

 public override void Draw(SpriteBatch batch)
 {
     batch.DrawRect(Position - Size * 0.5f, Position + Size * 0.5f, Colour);
     batch.DrawText(Font, Label, Position, Colour.Invert(), true);
 }
开发者ID:zdawson,项目名称:Marooned,代码行数:5,代码来源:DebugSpatial.cs


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