public override void Draw(SpriteBatch spriteBatch, Vector2 basePosition, Vector2 scale) { Rectangle position = new Rectangle((int)(basePosition.X + x * scale.X), (int)(basePosition.Y + y * scale.Y), (int)(textureRegion.sourceRectangle.Width * scale.X), (int)(textureRegion.sourceRectangle.Height * scale.Y)); textureRegion.Draw(spriteBatch, position, Color.White, 0, new Vector2(), SpriteEffects.None, 0); }
public override void InternalRender(RenderContext context) { base.InternalRender(context); if (Map == null) { return; } UpdateImage(); int x, width; GetScreenHorizontal(out x, out width); var bounds = ActualBounds; bounds.X = x; bounds.Width = width; _image.Draw(context, bounds); var topLeft = GameToScreen(TopLeft); var size = GameToScreen(TopLeft + GridSize.ToVector2()) - topLeft; context.DrawRectangle(new Rectangle(topLeft.X, topLeft.Y, size.X, size.Y), Color.White); }
public void Draw(RenderContext context, Rectangle rect, float opacity = 1.0f) { var r = new Rectangle(rect.X + (rect.Width - TextureRegion.Size.X) / 2, rect.Y + (rect.Height - TextureRegion.Size.Y) / 2, TextureRegion.Size.X, TextureRegion.Size.Y); TextureRegion.Draw(context, r, Color * opacity); }
public void Draw(SpriteBatch batch, Rectangle dest, float opacity = 1.0f) { TextureRegion.Draw(batch, dest, Color * opacity); }