Removed obsolete IResizable, DisplayMode and ColorMode APIs.

Marked carbon API class as internal.
Added a large number of missing XML comments.
This commit is contained in:
the_fiddler 2009-06-04 11:31:02 +00:00
parent 0b9485509f
commit d5efed9045
8 changed files with 4 additions and 650 deletions

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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 {

View file

@ -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
{
/// <summary>Defines a color mode for OpenGL rendering.</summary>
/// <remarks>
/// <para>A ColorMode contains Red, Green, Blue and Alpha components that descibe
/// the allocated bits per pixel for the corresponding color.</para>
/// </remarks>
[Obsolete("Use OpenTK.Graphics.ColorFormat instead.")]
public sealed class ColorMode
{
byte red, green, blue, alpha;
bool isIndexed = false;
int bitsPerPixel;
#region --- Constructors ---
/// <summary>
/// Constructs a new ColorMode with the specified aggregate bits per pixel.
/// </summary>
/// <param name="bpp">The bits per pixel sum for the Red, Green, Blue and Alpha color channels.</param>
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;
}
}
/// <summary>
/// Constructs a new ColorMode with the specified bits per pixel for
/// the Red, Green, Blue and Alpha color channels.
/// </summary>
/// <param name="red">Bits per pixel for the Red color channel.</param>
/// <param name="green">Bits per pixel for the Green color channel.</param>
/// <param name="blue">Bits per pixel for the Blue color channel.</param>
/// <param name="alpha">Bits per pixel for the Alpha color channel.</param>
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 ---
/// <summary>Gets the bits per pixel for the Red channel.</summary>
public int Red { get { return red; } private set { red = (byte)value; } }
/// <summary>Gets the bits per pixel for the Green channel.</summary>
public int Green { get { return green; } private set { green = (byte)value; } }
/// <summary>Gets the bits per pixel for the Blue channel.</summary>
public int Blue { get { return blue; } private set { blue = (byte)value; } }
/// <summary>Gets the bits per pixel for the Alpha channel.</summary>
public int Alpha { get { return alpha; } private set { alpha = (byte)value; } }
/// <summary>Gets a System.Boolean indicating whether this ColorMode is indexed.</summary>
public bool IsIndexed { get { return isIndexed; } private set { isIndexed = value; } }
/// <summary>Gets the sum of Red, Green, Blue and Alpha bits per pixel.</summary>
public int BitsPerPixel { get { return bitsPerPixel; } private set { bitsPerPixel = value; } }
#endregion
#region --- Operator Overloads ---
/// <summary>
/// Converts the specified bpp into a new ColorMode.
/// </summary>
/// <param name="bpp">The bits per pixel to convert.</param>
/// <returns>A ColorMode with the specified bits per pixel.</returns>
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
}
}

View file

