Ejemplo n.º 1
0
        public BattleFuryGame()
        {
            Content.RootDirectory = "Content";

            // Set up the graphics device.
            graphics = new GraphicsDeviceManager(this);
            // Initialize the screen resolution, no smaller than the min height/width supported by the game.
            DisplayModeCollection displayModes = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes;
            int height = GlobalGameConstants.MIN_SCREEN_HEIGHT, width = GlobalGameConstants.MIN_SCREEN_WIDTH;
            foreach (DisplayMode mode in displayModes){
                if (mode.Width > GlobalGameConstants.MIN_SCREEN_WIDTH && mode.Height > GlobalGameConstants.MIN_SCREEN_HEIGHT)
                {
                    width = mode.Width;
                    height = mode.Height;
                }
                break;
            }
            graphics.PreferredBackBufferWidth = width;
            graphics.PreferredBackBufferHeight = height ;
            GameSettings.LoadDefaultGameSettings(width, height);

            Services.AddService(typeof(GraphicsDeviceManager), graphics);
            Services.AddService(typeof(DisplayModeCollection), displayModes);

            // Create the new screen manager component
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            // Activate the first screens
            screenManager.AddScreen(new MainMenuBackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Activates the loading screen. Shuts off all existing screens and loads the screensToLoad.
        /// </summary>
        /// <param name="screenManager">The screen manager.</param>
        /// <param name="screensToLoad">Array of screens to load.</param>
        public static void Load(ScreenManager screenManager, PlayerIndex? controllingPlayer, params GameScreen[] screensToLoad)
        {
            // Turn off all existing screens
            GameScreen[] screens = screenManager.GetScreens();
            for (int i = 0; i < screens.Length; i++)
            {
                screens[i].ExitScreen();
            }

            // Create and activate the loading screen
            LoadingScreen loadingScreen = new LoadingScreen(screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }