/// <summary> /// Checks to see if the Mouse is over any buttons /// </summary> public Vector2 CheckFocus(InputState input) { Vector2 focus = new Vector2(-1,-1); foreach (Button b in buttons) { b.IsPressed = false; if (b.CheckFocus(input.MouseState.X, input.MouseState.Y)) { focus.X = b.Col; focus.Y = b.Row; if (input.IsMousePressed()) { b.IsPressed = true; } } } return focus; }
/// <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(); }