Cleaned up the remaining obsolete warnings
authorthefiddler <stapostol@gmail.com>
Mon, 21 Jul 2014 14:49:24 +0000 (16:49 +0200)
committerthefiddler <stapostol@gmail.com>
Mon, 21 Jul 2014 14:49:24 +0000 (16:49 +0200)
Source/OpenTK/DisplayDevice.cs
Source/OpenTK/DisplayResolution.cs
Source/OpenTK/GameWindow.cs
Source/OpenTK/Platform/Factory.cs
Source/OpenTK/Platform/LegacyJoystickDriver.cs
Source/OpenTK/Platform/SDL2/Sdl2JoystickDriver.cs
Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
Source/OpenTK/Platform/Windows/WinDisplayDevice.cs
Source/OpenTK/Platform/Windows/WinMMJoystick.cs

index 0078947..bfd3960 100644 (file)
@@ -78,11 +78,13 @@ namespace OpenTK
             object id)
             : this()
         {
-#warning "Consolidate current resolution with bounds? Can they fall out of sync right now?"
+            // Todo: Consolidate current resolution with bounds? Can they fall out of sync right now?
             this.current_resolution = currentResolution;
             IsPrimary = primary;
             this.available_resolutions.AddRange(availableResolutions);
+            #pragma warning disable 612,618
             this.bounds = bounds == Rectangle.Empty ? currentResolution.Bounds : bounds;
+            #pragma warning restore 612,618
             this.Id = id;
         }
 
index 02fd04f..4341940 100644 (file)
@@ -153,7 +153,9 @@ namespace OpenTK
         /// <returns>A System.String representing this DisplayResolution.</returns>
         public override string ToString()
         {
+            #pragma warning disable 612,618
             return String.Format("{0}x{1}@{2}Hz", Bounds, bits_per_pixel, refresh_rate);
+            #pragma warning restore 612,618
         }
 
         #endregion
@@ -187,7 +189,9 @@ namespace OpenTK
         /// <returns>A System.Int32 that may serve as a hash code for this resolution.</returns>
         public override int GetHashCode()
         {
+            #pragma warning disable 612,618
             return Bounds.GetHashCode() ^ bits_per_pixel ^ refresh_rate.GetHashCode();
+            #pragma warning restore 612,618
         }
 
         #endregion
index f9a1562..cfab224 100644 (file)
@@ -599,6 +599,7 @@ namespace OpenTK
         /// <summary>
         /// Gets the primary Keyboard device, or null if no Keyboard exists.
         /// </summary>
+        [Obsolete("Use KeyDown, KeyUp and KeyPress events or OpenTK.Input.Keyboard instead.")]
         public KeyboardDevice Keyboard
         {
             get { return InputDriver.Keyboard.Count > 0 ? InputDriver.Keyboard[0] : null; }
@@ -611,6 +612,7 @@ namespace OpenTK
         /// <summary>
         /// Gets the primary Mouse device, or null if no Mouse exists.
         /// </summary>
+        [Obsolete("Use MouseMove, MouseDown, MouseUp and MouseWheel events or OpenTK.Input.Mouse, instead.")]
         public MouseDevice Mouse
         {
             get { return InputDriver.Mouse.Count > 0 ? InputDriver.Mouse[0] : null; }
index 031dcf8..a195429 100644 (file)
@@ -155,7 +155,9 @@ namespace OpenTK.Platform
         [Obsolete]
         public IJoystickDriver CreateLegacyJoystickDriver()
         {
+            #pragma warning disable 612,618
             return default_implementation.CreateLegacyJoystickDriver();
+            #pragma warning restore 612,618
         }
 
         class UnsupportedPlatform : PlatformFactoryBase
index b58c21f..202b998 100644 (file)
@@ -33,6 +33,7 @@ using OpenTK.Input;
 
 namespace OpenTK.Platform
 {
+    [Obsolete]
     internal class LegacyJoystickDriver : IJoystickDriver
     {
         static readonly string ConnectedName = "Connected Joystick";
index 71ab3ee..41726c6 100644 (file)
@@ -32,7 +32,7 @@ using OpenTK.Input;
 
 namespace OpenTK.Platform.SDL2
 {
-    class Sdl2JoystickDriver : IJoystickDriver, IJoystickDriver2, IGamePadDriver, IDisposable
+    class Sdl2JoystickDriver : IJoystickDriver2, IGamePadDriver, IDisposable
     {
         const float RangeMultiplier =  1.0f / 32768.0f;
         readonly MappedGamePadDriver gamepad_driver = new MappedGamePadDriver();
@@ -55,9 +55,6 @@ namespace OpenTK.Platform.SDL2
         readonly List<JoystickDevice> joysticks = new List<JoystickDevice>(4);
         readonly Dictionary<int, int> sdl_instanceid_to_joysticks = new Dictionary<int, int>();
 
-        // For IJoystickDriver implementation
-        IList<JoystickDevice> joysticks_readonly;
-
 #if USE_SDL2_GAMECONTROLLER
         class Sdl2GamePad
         {
@@ -78,7 +75,6 @@ namespace OpenTK.Platform.SDL2
 
         public Sdl2JoystickDriver()
         {
-            joysticks_readonly = joysticks.AsReadOnly();
         }
 
         #region Private Members
@@ -548,23 +544,6 @@ namespace OpenTK.Platform.SDL2
 
         #endregion
 
-        #region IJoystickDriver Members
-
-        public IList<JoystickDevice> Joysticks
-        {
-            get
-            {
-                return joysticks_readonly;
-            }
-        }
-
-        public void Poll()
-        {
-            // Do nothing
-        }
-
-        #endregion
-
         #region IGamePadDriver Members
 
 #if USE_SDL2_GAMECONTOLLER
index 0e576e9..a49dea1 100644 (file)
@@ -943,7 +943,7 @@ namespace OpenTK.Platform.SDL2
                     if (manual)
                     {
                         Debug.Print("Disposing {0}", GetType());
-                        InputDriver.Dispose();
+
                         if (Exists)
                         {
                             DestroyWindow();
index fc594b6..8ea67e0 100644 (file)
@@ -156,12 +156,14 @@ namespace OpenTK.Platform.Windows
                     // Construct the OpenTK DisplayDevice through the accumulated parameters.
                     // The constructor will automatically add the DisplayDevice to the list
                     // of available devices.
+                    #pragma warning disable 612,618
                     opentk_dev = new DisplayDevice(
                         opentk_dev_current_res,
                         opentk_dev_primary,
                         opentk_dev_available_res,
                         opentk_dev_current_res.Bounds,
                         dev1.DeviceName);
+                    #pragma warning restore 612,618
 
                     // Set the original resolution if the DisplayDevice was previously available.
                     foreach (DisplayDevice existingDevice in previousDevices)
index adcdf1d..b8bd79a 100644 (file)
@@ -36,7 +36,7 @@ using OpenTK.Input;
 
 namespace OpenTK.Platform.Windows
 {
-    sealed class WinMMJoystick : IJoystickDriver, IJoystickDriver2
+    sealed class WinMMJoystick : IJoystickDriver2
     {
         #region Fields
 
@@ -228,111 +228,6 @@ namespace OpenTK.Platform.Windows
 
         #endregion
 
-        #region IJoystickDriver
-
-        public int DeviceCount
-        {
-            get { return sticks.Count; }
-        }
-
-        public IList<JoystickDevice> Joysticks
-        {
-            get { return sticks_readonly; }
-        }
-
-        public void Poll()
-        {
-            lock (sync)
-            {
-                foreach (JoystickDevice<WinMMJoyDetails> js in sticks)
-                {
-                    JoyInfoEx info = new JoyInfoEx();
-                    info.Size = JoyInfoEx.SizeInBytes;
-                    info.Flags = JoystickFlags.All;
-                    UnsafeNativeMethods.joyGetPosEx(js.Id, ref info);
-
-                    int num_axes = js.Axis.Count;
-                    if ((js.Details.PovType & PovType.Exists) != 0)
-                        num_axes -= 2; // Because the last two axis are used for POV input.
-
-                    int axis = 0;
-                    if (axis < num_axes)
-                    { js.SetAxis((JoystickAxis)axis, js.Details.CalculateOffset((float)info.XPos, axis)); axis++; }
-                    if (axis < num_axes)
-                    { js.SetAxis((JoystickAxis)axis, js.Details.CalculateOffset((float)info.YPos, axis)); axis++; }
-                    if (axis < num_axes)
-                    { js.SetAxis((JoystickAxis)axis, js.Details.CalculateOffset((float)info.ZPos, axis)); axis++; }
-                    if (axis < num_axes)
-                    { js.SetAxis((JoystickAxis)axis, js.Details.CalculateOffset((float)info.RPos, axis)); axis++; }
-                    if (axis < num_axes)
-                    { js.SetAxis((JoystickAxis)axis, js.Details.CalculateOffset((float)info.UPos, axis)); axis++; }
-                    if (axis < num_axes)
-                    { js.SetAxis((JoystickAxis)axis, js.Details.CalculateOffset((float)info.VPos, axis)); axis++; }
-
-                    if ((js.Details.PovType & PovType.Exists) != 0)
-                    {
-                        float x = 0, y = 0;
-
-                        // A discrete POV returns specific values for left, right, etc.
-                        // A continuous POV returns an integer indicating an angle in degrees * 100, e.g. 18000 == 180.00 degrees.
-                        // The vast majority of joysticks have discrete POVs, so we'll treat all of them as discrete for simplicity.
-                        if ((JoystickPovPosition)info.Pov != JoystickPovPosition.Centered)
-                        {
-                            if (info.Pov > (int)JoystickPovPosition.Left || info.Pov < (int)JoystickPovPosition.Right)
-                            { y = 1; }
-                            if ((info.Pov > (int)JoystickPovPosition.Forward) && (info.Pov < (int)JoystickPovPosition.Backward))
-                            { x = 1; }
-                            if ((info.Pov > (int)JoystickPovPosition.Right) && (info.Pov < (int)JoystickPovPosition.Left))
-                            { y = -1; }
-                            if (info.Pov > (int)JoystickPovPosition.Backward)
-                            { x = -1; }
-                        }
-                        //if ((js.Details.PovType & PovType.Discrete) != 0)
-                        //{
-                        //    if ((JoystickPovPosition)info.Pov == JoystickPovPosition.Centered)
-                        //    { x = 0; y = 0; }
-                        //    else if ((JoystickPovPosition)info.Pov == JoystickPovPosition.Forward)
-                        //    { x = 0; y = -1; }
-                        //    else if ((JoystickPovPosition)info.Pov == JoystickPovPosition.Left)
-                        //    { x = -1; y = 0; }
-                        //    else if ((JoystickPovPosition)info.Pov == JoystickPovPosition.Backward)
-                        //    { x = 0; y = 1; }
-                        //    else if ((JoystickPovPosition)info.Pov == JoystickPovPosition.Right)
-                        //    { x = 1; y = 0; }
-                        //}
-                        //else if ((js.Details.PovType & PovType.Continuous) != 0)
-                        //{
-                        //    if ((JoystickPovPosition)info.Pov == JoystickPovPosition.Centered)
-                        //    {
-                        //        // This approach moves the hat on a circle, not a square as it should.
-                        //        float angle = (float)(System.Math.PI * info.Pov / 18000.0 + System.Math.PI / 2);
-                        //        x = (float)System.Math.Cos(angle);
-                        //        y = (float)System.Math.Sin(angle);
-                        //        if (x < 0.001)
-                        //            x = 0;
-                        //        if (y < 0.001)
-                        //            y = 0;
-                        //    }
-                        //}
-                        //else
-                        //    throw new NotImplementedException("Please post an issue report at http://www.opentk.com/issues");
-
-                        js.SetAxis((JoystickAxis)axis++, x);
-                        js.SetAxis((JoystickAxis)axis++, y);
-                    }
-
-                    int button = 0;
-                    while (button < js.Button.Count)
-                    {
-                        js.SetButton((JoystickButton)button, (info.Buttons & (1 << button)) != 0);
-                        button++;
-                    }
-                }
-            }
-        }
-
-        #endregion
-
         #region IJoystickDriver2 Members
 
         public JoystickCapabilities GetCapabilities(int player_index)