Beispiel #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.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            score      = Content.Load <SpriteFont>("score");
            fontPos    = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
            lPos       = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 - 100, graphics.GraphicsDevice.Viewport.Height / 2 + 50);
            rPos       = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2 + 100, graphics.GraphicsDevice.Viewport.Height / 2 + 50);
            leftScore  = Content.Load <SpriteFont>("score");
            rightScore = Content.Load <SpriteFont>("score");

            left.LoadContent(this.Content);
            left.Position = new Vector2(20,
                                        GraphicsDevice.Viewport.Height / 2 - left.Source.Height / 2);
            right.LoadContent(this.Content);
            right.Position = new Vector2(GraphicsDevice.Viewport.Width - 20 - right.Source.Width,
                                         GraphicsDevice.Viewport.Height / 2 - right.Source.Height / 2);
            right.MovementCtrl(Keys.Up, Keys.Down);
            mBall.LoadContent(this.Content);
            mBall.Position = new Vector2(GraphicsDevice.Viewport.Width / 2 - mBall.Source.Width / 2,
                                         GraphicsDevice.Viewport.Height / 2 - mBall.Source.Height / 2); //need to fix for resetting
        }