/// <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 }
protected override void LoadContent() { base.LoadContent (); paddleOne = new Paddle (game, spriteBatch); paddleOne.Direction = new Vector2 (0, 0); paddleTwo = new Paddle (game, spriteBatch); paddleTwo.Direction = new Vector2 (0, 0); ball = new Ball (game, spriteBatch); ball.Direction = new Vector2 (0, 0); paddleOne.LoadContent (content); paddleOne.Position = new Vector2 (20, 20); paddleTwo.LoadContent (content); paddleTwo.Position = new Vector2 (GraphicsDevice.Viewport.Width - 40, GraphicsDevice.Viewport.Height - 100); ball.LoadContent (content); ball.Position = new Vector2 (GraphicsDevice.Viewport.Width + 10, 0); }