Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow, 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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create the main instance of the project and run.
        /// </summary>
        public OceanMars()
        {
            Content.RootDirectory = "Content";

            // Initialize the graphics manager
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = INITIAL_WIDTH; // 1280x720 is the XBox 360 default
            graphics.PreferredBackBufferHeight = INITIAL_HEIGHT;
            graphics.SynchronizeWithVerticalRetrace = INITIAL_VSYNC; // Turn off vsync by default

            // Initialize the volume settings
            SoundEffect.MasterVolume = INITIAL_VOLUME;
            MediaPlayer.Volume = INITIAL_VOLUME;

            // Initialize the screen manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            screenManager.AddScreen(new BackgroundScreen());
            screenManager.AddScreen(new MainMenuScreen());

            return;
        }