[Input] Improved MouseState.ToString()
authorthefiddler <stapostol@gmail.com>
Sun, 4 May 2014 06:31:11 +0000 (08:31 +0200)
committerthefiddler <stapostol@gmail.com>
Sun, 4 May 2014 06:31:11 +0000 (08:31 +0200)
Source/OpenTK/Input/MouseScrollWheel.cs
Source/OpenTK/Input/MouseState.cs

index 69fd17f..2be06b6 100644 (file)
@@ -72,7 +72,7 @@ namespace OpenTK.Input
         /// <returns>A <see cref="System.String"/> that represents the current <see cref="OpenTK.Input.MouseScrollWheel"/>.</returns>
         public override string ToString()
         {
-            return string.Format("[MouseScrollWheel: X={0}, Y={1}]", X, Y);
+            return string.Format("[X={0:0.00}, Y={1:0.00}]", X, Y);
         }
 
         /// <summary>
index 5b12fe2..557aa1c 100644 (file)
@@ -257,6 +257,17 @@ namespace OpenTK.Input
             return buttons.GetHashCode() ^ X.GetHashCode() ^ Y.GetHashCode() ^ scroll.GetHashCode();
         }
 
+        /// <summary>
+        /// Returns a <see cref="System.String"/> that represents the current <see cref="OpenTK.Input.MouseState"/>.
+        /// </summary>
+        /// <returns>A <see cref="System.String"/> that represents the current <see cref="OpenTK.Input.MouseState"/>.</returns>
+        public override string ToString()
+        {
+            string b = Convert.ToString(buttons, 2).PadLeft(10, '0');
+            return String.Format("[MouseState: X={0}, Y={1}, Scroll={2}, Buttons={3}, IsConnected={4}]",
+                X, Y, Scroll, b, IsConnected);
+        }
+
         #endregion
 
         #region Internal Members