本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
示例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);
}