@ -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;
/// <summary>Defines the display mode for a render window.</summary>
[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) { }
/// <summary>
/// Constructs a new DisplayMode from the specified parameters.
/// </summary>
/// <param name="width">The Width of the DisplayMode, in pixels.</param>
/// <param name="height">The Height of the DisplayMode, in pixels.</param>
/// <param name="color">The ColorMode of the color buffer.</param>
/// <param name="depth">The number of bits in the depth buffer.</param>
/// <param name="stencil">The number of bits in the stencil buffer.</param>
/// <param name="aux">The number of bits in the auxilliary buffer.</param>
/// <param name="fullscreen">Set to true for a fullscreen DisplayMode.</param>
/// <param name="stereo">Set to true for a DisplayMode with stereographic capabilities.</param>
/// <param name="buffers">The number of render buffers. Typical values include one (single-), two (double-) or three (triple-buffering).</param>
/// <param name="vsync">Set to true to sync the updates to the screen refresh rate.</param>
/// <param name="refresh">The desired RefreshRate. Taken into account only for Fullscreen DisplayModes.</param>
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;
}
/// <summary>
/// Constructs a new DisplayMode.
/// </summary>
/// <param name="width">The Width of the DisplayMode in pixels.</param>
/// <param name="height">The Height of the DisplayMode in pixels.</param>
public DisplayMode(int width, int height)
: this(width, height, DisplayDevice.Default.BitsPerPixel, 16, 0, 0, 2, false, false, false, 0.0f)
{
}
/// <summary>
/// Constructs a new DisplayMode.
/// </summary>
/// <param name="width">The Width of the DisplayMode in pixels.</param>
/// <param name="height">The Height of the DisplayMode in pixels.</param>
/// <param name="color">The ColorMode of the color buffer.</param>
public DisplayMode(int width, int height, ColorMode color)
: this(width, height, color, 16, 0, 0, 2, false, false, false, 0.0f)
{
}
/// <summary>
/// Constructs a new DisplayMode.
/// </summary>
/// <param name="width">The Width of the DisplayMode in pixels.</param>
/// <param name="height">The Height of the DisplayMode in pixels.</param>
/// <param name="color">The ColorMode of the color buffer.</param>
/// <param name="depth">The number of bits in the depth buffer.</param>
public DisplayMode(int width, int height, ColorMode color, int depth)
: this(width, height, color, depth, 0, 0, 2, false, false, false, 0.0f)
{
}
/// <summary>
/// Constructs a new DisplayMode.
/// </summary>
/// <param name="width">The Width of the DisplayMode in pixels.</param>
/// <param name="height">The Height of the DisplayMode in pixels.</param>
/// <param name="color">The ColorMode of the color buffer.</param>
/// <param name="depth">The number of bits in the depth buffer.</param>
/// <param name="fullscreen">True for a fullscreen DisplayMode, false otherwise.</param>
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
/// <summary>
/// Gets an OpenTK.Graphics.ColorMode that describes the color format of this DisplayMode.
/// </summary>
public ColorMode ColorDepth
{
get { return color_format; }
private set { color_format = value; }
}
#endregion
#region public int AuxilliaryColorDepth
/// <summary>
/// Gets an OpenTK.Graphics.ColorMode that describes the color format of this DisplayMode.
/// </summary>
public ColorMode AuxilliaryColorDepth
{
get { return auxilliary_color_format; }
private set { auxilliary_color_format = value; }
}
#endregion
#region public int Depth
/// <summary>
/// Gets a System.Int32 that contains the bits per pixel for the depth buffer
/// of this DisplayMode.
/// </summary>
public int Depth
{
get { return depthBits; }
private set { depthBits = value; }
}
#endregion
#region public int Stencil
/// <summary>
/// Gets a System.Int32 that contains the bits per pixel for the stencil buffer
/// of this DisplayMode.
/// </summary>
public int Stencil
{
get { return stencilBits; }
private set { stencilBits = value; }
}
#endregion
#endif
#region Obsolete Properties
#region public bool Stereo
/// <summary>
/// Gets a System.Boolean indicating whether this DisplayMode is stereoscopic.
/// </summary>
[Obsolete("Use GraphicsMode.Stereo instead.")]
public bool Stereo
{
get { return this.stereo; }
private set { this.stereo = value; }
}
#endregion
#region public int Buffers
/// <summary>
/// Gets a System.Int32 containing the number of buffers associated with this
/// DisplayMode.
/// </summary>
[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
/// <summary>
/// Gets or sets the Height of the DisplayMode. Height is the vertical span measured in pixels.
/// </summary>
[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
/// <summary>
/// Gets or sets the Width of the DisplayMode. Width is the horizontal span measured in pixels.
/// </summary>
[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 ---
/// <summary>
/// Describes this DisplayMode instance.
/// </summary>
/// <returns>Returns a System.String that describes this DisplayMode instance.</returns>
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 { }
}

View file

@ -86,17 +86,6 @@ namespace OpenTK
this.CreateControl();
}
#region Obsolete
/// <summary>This method is obsolete and will be removed in future versions.</summary>
/// <param name="mode">Obsolete.</param>v
[Obsolete]
public GLControl(DisplayMode mode)
: this(mode.ToGraphicsMode())
{ }
#endregion
#endregion
#region --- Protected Methods ---

View file

@ -252,28 +252,6 @@ namespace OpenTK
#endregion
#region Obsolete
/// <summary>
/// Constructs a new GameWindow, and opens a render window with the specified DisplayMode.
/// </summary>
/// <param name="mode">The DisplayMode of the GameWindow.</param>
[Obsolete]
public GameWindow(DisplayMode mode)
: this(mode.Width, mode.Height, mode.ToGraphicsMode(), "OpenTK Game Window", mode.Fullscreen ? GameWindowFlags.Fullscreen : 0) { }
/// <summary>
/// Constructs a new GameWindow with the specified title, and opens a render window with the
/// specified DisplayMode.
/// </summary>
/// <param name="mode">The DisplayMode of the GameWindow.</param>
/// <param name="title">The Title of the GameWindow.</param>
[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;
/// <summary>
/// Gets the Time elapsed between frame updates, in seconds.
/// </summary>
public double Time
{
get { return time; }
internal set { time = value; }
}
}
public class RenderFrameEventArgs : EventArgs
{
private double time;
private double scale_factor;
/// <summary>
/// Gets the Time elapsed between frame updates, in seconds.
/// </summary>
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]

View file

@ -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);
}
}
}

View file

@ -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";

View file

@ -577,7 +577,7 @@ namespace OpenTK.Platform.MacOS
if (Resize != null)
{
Resize(this, new ResizeEventArgs(Width, Height));
Resize(this, EventArgs.Empty);
}
}