Exemplo n.º 1
0
        protected override void LoadContent()
        {
            font        = Content.Load <SpriteFont>("font");
            spriteBatch = new SpriteBatch(GraphicsDevice);
            ball        = new ClassBall(GraphicsDevice, spriteBatch, this, ballSize);
            P1          = new ClassRacket(GraphicsDevice, spriteBatch, this, racketwidth, racketheight, 10, GraphicsDevice.Viewport.Height / 2 - racketheight / 2);
            P2          = new ClassRacket(GraphicsDevice, spriteBatch, this, racketwidth, racketheight, GraphicsDevice.Viewport.Width - 10 - racketwidth, GraphicsDevice.Viewport.Height / 2 - racketheight / 2);

            Components.Add(ball);
            Components.Add(P1);
            Components.Add(P2);
            ball.ResetBall();
        }
        protected override void LoadContent()
        {
            scorefont   = Content.Load <SpriteFont>("scorefont");
            spriteBatch = new SpriteBatch(GraphicsDevice);
            ball        = new ClassBall(GraphicsDevice, spriteBatch, this, ballSize);

            player1 = new ClassRacket(GraphicsDevice, spriteBatch, this, racketW, racketH, 10, GraphicsDevice.Viewport.Height / 2 - racketH / 2);
            player2 = new ClassRacket(GraphicsDevice, spriteBatch, this, racketW, racketH, GraphicsDevice.Viewport.Width - racketH, GraphicsDevice.Viewport.Height / 2 - racketH / 2);

            Components.Add(player1);
            Components.Add(player2);
            Components.Add(ball);

            ball.Reetball();
        }
Exemplo n.º 3
0
        protected override void LoadContent()
        {
            //The font for the scores that show.
            font = Content.Load <SpriteFont>("font");

            //The balls size will be loaded from the ClassBall to the program.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            ball        = new ClassBall(GraphicsDevice, spriteBatch, this, ballSize);

            //Both players will be loaded from the ClassRacket to the program
            P1 = new ClassRacket(GraphicsDevice, spriteBatch, this, racketWidth, racketHeight, 10, GraphicsDevice.Viewport.Height / 2 - racketHeight / 2);
            P2 = new ClassRacket(GraphicsDevice, spriteBatch, this, racketWidth, racketHeight, GraphicsDevice.Viewport.Width - 10 - racketWidth, GraphicsDevice.Viewport.Height / 2 - racketHeight / 2);

            Components.Add(P1);
            Components.Add(P2);
            Components.Add(ball);

            ball.ResetBall();
        }