public ScreenManager(Game1 game, Screen start) : base(game, Shape.None, new Vector2(), new Vector2()) { this.screens = new Stack<Screen>(); if (start != null) this.Push(start); this.Initialized = false; }
/// <summary> /// Add a screen to the top of the stack, if the manager is initialized but the screen isn't initialize it. /// Also set it's manager to this. /// </summary> /// <param name="screen">The screen to add.</param> public void Push(Screen screen) { screen.Manager = this; if (this.ActiveScreen != null) this.ActiveScreen.Deactivated(); this.screens.Push(screen); if (!screen.Initialized && this.Initialized) screen.Initialize(); }