Example #1
0
        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));
                }
            }
        }
Example #2
0
 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);
 }
Example #3
0
 public Brick(int width, int height, Vector2 position, SpriteBatch spriteBatch) : base(width, height, position)
 {
     this.spriteBatch = spriteBatch;
     brick            = TextureBuilder.BuildTexture(width, height, color, spriteBatch);
 }
Example #4
0
 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);
 }