From d5efed904516c946e52ee24141bef9f44c37396a Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 4 Jun 2009 11:31:02 +0000 Subject: [PATCH] Removed obsolete IResizable, DisplayMode and ColorMode APIs. Marked carbon API class as internal. Added a large number of missing XML comments. --- .../Examples/Properties/Resources.Designer.cs | 4 +- Source/OpenTK/ColorMode.cs | 170 --------- Source/OpenTK/DisplayMode.cs | 340 ------------------ Source/OpenTK/GLControl.cs | 11 - Source/OpenTK/GameWindow.cs | 75 ---- Source/OpenTK/Platform/IResizable.cs | 50 --- .../MacOS/CarbonBindings/CarbonAPI.cs | 2 +- .../OpenTK/Platform/MacOS/CarbonGLNative.cs | 2 +- 8 files changed, 4 insertions(+), 650 deletions(-) delete mode 100644 Source/OpenTK/ColorMode.cs delete mode 100644 Source/OpenTK/DisplayMode.cs delete mode 100644 Source/OpenTK/Platform/IResizable.cs diff --git a/Source/Examples/Properties/Resources.Designer.cs b/Source/Examples/Properties/Resources.Designer.cs index 9b6b7ea1..36a10998 100644 --- a/Source/Examples/Properties/Resources.Designer.cs +++ b/Source/Examples/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.20506.1 +// Runtime Version:2.0.50727.4918 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace Examples.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/Source/OpenTK/ColorMode.cs b/Source/OpenTK/ColorMode.cs deleted file mode 100644 index 317438d0..00000000 --- a/Source/OpenTK/ColorMode.cs +++ /dev/null @@ -1,170 +0,0 @@ -#region --- License --- -/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos - * See license.txt for license info - */ -#endregion - -using System; -using System.Globalization; - -namespace OpenTK -{ - /// Defines a color mode for OpenGL rendering. - /// - /// A ColorMode contains Red, Green, Blue and Alpha components that descibe - /// the allocated bits per pixel for the corresponding color. - /// - [Obsolete("Use OpenTK.Graphics.ColorFormat instead.")] - public sealed class ColorMode - { - byte red, green, blue, alpha; - bool isIndexed = false; - int bitsPerPixel; - - #region --- Constructors --- - - /// - /// Constructs a new ColorMode with the specified aggregate bits per pixel. - /// - /// The bits per pixel sum for the Red, Green, Blue and Alpha color channels. - public ColorMode(int bpp) - { - if (bpp < 0) - throw new ArgumentOutOfRangeException("bpp", "Must be greater or equal to zero."); - Red = Green = Blue = Alpha = 0; - BitsPerPixel = bpp; - - switch (bpp) - { - case 32: - Red = Green = Blue = Alpha = 8; - break; - case 24: - Red = Green = Blue = 8; - break; - case 16: - Red = Blue = 5; - Green = 6; - break; - case 15: - Red = Green = Blue = 5; - break; - case 8: - Red = Green = 3; - Blue = 2; - IsIndexed = true; - break; - case 4: - Red = Green = 2; - Blue = 1; - IsIndexed = true; - break; - case 1: - IsIndexed = true; - break; - default: - Red = Blue = Alpha = (byte)(bpp / 4); - Green = (byte)((bpp / 4) + (bpp % 4)); - break; - } - } - - /// - /// Constructs a new ColorMode with the specified bits per pixel for - /// the Red, Green, Blue and Alpha color channels. - /// - /// Bits per pixel for the Red color channel. - /// Bits per pixel for the Green color channel. - /// Bits per pixel for the Blue color channel. - /// Bits per pixel for the Alpha color channel. - public ColorMode(int red, int green, int blue, int alpha) - { - if (red < 0 || green < 0 || blue < 0 || alpha < 0) - throw new ArgumentOutOfRangeException("Arguments must be greater or equal to zero."); - Red = (byte)red; - Green = (byte)green; - Blue = (byte)blue; - Alpha = (byte)alpha; - BitsPerPixel = red + green + blue + alpha; - if (BitsPerPixel < 15) - IsIndexed = true; - } - - #endregion - - #region --- Public Methods --- - - /// Gets the bits per pixel for the Red channel. - public int Red { get { return red; } private set { red = (byte)value; } } - /// Gets the bits per pixel for the Green channel. - public int Green { get { return green; } private set { green = (byte)value; } } - /// Gets the bits per pixel for the Blue channel. - public int Blue { get { return blue; } private set { blue = (byte)value; } } - /// Gets the bits per pixel for the Alpha channel. - public int Alpha { get { return alpha; } private set { alpha = (byte)value; } } - /// Gets a System.Boolean indicating whether this ColorMode is indexed. - public bool IsIndexed { get { return isIndexed; } private set { isIndexed = value; } } - /// Gets the sum of Red, Green, Blue and Alpha bits per pixel. - public int BitsPerPixel { get { return bitsPerPixel; } private set { bitsPerPixel = value; } } - - #endregion - - #region --- Operator Overloads --- - - /// - /// Converts the specified bpp into a new ColorMode. - /// - /// The bits per pixel to convert. - /// A ColorMode with the specified bits per pixel. - public static implicit operator ColorMode(int bpp) - { - return new ColorMode(bpp); - } - - //public static implicit operator int(ColorMode mode) - //{ - // return mode.BitsPerPixel; - //} - - #endregion - - #region --- Overrides --- - - public override bool Equals(object obj) - { - return (obj is ColorMode) ? (this == (ColorMode)obj) : false; - } - - public static bool operator ==(ColorMode left, ColorMode right) - { - if ((object)left == (object)null && (object)right != (object)null || - (object)left != (object)null && (object)right == (object)null) - return false; - - if ((object)left == (object)null && (object)right == (object)null) - return true; - - return left.Red == right.Red && - left.Green == right.Green && - left.Blue == right.Blue && - left.Alpha == right.Alpha; - } - - public static bool operator !=(ColorMode left, ColorMode right) - { - return !(left == right); - } - - public override int GetHashCode() - { - return Red ^ Green ^ Blue ^ Alpha; - } - - public override string ToString() - { - return string.Format("{0} ({1})", BitsPerPixel, (IsIndexed ? " indexed" : Red.ToString() + Green.ToString() + Blue.ToString() + Alpha.ToString())); - } - - #endregion - } -} diff --git a/Source/OpenTK/DisplayMode.cs b/Source/OpenTK/DisplayMode.cs deleted file mode 100644 index df9abc5b..00000000 --- a/Source/OpenTK/DisplayMode.cs +++ /dev/null @@ -1,340 +0,0 @@ -#region --- License --- -/* Licensed under the MIT/X11 license. - * Copyright (c) 2006-2008 the OpenTK Team. - * This notice may not be removed from any source distribution. - * See license.txt for licensing detailed licensing details. - */ -#endregion - -#region --- Using directives --- - -using System; -using System.Drawing; -using System.Globalization; - -#endregion - -namespace OpenTK -{ - using OpenTK.Graphics; - - /// Defines the display mode for a render window. - [Obsolete] - public sealed class DisplayMode - { - #region --- Private Variables --- - - private int width, height; - private ColorMode color_format, auxilliary_color_format; - - private int depthBits, stencilBits; - - private float refreshRate; - private bool vsync; - private bool fullscreen; - private int buffers; - private bool stereo; - - #endregion - - #region --- Constructors --- - - public DisplayMode(DisplayMode mode) - : this(mode.width, mode.height, mode.color_format, mode.depthBits, mode.stencilBits, mode.auxilliary_color_format.BitsPerPixel, - mode.buffers, mode.fullscreen, mode.stereo, mode.vsync, mode.refreshRate) { } - - public DisplayMode() : this(640, 480) { } - - /// - /// Constructs a new DisplayMode from the specified parameters. - /// - /// The Width of the DisplayMode, in pixels. - /// The Height of the DisplayMode, in pixels. - /// The ColorMode of the color buffer. - /// The number of bits in the depth buffer. - /// The number of bits in the stencil buffer. - /// The number of bits in the auxilliary buffer. - /// Set to true for a fullscreen DisplayMode. - /// Set to true for a DisplayMode with stereographic capabilities. - /// The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering). - /// Set to true to sync the updates to the screen refresh rate. - /// The desired RefreshRate. Taken into account only for Fullscreen DisplayModes. - public DisplayMode(int width, int height, ColorMode color, int depth, int stencil, int aux, int buffers, - bool fullscreen, bool stereo, bool vsync, float refresh) - { - this.Width = width; - this.Height = height; - this.Color = color; - this.DepthBits = depth; - this.StencilBits = stencil; - this.AuxBits = aux; - this.Buffers = buffers; - this.Fullscreen = fullscreen; - this.Stereo = stereo; - this.Vsync = vsync; - this.RefreshRate = refresh; - } - - /// - /// Constructs a new DisplayMode. - /// - /// The Width of the DisplayMode in pixels. - /// The Height of the DisplayMode in pixels. - public DisplayMode(int width, int height) - : this(width, height, DisplayDevice.Default.BitsPerPixel, 16, 0, 0, 2, false, false, false, 0.0f) - { - } - - /// - /// Constructs a new DisplayMode. - /// - /// The Width of the DisplayMode in pixels. - /// The Height of the DisplayMode in pixels. - /// The ColorMode of the color buffer. - public DisplayMode(int width, int height, ColorMode color) - : this(width, height, color, 16, 0, 0, 2, false, false, false, 0.0f) - { - } - - /// - /// Constructs a new DisplayMode. - /// - /// The Width of the DisplayMode in pixels. - /// The Height of the DisplayMode in pixels. - /// The ColorMode of the color buffer. - /// The number of bits in the depth buffer. - public DisplayMode(int width, int height, ColorMode color, int depth) - : this(width, height, color, depth, 0, 0, 2, false, false, false, 0.0f) - { - } - - /// - /// Constructs a new DisplayMode. - /// - /// The Width of the DisplayMode in pixels. - /// The Height of the DisplayMode in pixels. - /// The ColorMode of the color buffer. - /// The number of bits in the depth buffer. - /// True for a fullscreen DisplayMode, false otherwise. - public DisplayMode(int width, int height, ColorMode color, int depth, bool fullscreen) - : this(width, height, color, depth, 0, 0, 2, fullscreen, false, false, 0.0f) - { - } - - #endregion - - #region --- Public Properties --- -#if false - #region public int ColorDepth - - /// - /// Gets an OpenTK.Graphics.ColorMode that describes the color format of this DisplayMode. - /// - public ColorMode ColorDepth - { - get { return color_format; } - private set { color_format = value; } - } - - #endregion - - #region public int AuxilliaryColorDepth - - /// - /// Gets an OpenTK.Graphics.ColorMode that describes the color format of this DisplayMode. - /// - public ColorMode AuxilliaryColorDepth - { - get { return auxilliary_color_format; } - private set { auxilliary_color_format = value; } - } - - #endregion - - #region public int Depth - - /// - /// Gets a System.Int32 that contains the bits per pixel for the depth buffer - /// of this DisplayMode. - /// - public int Depth - { - get { return depthBits; } - private set { depthBits = value; } - } - - #endregion - - #region public int Stencil - - /// - /// Gets a System.Int32 that contains the bits per pixel for the stencil buffer - /// of this DisplayMode. - /// - public int Stencil - { - get { return stencilBits; } - private set { stencilBits = value; } - } - - #endregion -#endif - #region Obsolete Properties - - #region public bool Stereo - - /// - /// Gets a System.Boolean indicating whether this DisplayMode is stereoscopic. - /// - [Obsolete("Use GraphicsMode.Stereo instead.")] - public bool Stereo - { - get { return this.stereo; } - private set { this.stereo = value; } - } - - #endregion - - #region public int Buffers - - /// - /// Gets a System.Int32 containing the number of buffers associated with this - /// DisplayMode. - /// - [Obsolete("Use GraphicsMode.Buffers instead.")] - public int Buffers - { - get { return this.buffers; } - private set { this.buffers = value; } - } - - #endregion - - [Obsolete("Use GameWindow.Fullscreen instead.")] - public bool Fullscreen - { - get { return this.fullscreen; } - internal set { this.fullscreen = value; } - } - - [Obsolete("Use GraphicsContext.VSync, GLControl.VSync or GameWindow.VSync instead.")] - public bool Vsync - { - get { return this.vsync; } - internal set { this.vsync = value; } - } - - [Obsolete("Use OpenTK.Graphics.DisplayDevice.RefreshRate instead.")] - public float RefreshRate - { - get { return this.refreshRate; } - private set { this.refreshRate = value; } - } - - #region public ColorFormat Color - - [Obsolete("Use GraphicsMode.Color instead.")] - public ColorMode Color - { - get { return this.color_format; } - internal set { this.color_format = value; } - } - - #endregion - - #region public int Height - - /// - /// Gets or sets the Height of the DisplayMode. Height is the vertical span measured in pixels. - /// - [Obsolete("Use GameWindow.Height or GLControl.Height instead.")] - public int Height - { - get { return height; } - set - { - if (value > 0 /* && (value < Screen[0].Height) */) - { - height = value; - } - } - } - - #endregion - - #region public int Width - - /// - /// Gets or sets the Width of the DisplayMode. Width is the horizontal span measured in pixels. - /// - [Obsolete("Use GameWindow.Width or GLControl.Width instead.")] - public int Width - { - get { return width; } - set - { - if (value > 0) - { - width = value; - } - } - } - - #endregion - - [Obsolete("Use GraphicsMode.Depth instead.")] - public int DepthBits - { - get { return this.depthBits; } - internal set { this.depthBits = value; } - } - - [Obsolete("Use GraphicsMode.Stencil instead.")] - public int StencilBits - { - get { return this.stencilBits; } - internal set { this.stencilBits = value; } - } - - [Obsolete("Use GraphicsMode.AuxilliaryColorDepth instead.")] - public int AuxBits - { - get { return this.auxilliary_color_format.BitsPerPixel; } - internal set { this.auxilliary_color_format = value; } - } - - #endregion - - #endregion - - #region --- Internal Members --- - - internal GraphicsMode ToGraphicsMode() - { - return new GraphicsMode(this.Color.BitsPerPixel, this.DepthBits, this.StencilBits, 0, this.AuxBits, this.Buffers, this.Stereo); - } - - #endregion - - #region --- Overrides --- - - /// - /// Describes this DisplayMode instance. - /// - /// Returns a System.String that describes this DisplayMode instance. - public override string ToString() - { - return string.Format("Display Mode: {0}, depth: {1}, stencil {2}, aux {3} refresh {4}Hz", - Color.ToString(), - DepthBits, - StencilBits, - AuxBits, - RefreshRate - ); - } - - #endregion - } - - public class DisplayModeMatchOptions { } -} diff --git a/Source/OpenTK/GLControl.cs b/Source/OpenTK/GLControl.cs index aab0c92e..12066bc2 100644 --- a/Source/OpenTK/GLControl.cs +++ b/Source/OpenTK/GLControl.cs @@ -86,17 +86,6 @@ namespace OpenTK this.CreateControl(); } - #region Obsolete - - /// This method is obsolete and will be removed in future versions. - /// Obsolete.v - [Obsolete] - public GLControl(DisplayMode mode) - : this(mode.ToGraphicsMode()) - { } - - #endregion - #endregion #region --- Protected Methods --- diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index d14c6f58..bd855e1b 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -252,28 +252,6 @@ namespace OpenTK #endregion - #region Obsolete - - /// - /// Constructs a new GameWindow, and opens a render window with the specified DisplayMode. - /// - /// The DisplayMode of the GameWindow. - [Obsolete] - public GameWindow(DisplayMode mode) - : this(mode.Width, mode.Height, mode.ToGraphicsMode(), "OpenTK Game Window", mode.Fullscreen ? GameWindowFlags.Fullscreen : 0) { } - - /// - /// Constructs a new GameWindow with the specified title, and opens a render window with the - /// specified DisplayMode. - /// - /// The DisplayMode of the GameWindow. - /// The Title of the GameWindow. - [Obsolete] - public GameWindow(DisplayMode mode, string title) - : this(mode.Width, mode.Height, mode.ToGraphicsMode(), title, mode.Fullscreen ? GameWindowFlags.Fullscreen : 0) { } - - #endregion - #endregion #region --- Private Methods --- @@ -1822,59 +1800,6 @@ namespace OpenTK #endregion - #region --- GameWindow Events --- - - public delegate void UpdateFrameEvent(GameWindow sender, UpdateFrameEventArgs e); - public delegate void RenderFrameEvent(GameWindow sender, RenderFrameEventArgs e); - public delegate void LoadEvent(GameWindow sender, EventArgs e); - public delegate void UnloadEvent(GameWindow sender, EventArgs e); - - public class UpdateFrameEventArgs : EventArgs - { - private double time; - - /// - /// Gets the Time elapsed between frame updates, in seconds. - /// - public double Time - { - get { return time; } - internal set { time = value; } - } - } - - public class RenderFrameEventArgs : EventArgs - { - private double time; - private double scale_factor; - - /// - /// Gets the Time elapsed between frame updates, in seconds. - /// - public double Time - { - get { return time; } - internal set { time = value; } - } - - public double ScaleFactor - { - get - { - return scale_factor; - } - internal set - { - if (value != 0.0 && !Double.IsNaN(value)) - scale_factor = value; - else - scale_factor = 1.0; - } - } - } - - #endregion - #region --- GameWindow Exceptions --- [DebuggerNonUserCode] diff --git a/Source/OpenTK/Platform/IResizable.cs b/Source/OpenTK/Platform/IResizable.cs deleted file mode 100644 index d56a34f2..00000000 --- a/Source/OpenTK/Platform/IResizable.cs +++ /dev/null @@ -1,50 +0,0 @@ -#region --- License --- -/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos - * See license.txt for license info - */ -#endregion - -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenTK.Platform -{ - [Obsolete] - public interface IResizable - { - int Height { get; set; } - int Width { get; set; } - /* - int Top { get; } - int Bottom { get; } - int Left { get; } - int Right { get; } - */ - event ResizeEvent Resize; - } - - [Obsolete] - public delegate void ResizeEvent(object sender, ResizeEventArgs e); - - [Obsolete] - public class ResizeEventArgs : EventArgs - { - public int Width, Height; - - public ResizeEventArgs() - { - } - - public ResizeEventArgs(int width, int height) - { - this.Width = width; - this.Height = height; - } - - public override string ToString() - { - return String.Format("New size: {0}x{1}", Width, Height); - } - } -} diff --git a/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs b/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs index 70626f69..c572aef1 100644 --- a/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs +++ b/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs @@ -398,7 +398,7 @@ namespace OpenTK.Platform.MacOS.Carbon #region --- Carbon API Methods --- - public partial class API + internal partial class API { const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon"; diff --git a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs index a0e608cd..29fc80c1 100644 --- a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs +++ b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs @@ -577,7 +577,7 @@ namespace OpenTK.Platform.MacOS if (Resize != null) { - Resize(this, new ResizeEventArgs(Width, Height)); + Resize(this, EventArgs.Empty); } }