public override void Draw(SpriteBatch spriteBatch, TextureFrameStore textureFrames) { if (BorderWidth > 0) { this.DrawBorder(spriteBatch, textureFrames, BorderWidth, BorderColor); } Elements.ForEach(x => x.Draw(spriteBatch, textureFrames)); }
/// <summary> /// Will draw a border (hollow rectangle) of the given 'thicknessOfBorder' (in pixels) /// of the specified color. /// /// By Sean Colombo, from http://bluelinegamestudios.com/blog /// </summary> /// <param name="rectangleToDraw"></param> /// <param name="thicknessOfBorder"></param> public static void DrawBorder(this IVisualElement element, SpriteBatch spriteBatch, TextureFrameStore textureFrames, int thicknessOfBorder, Color borderColor) { var pixel = textureFrames["pixel"].Texture; var rectangleToDraw = element.BoundaryBox; // Draw top line spriteBatch.Draw(pixel, new Rectangle(rectangleToDraw.X, rectangleToDraw.Y, rectangleToDraw.Width, thicknessOfBorder), borderColor); // Draw left line spriteBatch.Draw(pixel, new Rectangle(rectangleToDraw.X, rectangleToDraw.Y, thicknessOfBorder, rectangleToDraw.Height), borderColor); // Draw right line spriteBatch.Draw(pixel, new Rectangle((rectangleToDraw.X + rectangleToDraw.Width - thicknessOfBorder), rectangleToDraw.Y, thicknessOfBorder, rectangleToDraw.Height), borderColor); // Draw bottom line spriteBatch.Draw(pixel, new Rectangle(rectangleToDraw.X, rectangleToDraw.Y + rectangleToDraw.Height - thicknessOfBorder, rectangleToDraw.Width, thicknessOfBorder), borderColor); }
public override void Draw(SpriteBatch spriteBatch, TextureFrameStore textureFrames) { Sprite.Draw(spriteBatch); DrawText(spriteBatch); }
public IButtonBuilder SetTextureFrame(string key, TextureFrameStore textureFrames) { _Button.SetFrame(textureFrames[key]); return(this); }
public void Draw(SpriteBatch spriteBatch, TextureFrameStore textureFrames) { Sprite.Animate(Frame); Sprite.Draw(spriteBatch); DrawText(spriteBatch); }