public static IEnumerable <Brick> GenerateBricks(int width, int height, int rows, int cols, Color color, SpriteBatch spriteBatch) { Texture2D texture = TextureBuilder.BuildTexture(width, height, color, spriteBatch); for (var y = 0; y < cols; ++y) { for (var x = 0; x < rows; ++x) { yield return(new Brick(width, height, new Vector2(x * width, y * height), spriteBatch, texture)); } } }
public Paddle(int width, int height, Vector2 position, SpriteBatch spriteBatch) : base(width, height, position) { this.spriteBatch = spriteBatch; paddle = TextureBuilder.BuildTexture(width, height, Color.Chocolate, spriteBatch); }
public Brick(int width, int height, Vector2 position, SpriteBatch spriteBatch) : base(width, height, position) { this.spriteBatch = spriteBatch; brick = TextureBuilder.BuildTexture(width, height, color, spriteBatch); }
public Ball(int width, int height, Vector2 position, SpriteBatch spriteBatch) : base(width, height, position) { this.spriteBatch = spriteBatch; ball = TextureBuilder.BuildTexture(width, height, Color.White, spriteBatch); }