本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.SpriteBatch.FillRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# SpriteBatch.FillRectangle方法的具体用法?C# SpriteBatch.FillRectangle怎么用?C# SpriteBatch.FillRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.SpriteBatch
的用法示例。
在下文中一共展示了SpriteBatch.FillRectangle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
{
switch (_currentMap)
{
case SimulationScreenMap.Urban: _playerGame.UrbanMap.Draw(gameTime); break;
case SimulationScreenMap.Country: _playerGame.CountryMap.Draw(gameTime); break;
case SimulationScreenMap.Ocean: _playerGame.OceanMap.Draw(gameTime); break;
}
spriteBatch.DrawLine(150, 0, 150, graphicsDevice.Viewport.Height, Color.White);
spriteBatch.DrawLine(0, graphicsDevice.Viewport.Height - 100, graphicsDevice.Viewport.Width,
graphicsDevice.Viewport.Height - 100, Color.White);
/* Area selection */
Rectangle areaSelectionUrban = new Rectangle(5, graphicsDevice.Viewport.Height - 148, 43, 43);
Rectangle areaSelectionCountry = new Rectangle(53, graphicsDevice.Viewport.Height - 148, 43, 43);
Rectangle areaSelectionOcean = new Rectangle(101, graphicsDevice.Viewport.Height - 148, 43, 43);
spriteBatch.DrawRectangle(0, graphicsDevice.Viewport.Height - 174, 150, 75, Color.White);
spriteBatch.FillRectangle(areaSelectionUrban, (_currentMap == SimulationScreenMap.Urban ?
Color.LightGray : Color.Gray));
spriteBatch.DrawRectangle(areaSelectionUrban, Color.White);
spriteBatch.FillRectangle(areaSelectionCountry, (_currentMap == SimulationScreenMap.Country ?
Color.LightGray : Color.Gray));
spriteBatch.DrawRectangle(areaSelectionCountry, Color.White);
spriteBatch.FillRectangle(areaSelectionOcean, (_currentMap == SimulationScreenMap.Ocean ?
Color.LightGray : Color.Gray));
spriteBatch.DrawRectangle(areaSelectionOcean, Color.White);
}
开发者ID:jyavoc,项目名称:Project-Gaia,代码行数:28,代码来源:SimulationScreen+(Jacob+Deitloff's+conflicted+copy+2011-03-18).cs
示例2: DrawHealthBar
public void DrawHealthBar(Vector2 position, SpriteBatch b)
{
if (Alive)
{
Rectangle barBG = new Rectangle((int)position.X, (int)position.Y, 100, 15);
Rectangle bar = new Rectangle((int)position.X, (int)position.Y, (int)(100 * (Percent / 100f)), 15);
b.FillRectangle(barBG, Color.White);
b.FillRectangle(bar, Color.Red);
}
}
示例3: Draw
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.FillRectangle(Position, Size, BaseColor);
spriteBatch.DrawRectangle(Position, Size, BorderColor);
spriteBatch.DrawString(Font, Label + ": " + CurrentValue + " / " + MaxValue,
new Vector2(Position.X + 1, Position.Y + Size.Y - Font.MeasureString(Label + ": " +
CurrentValue + " / " + MaxValue).Y), TextColor);
}
示例4: Draw
public void Draw(SpriteBatch b)
{
// Get starting position
float startingPos = 1280 - ((25 + 5) * playerRef.Lives);
for (int i = 0; i < playerRef.Lives; i++)
{
float position = startingPos + ((25 + 25) * i);
b.Draw(livesTexture, new Vector2(position, 15), null, Color.White, 0f, Vector2.Zero, 0.75f, SpriteEffects.None, 0f);
}
b.Draw(coinTexture, new Vector2(1180, 90), null, Color.White, 0f, Vector2.Zero, 0.85f, SpriteEffects.None, 0f);
b.DrawString(font, playerRef.CoinsCollected.ToString(), new Vector2(1240, 95), Color.Black);
float mapProgression = (playerRef.Position.X / mapWidth);
b.FillRectangle(new Vector2(540, 10), new Vector2(400, 20), Color.WhiteSmoke);
b.FillRectangle(new Vector2(540 + (400 * mapProgression), 10), new Vector2(5, 20), Color.Black);
}
示例5: DrawTooltip
public void DrawTooltip(SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
{
if (!hasTooltip)
return;
MouseState mouseState = Mouse.GetState();
int widthOfTooltip = graphicsDevice.Viewport.Width - mouseState.X - 18; // right padding, width of cursor
bool tooltipToRightOfMouse = true;
if (widthOfTooltip < 240)
{
tooltipToRightOfMouse = false;
widthOfTooltip = mouseState.X - 5; // left padding
}
string[] tooltipLines = Skin.TooltipFont.WordWrap(Tooltip,
widthOfTooltip);
Vector2 tooltipSize = Skin.TooltipFont.MeasureStringMultiline(tooltipLines);
tooltipSize.X += 2 * TooltipPadding;
Vector2 tooltipLocation = new Vector2(mouseState.X + (tooltipToRightOfMouse ? 13 : 0),
(mouseState.Y + tooltipSize.Y + 5 <
graphicsDevice.Viewport.Height ? mouseState.Y : mouseState.Y - tooltipSize.Y));
spriteBatch.FillRectangle(tooltipLocation, tooltipSize, Color.Beige);
spriteBatch.DrawRectangle(tooltipLocation, tooltipSize, Color.Black);
spriteBatch.DrawStrings(Skin.TooltipFont, tooltipLines, tooltipLocation + new Vector2(TooltipPadding, 0),
Color.Black);
}
示例6: DrawAt
public override void DrawAt(GameTime gameTime, SpriteBatch spriteBatch, Vector2 pos, Vector2 size)
{
spriteBatch.FillRectangle(pos, size, ColorProperty);
}
示例7: Draw
public virtual void Draw(SpriteBatch sb, GameTime gameTime)
{
sb.FillRectangle(size, color);
}
示例8: DrawPhysicalContacts
public void DrawPhysicalContacts(SpriteBatch spriteBatch)
{
var numContacts = 0;
var contact = World.GetContactList();
var drawingSize = new Vector2(4.0f, 4.0f);
while (contact != null)
{
++numContacts;
Manifold manifold;
contact.GetManifold(out manifold);
WorldManifold worldManifold;
contact.GetWorldManifold(out worldManifold);
for (int i = 0; i < manifold._pointCount; i++)
{
var point = worldManifold._points[i];
spriteBatch.FillRectangle(point - drawingSize / 2, drawingSize, Microsoft.Xna.Framework.Color.Lime);
}
contact = contact.GetNext();
}
if (game.drawDebugData.IsVerbose)
{
game.DrawOnScreen("Physical contacts: " + numContacts.ToString());
}
}
示例9: Draw
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
spriteBatch.FillRectangle(Position, Size, (Hovered ? Color.LightBlue : Color.Blue));
spriteBatch.DrawRectangle(Position, Size, Color.Black);
}
示例10: Draw
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.FillRectangle(new Vector2(this.x, this.y), new Vector2(this.size*2, this.size), this.color);
//spriteBatch.DrawString();
}
示例11: Draw
public void Draw(SpriteBatch spriteBatch)
{
if (world == null)
{
return;
}
foreach (var body in world.bodies)
{
var debugData = GetDebugDataForBody(body);
foreach (var bodyPart in body.bodyParts)
{
DrawShape(debugData, spriteBatch, bodyPart.shape, body.transform);
}
}
foreach (var body in world.bodies)
{
var debugData = GetDebugDataForBody(body);
var boundingBox = body.calculateBoundingBox();
spriteBatch.DrawRectangle(scBoundingUtils.toXNARectangle(boundingBox), debugData.BodyBoundingBoxColor);
// Draw rotation as a line.
var rotated = new Vector2(debugData.BodyTransformRotationRadius, 0).Rotate(body.transform.rotation.radians);
spriteBatch.DrawLine(body.transform.position, body.transform.position + rotated, debugData.BodyTransformRotationColor);
// Draw position.
var center = new Rectangle();
center.Width = debugData.BodyTransformPositionExtents;
center.Height = debugData.BodyTransformPositionExtents;
center.X = (int)(body.transform.position.X - center.Width / 2.0f);
center.Y = (int)(body.transform.position.Y - center.Height / 2.0f);
spriteBatch.FillRectangle(center, debugData.BodyTransformPositionColor);
// Draw linear velocity
spriteBatch.DrawLine(body.transform.position, body.transform.position + body.linearVelocity, debugData.BodyLinearVelocityColor);
}
// Draw view bounds
spriteBatch.DrawRectangle(scBoundingUtils.toXNARectangle(world.viewBounds), ViewBoundsColor);
bodyMap.Clear();
}