Example #1
0
        protected GameState(string name, Application application, bool useApplicationContent, int bufferWidth, int bufferHeight, DetailPreference precisionMode, DetailPreference lightingRange)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("No valid name was provided to the GameState", "name");

            if (application == null)
                throw new ArgumentNullException("application", "No valid Application instance provided to the GameState");

            Name = name;
            Application = application;


            if (useApplicationContent)
            {
                Content = new ContentCatalogue(application);
            }
            else
            {
                _localContentManager = new ContentManager(application.Services, application.Content.RootDirectory);
                Content = new ContentCatalogue(application, _localContentManager);
            }
            // We create the IContentOwner List that will get populated with Content to be loaded with the GameState creation
            ContentToLoad = new List<IContentHost>();

            // create the SceneInterface instance from the Application
            SunBurn = Application.SunBurn;

            // create the Framebuffers and assigns the ownership to the SceneInterface
            CreateFrameBuffers(bufferWidth, bufferHeight, precisionMode, lightingRange);

            Application.GraphicsDevice.DeviceReset += new EventHandler<EventArgs>(GraphicsDevice_DeviceReset);
        }
Example #2
0
        private void CreateFrameBuffers(int bufferWidth, int bufferHeight, DetailPreference precisionMode, DetailPreference lightingRange)
        {
            //if (_frameBuffers != null)
            //    _frameBuffers.Unload();

            _frameBuffers = new FrameBuffers(bufferWidth, bufferHeight, precisionMode, lightingRange);
            SunBurn.ResourceManager.AssignOwnership(_frameBuffers);
        }
Example #3
0
 private void CreateFrameBuffers(int bufferWidth, int bufferHeight, DetailPreference precisionMode, DetailPreference lightingRange)
 {
     if (_frameBuffers != null)
         _frameBuffers.Unload();
     
     _frameBuffers = new FrameBuffers(bufferWidth, bufferHeight, precisionMode, lightingRange);
     SunBurn.ResourceManager.AssignOwnership(_frameBuffers);
 }
Example #4
0
        protected GameState(string name, Application application, bool useApplicationContent, int bufferWidth, int bufferHeight, DetailPreference precisionMode, DetailPreference lightingRange)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("No valid name was provided to the GameState", "name");
            }

            if (application == null)
            {
                throw new ArgumentNullException("application", "No valid Application instance provided to the GameState");
            }

            Name        = name;
            Application = application;


            if (useApplicationContent)
            {
                Content = new ContentCatalogue(application);
            }
            else
            {
                _localContentManager = new ContentManager(application.Services, application.Content.RootDirectory);
                Content = new ContentCatalogue(application, _localContentManager);
            }
            // We create the IContentOwner List that will get populated with Content to be loaded with the GameState creation
            ContentToLoad = new List <IContentHost>();

            // create the SceneInterface instance from the Application
            SunBurn = Application.SunBurn;

            // create the Framebuffers and assigns the ownership to the SceneInterface
            _frameBuffers = new FrameBuffers(bufferWidth, bufferHeight, precisionMode, lightingRange);
            SunBurn.ResourceManager.AssignOwnership(_frameBuffers);
        }
Example #5
0
 /// <summary>
 ///   Creates a new instance of the SunBurnGameState
 /// </summary>
 /// <param name = "name">The name of the GameState</param>
 /// <param name = "application">The Application instance</param>
 /// <param name = "bufferWidth">Custom buffer width</param>
 /// <param name = "bufferHeight">Custom buffer height</param>
 /// <param name = "precisionMode">Increases visual quality at the cost of performance.  Generally used in visualizations, most games do not need this option.</param>
 /// <param name = "lightingRange">Increases lighting quality at the cost of performance.  Adds additional lighting range when using HDR.</param>
 protected GameState(string name, Application application, int bufferWidth, int bufferHeight,
                     DetailPreference precisionMode, DetailPreference lightingRange) : this(name, application, false, bufferWidth, bufferHeight, precisionMode, lightingRange)
 {
 }
Example #6
0
 /// <summary>
 ///   Creates a new instance of the SunBurnGameState
 /// </summary>
 /// <param name = "name">The name of the GameState</param>
 /// <param name = "application">The Application instance</param>
 /// <param name = "bufferWidth">Custom buffer width</param>
 /// <param name = "bufferHeight">Custom buffer height</param>
 /// <param name = "precisionMode">Increases visual quality at the cost of performance.  Generally used in visualizations, most games do not need this option.</param>
 /// <param name = "lightingRange">Increases lighting quality at the cost of performance.  Adds additional lighting range when using HDR.</param>
 protected GameState(string name, Application application, int bufferWidth, int bufferHeight,
                     DetailPreference precisionMode, DetailPreference lightingRange) : this(name, application, false, bufferWidth, bufferHeight, precisionMode, lightingRange)
 {
 }