/// <summary> /// Constructor /// </summary> /// <param name="game"></param> public GameScreen(Game game) : base(game) { spriteBatch = (SpriteBatch)Game.Services.GetService( typeof(SpriteBatch)); graphics = (GraphicsDeviceManager)Game.Services.GetService( typeof(IGraphicsDeviceManager)); input = (InputState)Game.Services.GetService( typeof(InputState)); audio = (AudioLibrary)Game.Services.GetService( typeof(AudioLibrary)); content = game.Content; Visible = false; Enabled = false; exiting = false; soundPlayed = new List<double>(); }
/// <summary> /// Initializes all game elements /// </summary> protected override void Initialize() { this.IsMouseVisible = true; // Add InputState input = new InputState(); input.Update(); Services.AddService(typeof(InputState), input); // Create a SpriteBatch for darwing. spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(typeof(SpriteBatch), spriteBatch); //Create and add audioLibrary audio = new AudioLibrary(); Services.AddService(typeof(AudioLibrary), audio); // Create and add the screens back = new Background(this); Components.Add(back); timesTable = new TimesTable(this); Components.Add(timesTable); menu = new Menu(this); Components.Add(menu); intro = new Intro(this); Components.Add(intro); test = new Test(this); Components.Add(test); help = new Help(this); Components.Add(help); menu.Show(input); base.Initialize(); }