/// <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!"); }
/// <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); }