示例#1
0
 /// <summary>
 /// UnloadContent will be called once per game and is the place to unload
 /// all content.
 /// </summary>
 protected override void UnloadContent()
 {
     // TODO: Unload any non ContentManager content here
     _ball = null;
     _ballPhysics = null;
     _font1 = null;
     _spriteBatch = null;
     _bg = null;
 }
示例#2
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
            _bg = Content.Load<Texture2D>("bg");

            _ball = new Ball();
            _ball.Sprite = Content.Load<Texture2D>("arrowLeftButton");
            _ball.BeepSound = Content.Load<SoundEffect>("hit-pipe");
            // at begin place ball in the center of screen
            _ball.Position = new Vector2(_graphics.PreferredBackBufferWidth / 2, _graphics.PreferredBackBufferHeight / 2);

            _ballPhysics = new BallPhysics(_ball, _graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight);

            _font1 = Content.Load<SpriteFont>("font1");

            _fps = new FpsCounter();
            _fps.Font = _font1;
            _fps.Position = new Vector2(10, 10);
            _fps.Color = Color.Yellow;
        }