/// <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> /// 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); }
/// <summary> /// Constructs a new starfield, but uses the built in star texture. /// </summary> public Starfield(ScreenManager screenManager) { // Since we're not a GameScreen, we need to have the user give us our ScreenManager. this.screenManager = screenManager; // We use the default star texture. starTexture = Assets.starTexture; }
/// <summary> /// Constructs a new starfield. /// </summary> /// <param name="texture">The star texture to use.</param> public Starfield(ScreenManager screenManager, Texture2D texture) { // Since we're not a GameScreen, we need to have the user give us our ScreenManager. this.screenManager = screenManager; // Set the texture to a user defined one. starTexture = texture; }
/// <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); }
public static void Initialize(ScreenManager screenManager) { titleSafeViewport = screenManager.GraphicsDevice.Viewport.TitleSafeArea; }
public Snowfall(ScreenManager scrmgr) { this.screenManagerInstance = scrmgr; }