示例#1
0
        /// <summary>
        /// Creates a new instance of JoshoEngine.
        /// </summary>
        /// <param name="game">Game class to inject the JoshoEngine into.</param>
        /// <param name="initialScreen">The initial GameScreen to add.</param>
        public static void CreateEngine(Game game, GameScreen initialScreen)
        {
            if (!engineRunning)
            {
                Debug.WriteLine("[JoshoEngine] Injecting engine...");

                // Create the screen manager component.
                myScreenManager = new ScreenManager(game);

				myScreenManager.Initialize ();

                // Add the screen manager to the component stack.
                game.Components.Add(myScreenManager);

                // We've started the engine!
                engineRunning = true;

                Debug.WriteLine("[JoshoEngine] Injected new engine instance.");

                // Add the initial screen to the ScreenManager
                myScreenManager.AddScreen(initialScreen);
            }
            else
                Debug.WriteLine("[JoshoEngine] Engine instance already created!");
        }
示例#2
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);
        }