Example #1
0
        public UtilGame()
        {
            graphics = new GraphicsDeviceManager(this)
            {
                PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8
            };

            // Initialize configuration object
            configuration = new Configuration();

            // Initialize camera
            camera = new Camera(this);

            // Initialize the screen manager
            screenManager = new ScreenManager(this, camera, configuration, graphics);

            // Add the screen manager to the components list.
            // Components are special objects that respond to the draw and update loops
            // at a different time than the main application. The main implication of this
            // when using the screen manager is that you don't actually call draw or update
            // on the manager explicitly in this game loop.
            Components.Add(screenManager);

            Content.RootDirectory = "Content";
        }
Example #2
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
            GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
Example #3
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow,
            PlayerIndex? controllingPlayer,
            params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
                screen.ExitScreen();

            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen(screenManager,
                                                            loadingIsSlow,
                                                            screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }