Esempio n. 1
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(Game game, ScreenManager screenManager, bool loadingIsSlow,
                              GameScreen[] screensToLoad)
            : base(game)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
Esempio n. 2
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(Game game, 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(game, screenManager,
                                                            loadingIsSlow,
                                                            screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
Esempio n. 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            config.Initialize();
            InputState inputState = new InputState(true, config);
            mainCamera = new Camera();
            mainCamera.SubscribeToHandler(inputState);
            // Create the screen manager component.
            screenManager = new ScreenManager(this, inputState);
            graphics.PreferredBackBufferWidth = 1080;
            graphics.PreferredBackBufferHeight = 720;
            //Resolution.Init(ref graphics);
            mainCamera.Init(ref graphics);
            // Change Virtual Resolution
            bool b;
            Point p = config.GetStartUpResolution(out b); //used out to get all three SetRes params
            //Resolution.SetResolution(p.X, p.Y, b);
            mainCamera.SetResolution(p.X, p.Y, b);
            p = config.GetStartUpVResolution();
            //Resolution.SetVirtualResolution(p.X, p.Y);
            mainCamera.InitializeView(p.X, p.Y, 50, 50);

            Content.RootDirectory = "Content";
            Components.Add(screenManager);
            /*
            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);
            */

            base.Initialize();
        }