Exemple #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            ballTexture = Content.Load<Texture2D>("ballNew");
            greenPaddleTexture = Content.Load<Texture2D>("newPaddleGreen");
            bluePaddleTexture = Content.Load<Texture2D>("newPaddleBlue");

            horizontalBlur = Content.Load<Effect>("BlurHorizontally");
            verticalBlur = Content.Load<Effect>("BlurVertically");

            font = Content.Load<SpriteFont>("ScoreFont");

            pp = GraphicsDevice.PresentationParameters;

            blurHr = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth / 2, pp.BackBufferHeight / 2);
            blurVr = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth / 2, pp.BackBufferHeight / 2);
            wholeScene = new RenderTarget2D(GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight);

            ball = new Ball(graphics, ballTexture);
            paddle1 = new Paddle(graphics,
                                greenPaddleTexture,
                                new Vector2((float) greenPaddleTexture.Width / 2, (float) graphics.PreferredBackBufferHeight / 2),
                                Keys.A,
                                Keys.Z);
            paddle2 = new Paddle(graphics,
                                 bluePaddleTexture,
                                 new Vector2((float) graphics.PreferredBackBufferWidth - bluePaddleTexture.Width / 2, (float) graphics.PreferredBackBufferHeight / 2),
                                 Keys.Up,
                                 Keys.Down);
            gameMessage = new GameMessageManager(paddle1, paddle2, ball);
        }
 public GameMessageManager(Paddle paddle1, Paddle paddle2, Ball ball)
 {
     this.paddle1 = paddle1;
     this.paddle2 = paddle2;
     this.ball = ball;
 }