Example #1
0
        /// <summary>
        /// Dispose all managers.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (fpsCounter != null)
            {
                fpsCounter = null;
            }

            if (textManager != null)
            {
                textManager.Dispose();
                textManager = null;
            }

            if (fontManager != null)
            {
                fontManager.Dispose();
                fontManager = null;
            }

            inputManager = null;

            if (collisionContext != null)
            {
                collisionContext.ClearAllLayer();
                collisionContext = null;
            }

            if (particleManager != null)
            {
                particleManager.ClearAllParticles();
                particleManager = null;
            }

            if (soundManager != null)
            {
                soundManager.Dispose();
                soundManager = null;
            }

            if (screenManager != null)
            {
                screenManager.Dispose();
                screenManager = null;
            }

            if (viewer != null)
            {
                viewer.Dispose();
                viewer = null;
            }

            if (resourceManager != null)
            {
                resourceManager.Dispose();
                resourceManager = null;
            }
            
            if (debugFont != null)
                debugFont = null;

            base.Dispose(disposing);
        }
Example #2
0
        /// <summary>
        /// Core framework constructor.
        /// </summary>
        public FrameworkCore() : base()
        {
            game = this;

            graphicsDeviceManager = new GraphicsDeviceManager(this);
            viewer = new Viewer(this);
            inputManager = new InputComponentManager();
            fontManager = new FontManager();
            screenManager = new GameScreenManager(this);
            textManager = new TextManager(this);
            resourceManager = new ResourceManager(this, "Content");
            particleManager = new ParticleManager();
            collisionContext = new CollisionContext();
            soundManager = new SoundManager();
            gameEventManager = new GameEventManager();
            fpsCounter = new FpsCounter();

            //  Entry GameScreenManager
            AddComponent(screenManager);

            // Disable vertical retrace to get highest framerates possible for
            // testing performance.
            //graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;

            // Update as fast as possible, do not use fixed time steps
            IsFixedTimeStep = false;
        }