예제 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            var gameboundaries = new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height);
            var paddleTexture = Content.Load<Texture2D>("Paddle");

            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _playerPaddle = new Paddle(Content.Load<Texture2D>("Paddle"), Vector2.Zero, gameboundaries, PlayerTypes.Human);

            var computerPaddleLocation = new Vector2(Window.ClientBounds.Width - paddleTexture.Width, 0);
            _computerPaddle = new Paddle(Content.Load<Texture2D>("Paddle"), computerPaddleLocation , gameboundaries, PlayerTypes.Computer);
            _ball = new Ball(Content.Load<Texture2D>("Ball"), Vector2.Zero, gameboundaries);
            _ball.AttachTo(_playerPaddle);
            Score = new Score(Content.Load<SpriteFont>("NewSpriteFont"),gameboundaries);

            GameObjects = new GamesObjects { PlayerPaddle = _playerPaddle, Computeraddle = _computerPaddle, Ball = _ball, Score = Score};
            // TODO: use this.Content to load your game content here
        }