Example #1
0
        /// <summary>
        /// Release graphics data.
        /// </summary>
        public override void UnloadContent()
        {
            if (starfield != null)
            {
                starfield.UnloadContent();
                starfield = null;
            }

            base.UnloadContent();
        }
Example #2
0
 /// <summary>
 /// Disposes this object.
 /// </summary>
 /// <param name="disposing">
 /// True if this method was called as part of the Dispose method.
 /// </param>
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         lock (this)
         {
             if (starfield != null)
             {
                 starfield.Dispose();
                 starfield = null;
             }
         }
     }
 }
Example #3
0
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the ScreenManager, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            movement = 0f;

            starfield = new Starfield(
                Vector2.Multiply(new Vector2(
                    (float)Math.Cos(movement / starsParallaxPeriod),
                    (float)Math.Sin(movement / starsParallaxPeriod)),
                    starsParallaxAmplitude),
                ScreenManager.GraphicsDevice, new ContentManager(ScreenManager.Game.Services, "Content"),
                ScreenManager);
            starfield.LoadContent();

            base.LoadContent();
        }