public void update() { MouseState mouseState = Mouse.GetState(); if (mouseState.LeftButton == ButtonState.Pressed) { if (justClicked == false) { selectedObject = map.FindClickedObject(mouseState); justClicked = true; } if (selectedObject != null) { Input.Update(selectedObject); } } else if (mouseState.LeftButton != ButtonState.Pressed && justClicked == true) { justClicked = false; } //foreach (Bomb element in bombs) //{ // element.isClicked(mouseState); //} //foreach (FixedBrick element in fixedBricks) //{ // element.isClicked(mouseState); //} }
public void update() { MouseState mouseState = Mouse.GetState(); if (mouseState.LeftButton == ButtonState.Pressed) { if (justClicked == false) { selectedObject = map.FindClickedObject(mouseState); justClicked = true; } if (selectedObject != null) { Input.Update(selectedObject); } } else if(mouseState.LeftButton != ButtonState.Pressed && justClicked == true) { justClicked = false; } //foreach (Bomb element in bombs) //{ // element.isClicked(mouseState); //} //foreach (FixedBrick element in fixedBricks) //{ // element.isClicked(mouseState); //} }
public void Update(TBoxItem item) { // On initial click only, get selected object back from the Map class if (justClicked == true) { justClicked = false; } MouseState mouseState = Mouse.GetState(); // once we have a selected object, update the object position using the mouse Point newPosition = new Point { X = mouseState.X, Y = mouseState.Y }; item.PostionUpdate(newPosition); }