public void SetGet(int x, int y, int scrollWheel, ButtonState leftButton, ButtonState middleButton, ButtonState rightButton, ButtonState xButton1, ButtonState xButton2, int horizontalScrollWheel) { var state = new MouseState { X = x, Y = y, ScrollWheelValue = scrollWheel, LeftButton = leftButton, MiddleButton = middleButton, RightButton = rightButton, XButton1 = xButton1, XButton2 = xButton2, HorizontalScrollWheelValue = horizontalScrollWheel }; Assert.AreEqual(state.X, x); Assert.AreEqual(state.Y, y); Assert.AreEqual(state.ScrollWheelValue, scrollWheel); Assert.AreEqual(state.LeftButton, leftButton); Assert.AreEqual(state.MiddleButton, middleButton); Assert.AreEqual(state.RightButton, rightButton); Assert.AreEqual(state.XButton1, xButton1); Assert.AreEqual(state.XButton2, xButton2); Assert.AreEqual(state.HorizontalScrollWheelValue, horizontalScrollWheel); var state2 = new MouseState(x, y, scrollWheel, leftButton, middleButton, rightButton, xButton1, xButton2, horizontalScrollWheel); Assert.AreEqual(state, state2); Assert.AreEqual(state.GetHashCode(), state2.GetHashCode()); }
public override int GetHashCode() { unchecked { int hash = base.GetHashCode(); hash = hash * 37 + (GameTime != null ? GameTime.GetHashCode() : 0); hash = hash * 37 + (MouseState != null ? MouseState.GetHashCode() : 0); hash = hash * 37 + (TouchState != null ? TouchState.GetHashCode() : 0); hash = hash * 37 + (CursorPosition != null ? CursorPosition.GetHashCode() : 0); hash = hash * 37 + (ObjectPool != null ? ObjectPool.GetHashCode() : 0); return(hash); } }
public override int GetHashCode() { return(_mouseState.GetHashCode()); }