示例#1
0
        /** @fn     ModuleLoader( GameServiceContainer services, XNAModularApp app )
         *  @brief  constructor
         *  @param  services [in] something the content manager needs... haven't looked into it
         *  @param  app [in] the application the loader belongs to
         */
        public ModuleLoader(GameServiceContainer services, XNAModularApp app)
        {
            m_content    = new ContentManager(services);
            m_nextModule = null;

            m_app = app;
        }
示例#2
0
        /** @fn     ScallyWagsApp( XNAModule startModule )
         *  @brief  constructor
         *  @param  startModule [in] the module the application will begin running right away
         */
        public ScallyWagsApp(XNAModule startModule)
            : base(startModule)
        {
            IsFixedTimeStep = false;

            //Temp
            //SoundPlayer.SoundEffectVolume = 0.5f;
        }
示例#3
0
 /** @fn     AddModule( XNAModule newModule )
  *  @brief  add a module to the application
  *  @param  newModule [in] reference to the module to add
  */
 public void AddModule(XNAModule newModule)
 {
     if (null != newModule)
     {
         //Set the parent application and add the module to the stack
         newModule.ParentApp = this;
         m_vModules.Add(newModule);
     }
 }
示例#4
0
        /** @fn
         *  @brief  Constructor
         *  @param  startModule [in] reference to the start module
         */
        public XNAModularApp(XNAModule startModule)
            : base()
        {
            m_vModules = new List <XNAModule>();

            AddModule(startModule);
            m_startModule   = startModule;
            m_currentModule = null;
            m_fElapsedDelay = 0;

            m_graphics = new GraphicsDeviceManager(this);

            //Anti aliasing doesn't seem to have an effect with edge enhancement on.
            m_graphics.PreferMultiSampling = true;

            if (Settings.START_FULL_SCREEN)
            {
#if XBOX
                m_graphics.PreferredBackBufferHeight = Settings.PREFFERED_WINDOW_HEIGHT;
                m_graphics.PreferredBackBufferWidth  = Settings.PREFFERED_WINDOW_WIDTH;
#else
                m_graphics.PreferredBackBufferWidth  = 1440;  //m_graphics.GraphicsDevice.Viewport.Width;
                m_graphics.PreferredBackBufferHeight = 900;   //m_graphics.GraphicsDevice.Viewport.Height;
#endif
                m_graphics.IsFullScreen = true;
            }
#if WINDOWS
            else
            {
                //Only request the back buffer width/height when not running full screen (effectively becomes the window dimensions)
                m_graphics.PreferredBackBufferHeight = Settings.PREFFERED_WINDOW_HEIGHT;
                m_graphics.PreferredBackBufferWidth  = Settings.PREFFERED_WINDOW_WIDTH;
            }
#endif
            //Prepare device callback to set graphic settings.
            m_graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(PrepareDevice);

            m_loader = new ModuleLoader(Services, this);

            m_nFPS        = 0;
            m_fSecondTime = 0;
            m_nFrameCount = 0;
            m_fTotalTime  = 0;

            m_font = new FontUtil();

            m_Inputs = new InputManager();
            //m_soundManager = new SoundManager();
        }
示例#5
0
        /** @fn     void LoadModule( XNAModule moduleToLoad )
         *  @brief  set up module properties.  This is the first call
         *          after the constructor.
         */
        public void LoadModule(XNAModule moduleToLoad)
        {
            m_bLoaded = false;

            if (m_app.CurrentModule != null)
            {
                m_app.CurrentModule.ShutDown();
                m_app.CurrentModule = null;
            }

            //Unload any existing content
            m_content.Unload();
            m_nextModule = moduleToLoad;


            Error.Trace("Loading Module without load screen");
            //Load the resources, don't show a splash screen
            LoadResources();
        }