示例#1
0
        public static Ball GenerateBall(GraphicsDevice device, GraphicsDeviceManager graphics, int radius)
        {
            var texture = TextureCreator.CreateCircle(radius * 2, device, Color.Black);

            var ball =
                new Ball(radius,
                         graphics.PreferredBackBufferWidth / 2 - radius,
                         graphics.PreferredBackBufferHeight / 2 - radius, texture);

            return(ball);
        }
示例#2
0
        public static Brick[] GenerateBricks(GraphicsDevice device, int Amount = 20, int Width = 90, int Height = 30)
        {
            var bricks = new Brick[Amount];

            // init brick textures
            for (int i = 0; i < Amount; i++)
            {
                var texture = TextureCreator.CreateRectangle(device, Width, Height);

                bricks[i] = new Brick((i % 10) * Width, (i / 10) * Height, Width, Height, texture);
            }

            return(bricks);
        }