Enforced use of explicit private modifiers.

This commit is contained in:
Jarl Gullberg 2017-07-07 17:40:24 +02:00
parent f1362eef2b
commit 5f2d3144c4
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
232 changed files with 39413 additions and 39317 deletions

View file

@ -31,20 +31,20 @@ using Enum=Bind.Structures.Enum;
namespace Bind namespace Bind
{ {
enum WriteOptions internal enum WriteOptions
{ {
Default = 0, Default = 0,
NoIndent = 1 NoIndent = 1
} }
class BindStreamWriter : IDisposable internal class BindStreamWriter : IDisposable
{ {
static readonly string[] SplitStrings = new string[] { System.Environment.NewLine }; private static readonly string[] SplitStrings = new string[] { System.Environment.NewLine };
readonly StreamWriter sw; private readonly StreamWriter sw;
public readonly string File; public readonly string File;
bool newline = true; private bool newline = true;
int indent_level = 0; private int indent_level = 0;
public BindStreamWriter(string file) public BindStreamWriter(string file)
{ {
@ -139,7 +139,7 @@ namespace Bind
sw.Close(); sw.Close();
} }
void WriteIndentations(WriteOptions options) private void WriteIndentations(WriteOptions options)
{ {
if (options != WriteOptions.NoIndent) if (options != WriteOptions.NoIndent)
{ {

View file

@ -9,7 +9,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.CL namespace Bind.CL
{ {
class CLGenerator : ES.ESGenerator internal class CLGenerator : ES.ESGenerator
{ {
public CLGenerator(Settings settings) public CLGenerator(Settings settings)
: base(settings) : base(settings)

View file

@ -37,10 +37,10 @@ namespace Bind
using Enum = Bind.Structures.Enum; using Enum = Bind.Structures.Enum;
using Type = Bind.Structures.Type; using Type = Bind.Structures.Type;
sealed class CSharpSpecWriter internal sealed class CSharpSpecWriter
{ {
IBind Generator { get; set; } private IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } } private Settings Settings { get { return Generator.Settings; } }
public void WriteBindings(IBind generator) public void WriteBindings(IBind generator)
{ {
@ -59,7 +59,7 @@ namespace Bind
Console.SetCursorPosition(left, top); Console.SetCursorPosition(left, top);
} }
void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums) private void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
{ {
Console.WriteLine("Writing bindings to {0}", Settings.OutputPath); Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
if (!Directory.Exists(Settings.OutputPath)) if (!Directory.Exists(Settings.OutputPath))
@ -133,7 +133,7 @@ namespace Bind
File.Move(temp_wrappers_file, output_wrappers); File.Move(temp_wrappers_file, output_wrappers);
} }
void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers, private void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers,
DelegateCollection delegates, EnumCollection enums, DelegateCollection delegates, EnumCollection enums,
IDictionary<string, string> CSTypes) IDictionary<string, string> CSTypes)
{ {
@ -244,7 +244,7 @@ namespace Bind
Console.WriteLine("Wrote {0} wrappers for {1} signatures", current_wrapper, current_signature); Console.WriteLine("Wrote {0} wrappers for {1} signatures", current_wrapper, current_signature);
} }
void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums) private void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums)
{ {
if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0) if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
{ {
@ -276,7 +276,7 @@ namespace Bind
sw.WriteLine("public static {0} {{ throw new NotImplementedException(); }}", GetDeclarationString(f, Settings.Compatibility)); sw.WriteLine("public static {0} {{ throw new NotImplementedException(); }}", GetDeclarationString(f, Settings.Compatibility));
} }
void WriteDocumentation(BindStreamWriter sw, Function f) private void WriteDocumentation(BindStreamWriter sw, Function f)
{ {
var docs = f.Documentation; var docs = f.Documentation;
@ -393,7 +393,7 @@ namespace Bind
} }
} }
void WriteConstants(BindStreamWriter sw, IEnumerable<Constant> constants) private void WriteConstants(BindStreamWriter sw, IEnumerable<Constant> constants)
{ {
// Make sure everything is sorted. This will avoid random changes between // Make sure everything is sorted. This will avoid random changes between
// consecutive runs of the program. // consecutive runs of the program.
@ -417,7 +417,7 @@ namespace Bind
} }
} }
void WriteEnums(BindStreamWriter sw, EnumCollection enums, FunctionCollection wrappers) private void WriteEnums(BindStreamWriter sw, EnumCollection enums, FunctionCollection wrappers)
{ {
//sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute //sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
//sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments //sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
@ -530,15 +530,16 @@ namespace Bind
// For example, if parameter foo has indirection level = 1, then it // For example, if parameter foo has indirection level = 1, then it
// is consumed as 'foo*' in the fixed_statements and the call string. // is consumed as 'foo*' in the fixed_statements and the call string.
readonly static string[] pointer_levels = new string[] { "", "*", "**", "***", "****" }; private readonly static string[] pointer_levels = new string[] { "", "*", "**", "***", "****" };
readonly static string[] array_levels = new string[] { "", "[]", "[,]", "[,,]", "[,,,]" };
static bool IsEnum(string s, EnumCollection enums) private readonly static string[] array_levels = new string[] { "", "[]", "[,]", "[,,]", "[,,,]" };
private static bool IsEnum(string s, EnumCollection enums)
{ {
return enums.ContainsKey(s); return enums.ContainsKey(s);
} }
string GetDeclarationString(Constant c) private string GetDeclarationString(Constant c)
{ {
if (String.IsNullOrEmpty(c.Name)) if (String.IsNullOrEmpty(c.Name))
{ {
@ -554,7 +555,7 @@ namespace Bind
c.Value); c.Value);
} }
string GetDeclarationString(Delegate d, bool is_delegate) private string GetDeclarationString(Delegate d, bool is_delegate)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -570,7 +571,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Enum e) private string GetDeclarationString(Enum e)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<Constant> constants = new List<Constant>(e.ConstantCollection.Values); List<Constant> constants = new List<Constant>(e.ConstantCollection.Values);
@ -603,7 +604,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Function f, Settings.Legacy settings) private string GetDeclarationString(Function f, Settings.Legacy settings)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -646,7 +647,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings) private string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -687,7 +688,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings) private string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -709,7 +710,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Type type, Settings.Legacy settings) private string GetDeclarationString(Type type, Settings.Legacy settings)
{ {
var t = type.QualifiedType; var t = type.QualifiedType;
if ((settings & Settings.Legacy.ConstIntEnums) != 0) if ((settings & Settings.Legacy.ConstIntEnums) != 0)

View file

@ -13,27 +13,31 @@ using Bind.Structures;
namespace Bind namespace Bind
{ {
class DocProcessor internal class DocProcessor
{ {
static readonly char[] numbers = "0123456789".ToCharArray(); private static readonly char[] numbers = "0123456789".ToCharArray();
static readonly Regex remove_mathml = new Regex(
private static readonly Regex remove_mathml = new Regex(
@"<(mml:math|inlineequation)[^>]*?>(?:.|\n)*?</\s*\1\s*>", @"<(mml:math|inlineequation)[^>]*?>(?:.|\n)*?</\s*\1\s*>",
RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
static readonly Regex remove_doctype = new Regex(
private static readonly Regex remove_doctype = new Regex(
@"<!DOCTYPE[^>\[]*(\[.*\])?>", RegexOptions.Compiled | RegexOptions.Multiline); @"<!DOCTYPE[^>\[]*(\[.*\])?>", RegexOptions.Compiled | RegexOptions.Multiline);
static readonly Regex remove_xmlns = new Regex(
private static readonly Regex remove_xmlns = new Regex(
"xmlns=\".+\"", RegexOptions.Compiled); "xmlns=\".+\"", RegexOptions.Compiled);
readonly Dictionary<string, string> DocumentationFiles = private readonly Dictionary<string, string> DocumentationFiles =
new Dictionary<string, string>(); new Dictionary<string, string>();
readonly Dictionary<string, Documentation> DocumentationCache =
private readonly Dictionary<string, Documentation> DocumentationCache =
new Dictionary<string, Documentation>(); new Dictionary<string, Documentation>();
Documentation Cached; private Documentation Cached;
string LastFile; private string LastFile;
IBind Generator { get; set; } private IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } } private Settings Settings { get { return Generator.Settings; } }
public DocProcessor(IBind generator) public DocProcessor(IBind generator)
{ {
@ -87,7 +91,7 @@ namespace Bind
// found in the <!-- eqn: :--> comments in the docs. // found in the <!-- eqn: :--> comments in the docs.
// Todo: Some simple MathML tags do not include comments, find a solution. // Todo: Some simple MathML tags do not include comments, find a solution.
// Todo: Some files include more than 1 function - find a way to map these extra functions. // Todo: Some files include more than 1 function - find a way to map these extra functions.
Documentation ProcessFile(string file, EnumProcessor processor) private Documentation ProcessFile(string file, EnumProcessor processor)
{ {
string text; string text;
@ -148,7 +152,7 @@ namespace Bind
} }
} }
Documentation ToInlineDocs(XDocument doc, EnumProcessor enum_processor) private Documentation ToInlineDocs(XDocument doc, EnumProcessor enum_processor)
{ {
if (doc == null || enum_processor == null) if (doc == null || enum_processor == null)
throw new ArgumentNullException(); throw new ArgumentNullException();
@ -190,8 +194,9 @@ namespace Bind
return inline; return inline;
} }
static readonly char[] newline = new char[] { '\n' }; private static readonly char[] newline = new char[] { '\n' };
static string Cleanup(string text)
private static string Cleanup(string text)
{ {
return return
String.Join(" ", text String.Join(" ", text

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generation implementation for OpenGL ES 2.0 and 3.0 // Generation implementation for OpenGL ES 2.0 and 3.0
class ES2Generator : Generator internal class ES2Generator : Generator
{ {
public ES2Generator(Settings settings) public ES2Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generation implementation for OpenGL ES 3.1 // Generation implementation for OpenGL ES 3.1
class ES31Generator : Generator internal class ES31Generator : Generator
{ {
public ES31Generator(Settings settings) public ES31Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generation implementation for OpenGL ES 3.0 // Generation implementation for OpenGL ES 3.0
class ES3Generator : Generator internal class ES3Generator : Generator
{ {
public ES3Generator(Settings settings) public ES3Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -10,7 +10,7 @@ using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generator implementation for OpenGL ES 1.0 and 1.1 // Generator implementation for OpenGL ES 1.0 and 1.1
class ESGenerator : Generator internal class ESGenerator : Generator
{ {
public ESGenerator(Settings settings) public ESGenerator(Settings settings)
: base(settings) : base(settings)

View file

@ -35,12 +35,12 @@ using Enum = Bind.Structures.Enum;
namespace Bind namespace Bind
{ {
class EnumProcessor internal class EnumProcessor
{ {
readonly IEnumerable<string> Overrides; private readonly IEnumerable<string> Overrides;
IBind Generator { get; set; } private IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } } private Settings Settings { get { return Generator.Settings; } }
public EnumProcessor(IBind generator, IEnumerable<string> overrides) public EnumProcessor(IBind generator, IEnumerable<string> overrides)
{ {
@ -85,7 +85,7 @@ namespace Bind
return path.ToString(); return path.ToString();
} }
EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname) private EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname)
{ {
EnumCollection processed_enums = new EnumCollection(); EnumCollection processed_enums = new EnumCollection();
foreach (var e in enums.Values) foreach (var e in enums.Values)
@ -121,7 +121,7 @@ namespace Bind
return processed_enums; return processed_enums;
} }
static string ReplaceName(XPathNavigator nav, string apiname, string name) private static string ReplaceName(XPathNavigator nav, string apiname, string name)
{ {
var enum_override = nav.SelectSingleNode(GetOverridesPath(apiname, name)); var enum_override = nav.SelectSingleNode(GetOverridesPath(apiname, name));
if (enum_override != null) if (enum_override != null)
@ -135,7 +135,7 @@ namespace Bind
return name; return name;
} }
static bool IsAlreadyProcessed(string name) private static bool IsAlreadyProcessed(string name)
{ {
string extension = Utilities.GetExtension(name, true); string extension = Utilities.GetExtension(name, true);
bool unprocessed = false; bool unprocessed = false;
@ -225,7 +225,7 @@ namespace Bind
return name; return name;
} }
EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname) private EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname)
{ {
foreach (var e in enums.Values) foreach (var e in enums.Values)
{ {
@ -258,7 +258,7 @@ namespace Bind
return enums; return enums;
} }
static void ReplaceConstant(XPathNavigator enum_override, Constant c) private static void ReplaceConstant(XPathNavigator enum_override, Constant c)
{ {
if (enum_override != null) if (enum_override != null)
{ {
@ -362,7 +362,7 @@ namespace Bind
// (e.g. FOG_COORD_ARRAY_TYPE = GL_FOG_COORDINATE_ARRAY_TYPE) // (e.g. FOG_COORD_ARRAY_TYPE = GL_FOG_COORDINATE_ARRAY_TYPE)
// In this case try searching all enums for the correct constant to alias (stupid opengl specs). // In this case try searching all enums for the correct constant to alias (stupid opengl specs).
// This turns every bare alias into a normal alias that is processed afterwards. // This turns every bare alias into a normal alias that is processed afterwards.
static void ResolveBareAlias(Constant c, EnumCollection enums) private static void ResolveBareAlias(Constant c, EnumCollection enums)
{ {
// Constants are considered bare aliases when they don't have a reference and // Constants are considered bare aliases when they don't have a reference and
// their values are non-numeric. // their values are non-numeric.
@ -383,7 +383,7 @@ namespace Bind
// Resolve 'use' tokens by searching and replacing the correct // Resolve 'use' tokens by searching and replacing the correct
// value from the enum collection. // value from the enum collection.
// Tokens that can't be resolved are removed. // Tokens that can't be resolved are removed.
static void ResolveAliases(Enum e, EnumCollection enums) private static void ResolveAliases(Enum e, EnumCollection enums)
{ {
// Note that we have the removal must be a separate step, since // Note that we have the removal must be a separate step, since
// we cannot modify a collection while iterating with foreach. // we cannot modify a collection while iterating with foreach.
@ -397,7 +397,7 @@ namespace Bind
} }
} }
static bool IsValue(string test) private static bool IsValue(string test)
{ {
// Check if the result is a number. // Check if the result is a number.
long number; long number;

View file

@ -39,23 +39,25 @@ namespace Bind
using Enum = Bind.Structures.Enum; using Enum = Bind.Structures.Enum;
using Type = Bind.Structures.Type; using Type = Bind.Structures.Type;
class FuncProcessor internal class FuncProcessor
{ {
static readonly Regex Endings = new Regex( private static readonly Regex Endings = new Regex(
@"([fd]v?|u?[isb](64)?v?|v|i_v|fi)$", @"([fd]v?|u?[isb](64)?v?|v|i_v|fi)$",
RegexOptions.Compiled); RegexOptions.Compiled);
static readonly Regex EndingsNotToTrim = new Regex(
private static readonly Regex EndingsNotToTrim = new Regex(
"(sh|ib|[tdrey]s|[eE]n[vd]|bled" + "(sh|ib|[tdrey]s|[eE]n[vd]|bled" +
"|Attrib|Access|Boolean|Coord|Depth|Feedbacks|Finish|Flag" + "|Attrib|Access|Boolean|Coord|Depth|Feedbacks|Finish|Flag" +
"|Groups|IDs|Indexed|Instanced|Pixels|Queries|Status|Tess|Through" + "|Groups|IDs|Indexed|Instanced|Pixels|Queries|Status|Tess|Through" +
"|Uniforms|Varyings|Weight|Width)$", "|Uniforms|Varyings|Weight|Width)$",
RegexOptions.Compiled); RegexOptions.Compiled);
static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
readonly IEnumerable<string> Overrides; private static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
IBind Generator { get; set; } private readonly IEnumerable<string> Overrides;
Settings Settings { get { return Generator.Settings; } }
private IBind Generator { get; set; }
private Settings Settings { get { return Generator.Settings; } }
public FuncProcessor(IBind generator, IEnumerable<string> overrides) public FuncProcessor(IBind generator, IEnumerable<string> overrides)
{ {
@ -139,7 +141,7 @@ namespace Bind
return wrappers; return wrappers;
} }
void GenerateDocumentation(FunctionCollection wrappers, private void GenerateDocumentation(FunctionCollection wrappers,
EnumProcessor enum_processor, DocProcessor doc_processor) EnumProcessor enum_processor, DocProcessor doc_processor)
{ {
foreach (var list in wrappers) foreach (var list in wrappers)
@ -152,7 +154,7 @@ namespace Bind
} }
} }
void GenerateAddressTable(DelegateCollection delegates) private void GenerateAddressTable(DelegateCollection delegates)
{ {
// We allocate one slot per entry point. Rules: // We allocate one slot per entry point. Rules:
// - All extensions get a slot // - All extensions get a slot
@ -191,7 +193,7 @@ namespace Bind
// the overloaded ones. This allows us to reduce the amount // the overloaded ones. This allows us to reduce the amount
// of delegates we need to generate (1 per entry point instead // of delegates we need to generate (1 per entry point instead
// of 1 per overload), which improves loading times. // of 1 per overload), which improves loading times.
static void RemoveOverloadedDelegates(DelegateCollection delegates, FunctionCollection wrappers) private static void RemoveOverloadedDelegates(DelegateCollection delegates, FunctionCollection wrappers)
{ {
foreach (var w in wrappers.Values.SelectMany(w => w)) foreach (var w in wrappers.Values.SelectMany(w => w))
{ {
@ -200,7 +202,7 @@ namespace Bind
} }
} }
static string GetPath(string apipath, string apiname, string apiversion, string function, string extension) private static string GetPath(string apipath, string apiname, string apiversion, string function, string extension)
{ {
var path = new StringBuilder(); var path = new StringBuilder();
path.Append("/signatures/"); path.Append("/signatures/");
@ -246,17 +248,17 @@ namespace Bind
return path.ToString(); return path.ToString();
} }
static string GetOverloadsPath(string apiname, string apiversion, string function, string extension) private static string GetOverloadsPath(string apiname, string apiversion, string function, string extension)
{ {
return GetPath("overload", apiname, apiversion, function, extension); return GetPath("overload", apiname, apiversion, function, extension);
} }
static string GetOverridesPath(string apiname, string apiversion, string function, string extension) private static string GetOverridesPath(string apiname, string apiversion, string function, string extension)
{ {
return GetPath("replace", apiname, apiversion, function, extension); return GetPath("replace", apiname, apiversion, function, extension);
} }
void TranslateType(Bind.Structures.Type type, private void TranslateType(Bind.Structures.Type type,
XPathNavigator function_override, XPathNavigator overrides, XPathNavigator function_override, XPathNavigator overrides,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string category, string apiname) string category, string apiname)
@ -375,7 +377,7 @@ namespace Bind
} }
} }
static string TranslateExtension(string extension) private static string TranslateExtension(string extension)
{ {
extension = extension.ToUpper(); extension = extension.ToUpper();
if (extension.Length > 2) if (extension.Length > 2)
@ -385,12 +387,12 @@ namespace Bind
return extension; return extension;
} }
void TranslateExtension(Delegate d) private void TranslateExtension(Delegate d)
{ {
d.Extension = TranslateExtension(d.Extension); d.Extension = TranslateExtension(d.Extension);
} }
static string GetTrimmedExtension(string name, string extension) private static string GetTrimmedExtension(string name, string extension)
{ {
// Extensions are always uppercase // Extensions are always uppercase
int index = name.LastIndexOf(extension.ToUpper()); int index = name.LastIndexOf(extension.ToUpper());
@ -402,7 +404,7 @@ namespace Bind
} }
// Trims unecessary suffices from the specified OpenGL function name. // Trims unecessary suffices from the specified OpenGL function name.
static string GetTrimmedName(Delegate d) private static string GetTrimmedName(Delegate d)
{ {
string name = d.Name; string name = d.Name;
string extension = d.Extension; string extension = d.Extension;
@ -441,7 +443,7 @@ namespace Bind
return trimmed_name; return trimmed_name;
} }
static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion) private static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion)
{ {
// Try a few different extension variations that appear in the overrides xml file // Try a few different extension variations that appear in the overrides xml file
string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() }; string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() };
@ -464,7 +466,7 @@ namespace Bind
return function_overload; return function_overload;
} }
static XPathNavigator GetFuncOverride(XPathNavigator nav, Delegate d, string apiname, string apiversion) private static XPathNavigator GetFuncOverride(XPathNavigator nav, Delegate d, string apiname, string apiversion)
{ {
// Try a few different extension variations that appear in the overrides xml file // Try a few different extension variations that appear in the overrides xml file
string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() }; string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() };
@ -487,12 +489,12 @@ namespace Bind
return function_override; return function_override;
} }
void TrimName(Function f) private void TrimName(Function f)
{ {
f.TrimmedName = GetTrimmedName(f); f.TrimmedName = GetTrimmedName(f);
} }
static void ApplyParameterReplacement(Delegate d, XPathNavigator function_override) private static void ApplyParameterReplacement(Delegate d, XPathNavigator function_override)
{ {
if (function_override != null) if (function_override != null)
{ {
@ -529,7 +531,7 @@ namespace Bind
} }
} }
static void ApplyReturnTypeReplacement(Delegate d, XPathNavigator function_override) private static void ApplyReturnTypeReplacement(Delegate d, XPathNavigator function_override)
{ {
if (function_override != null) if (function_override != null)
{ {
@ -550,7 +552,7 @@ namespace Bind
// 3) A generic object or void* (translates to IntPtr) // 3) A generic object or void* (translates to IntPtr)
// 4) A GLenum (translates to int on Legacy.Tao or GL.Enums.GLenum otherwise). // 4) A GLenum (translates to int on Legacy.Tao or GL.Enums.GLenum otherwise).
// Return types must always be CLS-compliant, because .Net does not support overloading on return types. // Return types must always be CLS-compliant, because .Net does not support overloading on return types.
void TranslateReturnType(Delegate d, private void TranslateReturnType(Delegate d,
XPathNavigator function_override, XPathNavigator nav, XPathNavigator function_override, XPathNavigator nav,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string apiname, string apiversion) string apiname, string apiversion)
@ -596,7 +598,7 @@ namespace Bind
d.ReturnType.CurrentType = GetCLSCompliantType(d.ReturnType); d.ReturnType.CurrentType = GetCLSCompliantType(d.ReturnType);
} }
Delegate GetCLSCompliantDelegate(Delegate d) private Delegate GetCLSCompliantDelegate(Delegate d)
{ {
Delegate f = new Delegate(d); Delegate f = new Delegate(d);
@ -610,7 +612,7 @@ namespace Bind
return f; return f;
} }
void TranslateParameters(Delegate d, private void TranslateParameters(Delegate d,
XPathNavigator function_override, XPathNavigator nav, XPathNavigator function_override, XPathNavigator nav,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string apiname, string apiversion) string apiname, string apiversion)
@ -625,7 +627,7 @@ namespace Bind
} }
} }
void TranslateParameter(Parameter p, private void TranslateParameter(Parameter p,
XPathNavigator function_override, XPathNavigator overrides, XPathNavigator function_override, XPathNavigator overrides,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string category, string apiname) string category, string apiname)
@ -698,7 +700,7 @@ namespace Bind
// WrapperType = WrapperTypes.BoolParameter; // WrapperType = WrapperTypes.BoolParameter;
} }
void TranslateAttributes(Delegate d, private void TranslateAttributes(Delegate d,
XPathNavigator function_override, XPathNavigator nav, XPathNavigator function_override, XPathNavigator nav,
string apiname, string apiversion) string apiname, string apiversion)
{ {
@ -730,7 +732,7 @@ namespace Bind
} }
} }
FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums) private FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
{ {
var wrappers = new FunctionCollection(); var wrappers = new FunctionCollection();
foreach (var d in delegates.Values.SelectMany(v => v)) foreach (var d in delegates.Values.SelectMany(v => v))
@ -765,7 +767,7 @@ namespace Bind
return wrappers; return wrappers;
} }
FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums) private FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums)
{ {
// If the function is not CLS-compliant (e.g. it contains unsigned parameters) // If the function is not CLS-compliant (e.g. it contains unsigned parameters)
// we need to create a CLS-Compliant overload. However, we should only do this // we need to create a CLS-Compliant overload. However, we should only do this
@ -806,7 +808,7 @@ namespace Bind
return wrappers; return wrappers;
} }
static FunctionCollection MarkCLSCompliance(FunctionCollection collection) private static FunctionCollection MarkCLSCompliance(FunctionCollection collection)
{ {
//foreach (var w in //foreach (var w in
// (from list in collection // (from list in collection
@ -872,7 +874,7 @@ namespace Bind
return collection; return collection;
} }
string GetCLSCompliantType(Type type) private string GetCLSCompliantType(Type type)
{ {
if (!type.CLSCompliant) if (!type.CLSCompliant)
{ {
@ -901,7 +903,7 @@ namespace Bind
return type.CurrentType; return type.CurrentType;
} }
IEnumerable<Function> CreateNormalWrappers(Delegate d, EnumCollection enums) private IEnumerable<Function> CreateNormalWrappers(Delegate d, EnumCollection enums)
{ {
Function f = new Function(d); Function f = new Function(d);
TrimName(f); TrimName(f);
@ -913,7 +915,7 @@ namespace Bind
} }
} }
IEnumerable<Function> CreateConvenienceOverloads(FunctionCollection wrappers) private IEnumerable<Function> CreateConvenienceOverloads(FunctionCollection wrappers)
{ {
var convenience_wrappers = new List<Function>(); var convenience_wrappers = new List<Function>();
foreach (var d in wrappers.Values.SelectMany(w => w)) foreach (var d in wrappers.Values.SelectMany(w => w))
@ -984,7 +986,7 @@ namespace Bind
return convenience_wrappers; return convenience_wrappers;
} }
static Function CreateReturnTypeConvenienceWrapper(Function d) private static Function CreateReturnTypeConvenienceWrapper(Function d)
{ {
var f = new Function(d); var f = new Function(d);
f.ReturnType = new Type(f.Parameters.Last()); f.ReturnType = new Type(f.Parameters.Last());
@ -1004,7 +1006,7 @@ namespace Bind
return f; return f;
} }
static Function CreateArrayReturnTypeConvenienceWrapper(Function d) private static Function CreateArrayReturnTypeConvenienceWrapper(Function d)
{ {
var f = new Function(d); var f = new Function(d);
var p_array = f.Parameters.Last(); var p_array = f.Parameters.Last();
@ -1021,7 +1023,7 @@ namespace Bind
return f; return f;
} }
List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw) private List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw)
{ {
if (!dictionary.ContainsKey(key)) if (!dictionary.ContainsKey(key))
{ {
@ -1226,7 +1228,7 @@ namespace Bind
} }
} }
static void WrapReturnType(Function func) private static void WrapReturnType(Function func)
{ {
if ((func.ReturnType.WrapperType & WrapperTypes.StringReturnType) != 0) if ((func.ReturnType.WrapperType & WrapperTypes.StringReturnType) != 0)
{ {

View file

@ -30,8 +30,7 @@ using System.IO;
namespace Bind.GL2 namespace Bind.GL2
{ {
internal class GL2Generator : Generator
class GL2Generator : Generator
{ {
public GL2Generator(Settings settings) public GL2Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -31,7 +31,7 @@ using System.Text;
namespace Bind.GL2 namespace Bind.GL2
{ {
class GL4Generator : Generator internal class GL4Generator : Generator
{ {
public GL4Generator(Settings settings) public GL4Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -16,7 +16,7 @@ using Type=Bind.Structures.Type;
namespace Bind.GL2 namespace Bind.GL2
{ {
abstract class Generator : IBind internal abstract class Generator : IBind
{ {
protected string glTypemap = "GL2/gl.tm"; protected string glTypemap = "GL2/gl.tm";
protected string csTypemap = "csharp.tm"; protected string csTypemap = "csharp.tm";
@ -78,7 +78,7 @@ namespace Bind.GL2
SpecReader = new XmlSpecReader(Settings); SpecReader = new XmlSpecReader(Settings);
} }
IEnumerable<string> GetFiles(string path) private IEnumerable<string> GetFiles(string path)
{ {
path = Path.Combine(Settings.InputPath, path); path = Path.Combine(Settings.InputPath, path);
if ((File.GetAttributes(path) & FileAttributes.Directory) != 0) if ((File.GetAttributes(path) & FileAttributes.Directory) != 0)

View file

@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace Bind namespace Bind
{ {
interface IBind internal interface IBind
{ {
DelegateCollection Delegates { get; } DelegateCollection Delegates { get; }
EnumCollection Enums { get; } EnumCollection Enums { get; }

View file

@ -8,7 +8,7 @@ using Bind.Structures;
namespace Bind namespace Bind
{ {
interface ISpecReader internal interface ISpecReader
{ {
void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversion); void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversion);
void ReadEnums(string file, EnumCollection enums, string apiname, string apiversion); void ReadEnums(string file, EnumCollection enums, string apiname, string apiversion);

View file

@ -16,7 +16,7 @@ using Bind.GL2;
namespace Bind namespace Bind
{ {
enum GeneratorMode internal enum GeneratorMode
{ {
All = 0, All = 0,
Default = All, Default = All,
@ -31,13 +31,13 @@ namespace Bind
CL10, CL10,
} }
static class MainClass internal static class MainClass
{ {
static GeneratorMode mode = GeneratorMode.Default; private static GeneratorMode mode = GeneratorMode.Default;
static internal List<IBind> Generators = new List<IBind>(); static internal List<IBind> Generators = new List<IBind>();
static Settings Settings = new Settings(); private static Settings Settings = new Settings();
static void Main(string[] arguments) private static void Main(string[] arguments)
{ {
Debug.Listeners.Clear(); Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

View file

@ -11,7 +11,7 @@ using System.Runtime.Serialization.Formatters.Binary;
namespace Bind namespace Bind
{ {
[Serializable] [Serializable]
class Settings internal class Settings
{ {
public Settings() public Settings()
{ {
@ -32,10 +32,11 @@ namespace Bind
public string DefaultWrappersFile = "GL.cs"; public string DefaultWrappersFile = "GL.cs";
public Legacy DefaultCompatibility = Legacy.NoDropMultipleTokens; public Legacy DefaultCompatibility = Legacy.NoDropMultipleTokens;
string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile, private string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile,
languageTypeMapFile, keywordEscapeCharacter, importsFile, delegatesFile, enumsFile, languageTypeMapFile, keywordEscapeCharacter, importsFile, delegatesFile, enumsFile,
wrappersFile; wrappersFile;
Nullable<Legacy> compatibility;
private Nullable<Legacy> compatibility;
public string InputPath { get { return inputPath ?? DefaultInputPath; } set { inputPath = value; } } public string InputPath { get { return inputPath ?? DefaultInputPath; } set { inputPath = value; } }
public string OutputPath { get { return outputPath ?? DefaultOutputPath; } set { outputPath = value; } } public string OutputPath { get { return outputPath ?? DefaultOutputPath; } set { outputPath = value; } }
public string OutputNamespace { get { return outputNamespace ?? DefaultOutputNamespace; } set { outputNamespace = value; } } public string OutputNamespace { get { return outputNamespace ?? DefaultOutputNamespace; } set { outputNamespace = value; } }

View file

@ -15,12 +15,12 @@ namespace Bind.Structures
/// can be retrieved or set. The value can be either a number, another constant /// can be retrieved or set. The value can be either a number, another constant
/// or an alias to a constant /// or an alias to a constant
/// </summary> /// </summary>
class Constant : IComparable<Constant> internal class Constant : IComparable<Constant>
{ {
// Gets the name prior to translation. // Gets the name prior to translation.
public string OriginalName { get; private set; } public string OriginalName { get; private set; }
string _name; private string _name;
/// <summary> /// <summary>
/// Gets or sets the name of the opengl constant (eg. GL_LINES). /// Gets or sets the name of the opengl constant (eg. GL_LINES).
@ -41,7 +41,7 @@ namespace Bind.Structures
} }
} }
string _value; private string _value;
/// <summary> /// <summary>
/// Gets or sets the value of the opengl constant (eg. 0x00000001). /// Gets or sets the value of the opengl constant (eg. 0x00000001).

View file

@ -17,11 +17,11 @@ namespace Bind.Structures
/// Represents an opengl function. /// Represents an opengl function.
/// The return value, function name, function parameters and opengl version can be retrieved or set. /// The return value, function name, function parameters and opengl version can be retrieved or set.
/// </summary> /// </summary>
class Delegate : IComparable<Delegate>, IEquatable<Delegate> internal class Delegate : IComparable<Delegate>, IEquatable<Delegate>
{ {
//internal static DelegateCollection Delegates; //internal static DelegateCollection Delegates;
bool? cls_compliance_overriden; private bool? cls_compliance_overriden;
protected static Regex endings = new Regex(@"((((d|f|fi)|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft); protected static Regex endings = new Regex(@"((((d|f|fi)|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
protected static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flag|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs)", RegexOptions.Compiled | RegexOptions.RightToLeft); protected static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flag|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs)", RegexOptions.Compiled | RegexOptions.RightToLeft);
@ -140,7 +140,7 @@ namespace Bind.Structures
/// </summary> /// </summary>
public Type ReturnType { get; set; } = new Type(); public Type ReturnType { get; set; } = new Type();
string _name; private string _name;
/// <summary> /// <summary>
/// Gets or sets the name of the opengl function. /// Gets or sets the name of the opengl function.
/// </summary> /// </summary>
@ -213,9 +213,9 @@ namespace Bind.Structures
} }
} }
class DelegateCollection : IDictionary<string, List<Delegate>> internal class DelegateCollection : IDictionary<string, List<Delegate>>
{ {
readonly SortedDictionary<string, List<Delegate>> Delegates = private readonly SortedDictionary<string, List<Delegate>> Delegates =
new SortedDictionary<string, List<Delegate>>(); new SortedDictionary<string, List<Delegate>>();
public void Add(Delegate d) public void Add(Delegate d)

View file

@ -30,13 +30,13 @@ using System.Collections.Generic;
namespace Bind.Structures namespace Bind.Structures
{ {
class Documentation internal class Documentation
{ {
public string Summary { get; set; } public string Summary { get; set; }
public List<DocumentationParameter> Parameters { get; set; } public List<DocumentationParameter> Parameters { get; set; }
} }
class DocumentationParameter internal class DocumentationParameter
{ {
public string Name { get; set; } public string Name { get; set; }
public string Documentation { get; set; } public string Documentation { get; set; }

View file

@ -11,9 +11,9 @@ using System.Xml.XPath;
namespace Bind.Structures namespace Bind.Structures
{ {
class Enum internal class Enum
{ {
string _name, _type; private string _name, _type;
public Enum() public Enum()
{ {
@ -39,7 +39,7 @@ namespace Bind.Structures
set { _type = value; } set { _type = value; }
} }
SortedDictionary<string, Constant> _constant_collection = new SortedDictionary<string, Constant>(); private SortedDictionary<string, Constant> _constant_collection = new SortedDictionary<string, Constant>();
public IDictionary<string, Constant> ConstantCollection public IDictionary<string, Constant> ConstantCollection
{ {
@ -77,12 +77,12 @@ namespace Bind.Structures
public bool CLSCompliant { get; set; } public bool CLSCompliant { get; set; }
} }
class EnumCollection : IDictionary<string, Enum> internal class EnumCollection : IDictionary<string, Enum>
{ {
SortedDictionary<string, Enum> Enumerations = new SortedDictionary<string, Enum>(); private SortedDictionary<string, Enum> Enumerations = new SortedDictionary<string, Enum>();
// Return -1 for ext1, 1 for ext2 or 0 if no preference. // Return -1 for ext1, 1 for ext2 or 0 if no preference.
int OrderOfPreference(string ext1, string ext2) private int OrderOfPreference(string ext1, string ext2)
{ {
// If one is empty and the other not, prefer the empty one (empty == core) // If one is empty and the other not, prefer the empty one (empty == core)
// Otherwise check for Arb and Ext. To reuse the logic for the // Otherwise check for Arb and Ext. To reuse the logic for the
@ -101,7 +101,7 @@ namespace Bind.Structures
} }
// Prefer the empty string over the non-empty. // Prefer the empty string over the non-empty.
int PreferEmpty(string ext1, string ext2) private int PreferEmpty(string ext1, string ext2)
{ {
if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2)) if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2))
return -1; return -1;

View file

@ -10,7 +10,7 @@ using System.Text.RegularExpressions;
namespace Bind.Structures namespace Bind.Structures
{ {
class Function : Delegate, IEquatable<Function>, IComparable<Function> internal class Function : Delegate, IEquatable<Function>, IComparable<Function>
{ {
public Function(Delegate d) public Function(Delegate d)
: base(d) : base(d)
@ -148,11 +148,11 @@ namespace Bind.Structures
} }
} }
class FunctionCollection : SortedDictionary<string, List<Function>> internal class FunctionCollection : SortedDictionary<string, List<Function>>
{ {
Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled); private Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled);
void Add(Function f) private void Add(Function f)
{ {
if (!ContainsKey(f.Extension)) if (!ContainsKey(f.Extension))
{ {

View file

@ -13,9 +13,9 @@ namespace Bind.Structures
/// <summary> /// <summary>
/// Represents a single parameter of an opengl function. /// Represents a single parameter of an opengl function.
/// </summary> /// </summary>
class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter> internal class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter>
{ {
string cache; private string cache;
/// <summary> /// <summary>
/// Creates a new Parameter without type and name. /// Creates a new Parameter without type and name.
@ -78,7 +78,7 @@ namespace Bind.Structures
} }
} }
UnmanagedType _unmanaged_type; private UnmanagedType _unmanaged_type;
/// <summary> /// <summary>
/// Gets or sets the name of the parameter. /// Gets or sets the name of the parameter.
/// </summary> /// </summary>
@ -94,7 +94,7 @@ namespace Bind.Structures
} }
} }
FlowDirection _flow; private FlowDirection _flow;
/// <summary> /// <summary>
/// Gets or sets the flow of the parameter. /// Gets or sets the flow of the parameter.
@ -191,17 +191,17 @@ namespace Bind.Structures
/// <summary> /// <summary>
/// Holds the parameter list of an opengl function. /// Holds the parameter list of an opengl function.
/// </summary> /// </summary>
class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection> internal class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection>
{ {
readonly List<Parameter> Parameters = new List<Parameter>(); private readonly List<Parameter> Parameters = new List<Parameter>();
bool hasPointerParameters; private bool hasPointerParameters;
bool hasReferenceParameters; private bool hasReferenceParameters;
bool hasUnsignedParameters; private bool hasUnsignedParameters;
bool hasGenericParameters; private bool hasGenericParameters;
public bool Rebuild { get; set; } public bool Rebuild { get; set; }
Settings Settings { get; set; } private Settings Settings { get; set; }
public ParameterCollection() public ParameterCollection()
{ {
@ -221,7 +221,7 @@ namespace Bind.Structures
Add(new Parameter(p)); Add(new Parameter(p));
} }
void BuildCache() private void BuildCache()
{ {
BuildReferenceAndPointerParametersCache(); BuildReferenceAndPointerParametersCache();
Rebuild = false; Rebuild = false;
@ -280,7 +280,7 @@ namespace Bind.Structures
} }
void BuildReferenceAndPointerParametersCache() private void BuildReferenceAndPointerParametersCache()
{ {
foreach (Parameter p in this) foreach (Parameter p in this)
{ {

View file

@ -10,9 +10,9 @@ using System.Xml.XPath;
namespace Bind.Structures namespace Bind.Structures
{ {
class Type : IComparable<Type>, IEquatable<Type> internal class Type : IComparable<Type>, IEquatable<Type>
{ {
string current_qualifier = String.Empty; private string current_qualifier = String.Empty;
public Type() public Type()
{ {
@ -34,7 +34,7 @@ namespace Bind.Structures
} }
} }
string CurrentQualifier private string CurrentQualifier
{ {
get { return current_qualifier; } get { return current_qualifier; }
set { PreviousQualifier = CurrentQualifier; current_qualifier = value; } set { PreviousQualifier = CurrentQualifier; current_qualifier = value; }
@ -70,7 +70,7 @@ namespace Bind.Structures
} }
} }
string type; private string type;
/// <summary> /// <summary>
/// Gets the type of the parameter. /// Gets the type of the parameter.
/// </summary> /// </summary>
@ -102,7 +102,7 @@ namespace Bind.Structures
public bool Reference { get; set; } public bool Reference { get; set; }
int array; private int array;
public int Array public int Array
{ {
@ -110,7 +110,7 @@ namespace Bind.Structures
set { array = value > 0 ? value : 0; } set { array = value > 0 ? value : 0; }
} }
int element_count; private int element_count;
// If the type is an array and ElementCount > 0, then ElemenCount defines the expected array length. // If the type is an array and ElementCount > 0, then ElemenCount defines the expected array length.
public int ElementCount public int ElementCount
@ -119,7 +119,7 @@ namespace Bind.Structures
set { element_count = value > 0 ? value : 0; } set { element_count = value > 0 ? value : 0; }
} }
int pointer; private int pointer;
public int Pointer public int Pointer
{ {
@ -194,7 +194,7 @@ namespace Bind.Structures
public WrapperTypes WrapperType { get; set; } = WrapperTypes.None; public WrapperTypes WrapperType { get; set; } = WrapperTypes.None;
static readonly string[] PointerLevels = private static readonly string[] PointerLevels =
{ {
"", "",
"*", "*",
@ -203,7 +203,7 @@ namespace Bind.Structures
"****" "****"
}; };
static readonly string[] ArrayLevels = private static readonly string[] ArrayLevels =
{ {
"", "",
"[]", "[]",

View file

@ -92,7 +92,7 @@ namespace Bind
SizeParameter = 1 << 14, SizeParameter = 1 << 14,
} }
static class Utilities internal static class Utilities
{ {
public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' }; public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
public static Regex Extensions { get; private set; } public static Regex Extensions { get; private set; }
@ -103,7 +103,7 @@ namespace Bind
// Note: REMOVING THESE WILL BREAK BINARY-COMPATIBILITY WITH OPENTK 1.0, // Note: REMOVING THESE WILL BREAK BINARY-COMPATIBILITY WITH OPENTK 1.0,
// WRT THE ES 1.1 API. // WRT THE ES 1.1 API.
// You have been warned. // You have been warned.
static List<string> extension_names = new List<string> private static List<string> extension_names = new List<string>
{ {
"SGI", "SGIS", "SGIX", "IBM", "AMD", "INTEL", "SGI", "SGIS", "SGIX", "IBM", "AMD", "INTEL",
}; };

View file

@ -37,9 +37,9 @@ namespace Bind
using Delegate = Bind.Structures.Delegate; using Delegate = Bind.Structures.Delegate;
using Enum = Bind.Structures.Enum; using Enum = Bind.Structures.Enum;
class XmlSpecReader : ISpecReader internal class XmlSpecReader : ISpecReader
{ {
Settings Settings { get; set; } private Settings Settings { get; set; }
public XmlSpecReader(Settings settings) public XmlSpecReader(Settings settings)
{ {
@ -206,7 +206,7 @@ namespace Bind
} }
} }
static void GetSignaturePaths(string apiname, string apiversion, out string xpath_add, out string xpath_delete) private static void GetSignaturePaths(string apiname, string apiversion, out string xpath_add, out string xpath_delete)
{ {
xpath_add = "/signatures/add"; xpath_add = "/signatures/add";
xpath_delete = "/signatures/delete"; xpath_delete = "/signatures/delete";
@ -229,7 +229,7 @@ namespace Bind
} }
} }
string GetSpecVersion(XPathDocument specs) private string GetSpecVersion(XPathDocument specs)
{ {
var version = var version =
specs.CreateNavigator().SelectSingleNode("/signatures") specs.CreateNavigator().SelectSingleNode("/signatures")
@ -241,7 +241,7 @@ namespace Bind
return version; return version;
} }
DelegateCollection ReadDelegates(XPathNavigator specs, string apiversion) private DelegateCollection ReadDelegates(XPathNavigator specs, string apiversion)
{ {
DelegateCollection delegates = new DelegateCollection(); DelegateCollection delegates = new DelegateCollection();
var extensions = new List<string>(); var extensions = new List<string>();
@ -323,7 +323,7 @@ namespace Bind
return delegates; return delegates;
} }
EnumCollection ReadEnums(XPathNavigator nav) private EnumCollection ReadEnums(XPathNavigator nav)
{ {
EnumCollection enums = new EnumCollection(); EnumCollection enums = new EnumCollection();
Enum all = new Enum() { Name = Settings.CompleteEnumName }; Enum all = new Enum() { Name = Settings.CompleteEnumName };

View file

@ -32,7 +32,7 @@ using System.Xml.Linq;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
static class Extension internal static class Extension
{ {
public static string ValueOrDefault(this XAttribute a) public static string ValueOrDefault(this XAttribute a)
{ {
@ -40,9 +40,9 @@ namespace OpenTK.Convert
} }
} }
class GLXmlParser : XmlParser internal class GLXmlParser : XmlParser
{ {
static readonly Regex ExtensionRegex = new Regex( private static readonly Regex ExtensionRegex = new Regex(
@"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$", @"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$",
RegexOptions.Compiled); RegexOptions.Compiled);
@ -69,7 +69,7 @@ namespace OpenTK.Convert
return elements.Values; return elements.Values;
} }
static string[] GetApiNames(XElement feature) private static string[] GetApiNames(XElement feature)
{ {
string[] apinames = null; string[] apinames = null;
switch (feature.Name.LocalName) switch (feature.Name.LocalName)
@ -107,7 +107,7 @@ namespace OpenTK.Convert
return apinames; return apinames;
} }
IEnumerable<XElement> ParseEnums(XDocument input) private IEnumerable<XElement> ParseEnums(XDocument input)
{ {
var features = input.Root.Elements("feature"); var features = input.Root.Elements("feature");
var extensions = input.Root.Elements("extensions").Elements("extension"); var extensions = input.Root.Elements("extensions").Elements("extension");
@ -224,7 +224,7 @@ namespace OpenTK.Convert
return APIs.Values; return APIs.Values;
} }
IEnumerable<XElement> ParseFunctions(XDocument input) private IEnumerable<XElement> ParseFunctions(XDocument input)
{ {
// Go through the list of commands and build OpenTK functions out of those. // Go through the list of commands and build OpenTK functions out of those.
// Every function has a number of attributes that define which API version and // Every function has a number of attributes that define which API version and
@ -404,12 +404,12 @@ namespace OpenTK.Convert
return function; return function;
} }
string FunctionName(XElement e) private string FunctionName(XElement e)
{ {
return TrimName(e.Element("proto").Element("name").Value); return TrimName(e.Element("proto").Element("name").Value);
} }
string FunctionParameterType(XElement e) private string FunctionParameterType(XElement e)
{ {
// Parse the C-like <proto> element. Possible instances: // Parse the C-like <proto> element. Possible instances:
// Return types: // Return types:
@ -444,7 +444,7 @@ namespace OpenTK.Convert
return ret; return ret;
} }
static string Join(string left, string right) private static string Join(string left, string right)
{ {
if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right)) if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right))
return left + "|" + right; return left + "|" + right;
@ -456,7 +456,7 @@ namespace OpenTK.Convert
return String.Empty; return String.Empty;
} }
static XAttribute Lookup(IDictionary<string, XElement> categories, string cmd_name, string attribute) private static XAttribute Lookup(IDictionary<string, XElement> categories, string cmd_name, string attribute)
{ {
if (categories.ContainsKey(cmd_name)) if (categories.ContainsKey(cmd_name))
{ {

View file

@ -32,7 +32,7 @@ using CommandLine;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
class EnumTokenComparer : IEqualityComparer<XNode> internal class EnumTokenComparer : IEqualityComparer<XNode>
{ {
public bool Equals(XNode a, XNode b) public bool Equals(XNode a, XNode b)
{ {
@ -60,11 +60,11 @@ namespace OpenTK.Convert
} }
} }
class EntryPoint internal class EntryPoint
{ {
static Options CLIOptions; private static Options CLIOptions;
static void Main(string[] args) private static void Main(string[] args)
{ {
Parser.Default.ParseArguments<Options>(args) Parser.Default.ParseArguments<Options>(args)
.WithParsed(result => CLIOptions = result) .WithParsed(result => CLIOptions = result)

View file

@ -29,7 +29,7 @@ using System.Xml.Linq;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
// The base class for a parser. // The base class for a parser.
abstract class XmlParser internal abstract class XmlParser
{ {
// Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc. // Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc.
public string Prefix { get; set; } public string Prefix { get; set; }

View file

@ -27,9 +27,9 @@ namespace OpenTK.Rewrite
{ {
// Replaces OpenTK.InteropHelper method instances // Replaces OpenTK.InteropHelper method instances
// with the s IL instructions. // with the s IL instructions.
class Program internal class Program
{ {
static void Main(string[] args) private static void Main(string[] args)
{ {
if (args.Length == 0) if (args.Length == 0)
{ {
@ -48,19 +48,20 @@ namespace OpenTK.Rewrite
} }
// mscorlib types // mscorlib types
static AssemblyDefinition mscorlib; private static AssemblyDefinition mscorlib;
static TypeDefinition TypeMarshal;
static TypeDefinition TypeStringBuilder; private static TypeDefinition TypeMarshal;
static TypeDefinition TypeVoid; private static TypeDefinition TypeStringBuilder;
static TypeDefinition TypeIntPtr; private static TypeDefinition TypeVoid;
static TypeDefinition TypeInt32; private static TypeDefinition TypeIntPtr;
private static TypeDefinition TypeInt32;
// OpenTK.BindingsBase // OpenTK.BindingsBase
static TypeDefinition TypeBindingsBase; private static TypeDefinition TypeBindingsBase;
static bool dllimport; private static bool dllimport;
void Rewrite(string file, string keyfile, IEnumerable<string> options) private void Rewrite(string file, string keyfile, IEnumerable<string> options)
{ {
IEnumerable<string> optionsEnumerated = options as IList<string> ?? options.ToList(); IEnumerable<string> optionsEnumerated = options as IList<string> ?? options.ToList();
dllimport = optionsEnumerated.Contains("-dllimport"); dllimport = optionsEnumerated.Contains("-dllimport");
@ -152,7 +153,7 @@ namespace OpenTK.Rewrite
} }
} }
void Rewrite(TypeDefinition type, IEnumerable<string> options) private void Rewrite(TypeDefinition type, IEnumerable<string> options)
{ {
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints"); var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
if (entry_points != null) if (entry_points != null)
@ -177,7 +178,7 @@ namespace OpenTK.Rewrite
} }
} }
static int GetSlot(MethodDefinition signature) private static int GetSlot(MethodDefinition signature)
{ {
// Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS) // Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS)
if (dllimport) if (dllimport)
@ -193,7 +194,7 @@ namespace OpenTK.Rewrite
return slot; return slot;
} }
void Rewrite(TypeDefinition type, FieldDefinition entry_points, private void Rewrite(TypeDefinition type, FieldDefinition entry_points,
List<MethodDefinition> entry_signatures, IEnumerable<string> options) List<MethodDefinition> entry_signatures, IEnumerable<string> options)
{ {
// Rewrite all wrapper methods // Rewrite all wrapper methods
@ -228,7 +229,7 @@ namespace OpenTK.Rewrite
} }
} }
static void RemoveNativeSignatures(TypeDefinition type, IEnumerable<MethodDefinition> methods) private static void RemoveNativeSignatures(TypeDefinition type, IEnumerable<MethodDefinition> methods)
{ {
// Remove all DllImports for functions called through calli, since // Remove all DllImports for functions called through calli, since
// their signatures are embedded directly into the calli callsite. // their signatures are embedded directly into the calli callsite.
@ -239,7 +240,7 @@ namespace OpenTK.Rewrite
} }
} }
static void RemoveSupportingAttributes(TypeDefinition type) private static void RemoveSupportingAttributes(TypeDefinition type)
{ {
foreach (var method in type.Methods) foreach (var method in type.Methods)
{ {
@ -256,7 +257,7 @@ namespace OpenTK.Rewrite
} }
// Create body for method // Create body for method
static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot, private static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
FieldDefinition entry_points, IEnumerable<string> options) FieldDefinition entry_points, IEnumerable<string> options)
{ {
var body = wrapper.Body; var body = wrapper.Body;
@ -324,7 +325,7 @@ namespace OpenTK.Rewrite
body.OptimizeMacros(); body.OptimizeMacros();
} }
class DebugVariables private class DebugVariables
{ {
public TypeDefinition ErrorHelperType; public TypeDefinition ErrorHelperType;
public VariableDefinition ErrorHelperLocal; public VariableDefinition ErrorHelperLocal;
@ -333,7 +334,7 @@ namespace OpenTK.Rewrite
public Instruction BeginTry; public Instruction BeginTry;
} }
static DebugVariables EmitDebugPrologue(MethodDefinition wrapper, ILProcessor il) private static DebugVariables EmitDebugPrologue(MethodDefinition wrapper, ILProcessor il)
{ {
DebugVariables vars = null; DebugVariables vars = null;
@ -417,7 +418,7 @@ namespace OpenTK.Rewrite
return vars; return vars;
} }
static void EmitDebugEpilogue(MethodDefinition wrapper, ILProcessor il, DebugVariables vars) private static void EmitDebugEpilogue(MethodDefinition wrapper, ILProcessor il, DebugVariables vars)
{ {
if (vars != null) if (vars != null)
{ {
@ -525,7 +526,7 @@ namespace OpenTK.Rewrite
} }
} }
static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il, private static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il,
List<GeneratedVariableIdentifier> generatedVariables) List<GeneratedVariableIdentifier> generatedVariables)
{ {
foreach (var p in wrapper.Parameters) foreach (var p in wrapper.Parameters)
@ -554,13 +555,13 @@ namespace OpenTK.Rewrite
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="body"></param> /// <param name="body"></param>
/// <returns></returns> /// <returns></returns>
static GeneratedVariableIdentifier GetGeneratedVariable(IEnumerable<GeneratedVariableIdentifier> variableIdentifiers, string name, MethodBody body) private static GeneratedVariableIdentifier GetGeneratedVariable(IEnumerable<GeneratedVariableIdentifier> variableIdentifiers, string name, MethodBody body)
{ {
return variableIdentifiers.FirstOrDefault(v => v.Name == name && v.Body == body && return variableIdentifiers.FirstOrDefault(v => v.Name == name && v.Body == body &&
body.Variables.Contains(v.Definition)); body.Variables.Contains(v.Definition));
} }
static GeneratedVariableIdentifier EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il) private static GeneratedVariableIdentifier EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il)
{ {
var p = parameter.ParameterType; var p = parameter.ParameterType;
@ -597,7 +598,7 @@ namespace OpenTK.Rewrite
return stringBuilderPtrVar; return stringBuilderPtrVar;
} }
static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, private static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native,
ParameterDefinition parameter, MethodBody body, ILProcessor il, GeneratedVariableIdentifier generatedPtrVar) ParameterDefinition parameter, MethodBody body, ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{ {
if (generatedPtrVar == null) if (generatedPtrVar == null)
@ -639,7 +640,7 @@ namespace OpenTK.Rewrite
} }
} }
static GeneratedVariableIdentifier EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, private static GeneratedVariableIdentifier EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il) ILProcessor il)
{ {
var p = parameter.ParameterType; var p = parameter.ParameterType;
@ -666,7 +667,7 @@ namespace OpenTK.Rewrite
return stringPtrVar; return stringPtrVar;
} }
static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, private static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il, GeneratedVariableIdentifier generatedPtrVar) ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{ {
var p = parameter.ParameterType; var p = parameter.ParameterType;
@ -677,7 +678,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Call, free); il.Emit(OpCodes.Call, free);
} }
static GeneratedVariableIdentifier EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, private static GeneratedVariableIdentifier EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il) ILProcessor il)
{ {
var p = parameter.ParameterType; var p = parameter.ParameterType;
@ -705,7 +706,7 @@ namespace OpenTK.Rewrite
return stringArrayPtrVar; return stringArrayPtrVar;
} }
static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, private static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il, GeneratedVariableIdentifier generatedPtrVar) ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{ {
if (generatedPtrVar == null) if (generatedPtrVar == null)
@ -732,7 +733,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Call, free); il.Emit(OpCodes.Call, free);
} }
static List<GeneratedVariableIdentifier> EmitConvenienceWrapper(MethodDefinition wrapper, private static List<GeneratedVariableIdentifier> EmitConvenienceWrapper(MethodDefinition wrapper,
MethodDefinition native, int difference, MethodBody body, ILProcessor il) MethodDefinition native, int difference, MethodBody body, ILProcessor il)
{ {
if (wrapper.Parameters.Count > 2) if (wrapper.Parameters.Count > 2)
@ -800,7 +801,7 @@ namespace OpenTK.Rewrite
return generatedVariables; return generatedVariables;
} }
static List<GeneratedVariableIdentifier> EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il) private static List<GeneratedVariableIdentifier> EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il)
{ {
List<GeneratedVariableIdentifier> generatedVariables = new List<GeneratedVariableIdentifier>(); List<GeneratedVariableIdentifier> generatedVariables = new List<GeneratedVariableIdentifier>();
for (int i = 0; i < method.Parameters.Count; i++) for (int i = 0; i < method.Parameters.Count; i++)
@ -931,14 +932,14 @@ namespace OpenTK.Rewrite
return generatedVariables; return generatedVariables;
} }
static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot) private static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot)
{ {
il.Emit(OpCodes.Ldsfld, entry_points); il.Emit(OpCodes.Ldsfld, entry_points);
il.Emit(OpCodes.Ldc_I4, slot); il.Emit(OpCodes.Ldc_I4, slot);
il.Emit(OpCodes.Ldelem_I); il.Emit(OpCodes.Ldelem_I);
} }
static void EmitCalli(ILProcessor il, MethodReference reference) private static void EmitCalli(ILProcessor il, MethodReference reference)
{ {
var signature = new CallSite(reference.ReturnType) var signature = new CallSite(reference.ReturnType)
{ {
@ -955,7 +956,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Calli, signature); il.Emit(OpCodes.Calli, signature);
} }
static void EmitCall(ILProcessor il, MethodReference reference) private static void EmitCall(ILProcessor il, MethodReference reference)
{ {
il.Emit(OpCodes.Call, reference); il.Emit(OpCodes.Call, reference);
} }

View file

@ -54,15 +54,14 @@ namespace OpenTK.Platform.MacOS
using GLenum = UInt32; using GLenum = UInt32;
unsafe static partial class Agl internal unsafe static partial class Agl
{ {
private const string agl = "/System/Library/Frameworks/AGL.framework/Versions/Current/AGL";
const string agl = "/System/Library/Frameworks/AGL.framework/Versions/Current/AGL";
/* /*
** AGL API version. ** AGL API version.
*/ */
const int AGL_VERSION_2_0 = 1; private const int AGL_VERSION_2_0 = 1;
/************************************************************************/ /************************************************************************/
@ -321,29 +320,36 @@ namespace OpenTK.Platform.MacOS
/* /*
** Renderer information functions ** Renderer information functions
*/ */
[DllImport(agl)] static extern AGLRendererInfo aglQueryRendererInfo(AGLDevice[] gdevs, int ndev); [DllImport(agl)]
[DllImport(agl)] static extern void aglDestroyRendererInfo(AGLRendererInfo rend); private static extern AGLRendererInfo aglQueryRendererInfo(AGLDevice[] gdevs, int ndev);
[DllImport(agl)] static extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend); [DllImport(agl)]
[DllImport(agl)] static extern byte aglDescribeRenderer(AGLRendererInfo rend, int prop, out int value); private static extern void aglDestroyRendererInfo(AGLRendererInfo rend);
[DllImport(agl)]
private static extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend);
[DllImport(agl)]
private static extern byte aglDescribeRenderer(AGLRendererInfo rend, int prop, out int value);
/* /*
** Context functions ** Context functions
*/ */
[DllImport(agl)] internal static extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share); [DllImport(agl)] internal static extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share);
[DllImport(agl,EntryPoint="aglDestroyContext")] static extern byte _aglDestroyContext(AGLContext ctx); [DllImport(agl,EntryPoint="aglDestroyContext")]
private static extern byte _aglDestroyContext(AGLContext ctx);
internal static bool aglDestroyContext(AGLContext context) internal static bool aglDestroyContext(AGLContext context)
{ {
return (_aglDestroyContext(context) != 0) ? true : false; return (_aglDestroyContext(context) != 0) ? true : false;
} }
[DllImport(agl)] static extern byte aglCopyContext(AGLContext src, AGLContext dst, uint mask); [DllImport(agl)]
private static extern byte aglCopyContext(AGLContext src, AGLContext dst, uint mask);
[DllImport(agl)] internal static extern byte aglUpdateContext(AGLContext ctx); [DllImport(agl)] internal static extern byte aglUpdateContext(AGLContext ctx);
/* /*
** Current state functions ** Current state functions
*/ */
[DllImport(agl,EntryPoint="aglSetCurrentContext")] static extern byte _aglSetCurrentContext(AGLContext ctx); [DllImport(agl,EntryPoint="aglSetCurrentContext")]
private static extern byte _aglSetCurrentContext(AGLContext ctx);
internal static bool aglSetCurrentContext(IntPtr context) internal static bool aglSetCurrentContext(IntPtr context)
{ {
byte retval = _aglSetCurrentContext(context); byte retval = _aglSetCurrentContext(context);
@ -361,7 +367,7 @@ namespace OpenTK.Platform.MacOS
** Drawable Functions ** Drawable Functions
*/ */
[DllImport(agl,EntryPoint="aglSetDrawable")] [DllImport(agl,EntryPoint="aglSetDrawable")]
static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw); private static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw);
internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw) internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw)
{ {
@ -373,11 +379,13 @@ namespace OpenTK.Platform.MacOS
throw new Exception(ErrorString(err)); throw new Exception(ErrorString(err));
} }
} }
[DllImport(agl)] static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr); [DllImport(agl)]
[DllImport(agl)] static extern AGLDrawable aglGetDrawable(AGLContext ctx); private static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr);
[DllImport(agl)]
private static extern AGLDrawable aglGetDrawable(AGLContext ctx);
[DllImport(agl, EntryPoint = "aglSetFullScreen")] [DllImport(agl, EntryPoint = "aglSetFullScreen")]
static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device); private static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device);
internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device) internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device)
{ {
byte retval = _aglSetFullScreen(ctx, width, height, freq, device); byte retval = _aglSetFullScreen(ctx, width, height, freq, device);
@ -396,18 +404,22 @@ namespace OpenTK.Platform.MacOS
/* /*
** Virtual screen functions ** Virtual screen functions
*/ */
[DllImport(agl)] static extern byte aglSetVirtualScreen(AGLContext ctx, int screen); [DllImport(agl)]
[DllImport(agl)] static extern int aglGetVirtualScreen(AGLContext ctx); private static extern byte aglSetVirtualScreen(AGLContext ctx, int screen);
[DllImport(agl)]
private static extern int aglGetVirtualScreen(AGLContext ctx);
/* /*
** Obtain version numbers ** Obtain version numbers
*/ */
[DllImport(agl)] static extern void aglGetVersion(int *major, int *minor); [DllImport(agl)]
private static extern void aglGetVersion(int *major, int *minor);
/* /*
** Global library options ** Global library options
*/ */
[DllImport(agl)] static extern byte aglConfigure(GLenum pname, uint param); [DllImport(agl)]
private static extern byte aglConfigure(GLenum pname, uint param);
/* /*
** Swap functions ** Swap functions
@ -422,7 +434,7 @@ namespace OpenTK.Platform.MacOS
[DllImport(agl)] [DllImport(agl)]
internal static extern bool aglDisable(AGLContext ctx, ParameterNames pname); internal static extern bool aglDisable(AGLContext ctx, ParameterNames pname);
[DllImport(agl)] [DllImport(agl)]
static extern bool aglIsEnabled(AGLContext ctx, GLenum pname); private static extern bool aglIsEnabled(AGLContext ctx, GLenum pname);
[DllImport(agl)] [DllImport(agl)]
internal static extern bool aglSetInteger(AGLContext ctx, ParameterNames pname, ref int param); internal static extern bool aglSetInteger(AGLContext ctx, ParameterNames pname, ref int param);
[DllImport(agl)] [DllImport(agl)]
@ -436,13 +448,15 @@ namespace OpenTK.Platform.MacOS
** Font function ** Font function
*/ */
// TODO: face parameter should be of type StyleParameter in QuickDraw. // TODO: face parameter should be of type StyleParameter in QuickDraw.
[DllImport(agl)] static extern byte aglUseFont(AGLContext ctx, int fontID, int face, int size, int first, int count, int @base); [DllImport(agl)]
private static extern byte aglUseFont(AGLContext ctx, int fontID, int face, int size, int first, int count, int @base);
/* /*
** Error functions ** Error functions
*/ */
[DllImport(agl,EntryPoint="aglGetError")] internal static extern AglError GetError(); [DllImport(agl,EntryPoint="aglGetError")] internal static extern AglError GetError();
[DllImport(agl,EntryPoint="aglErrorString")] static extern IntPtr _aglErrorString(AglError code); [DllImport(agl,EntryPoint="aglErrorString")]
private static extern IntPtr _aglErrorString(AglError code);
internal static string ErrorString(AglError code) internal static string ErrorString(AglError code)
{ {
return Marshal.PtrToStringAnsi(_aglErrorString(code)); return Marshal.PtrToStringAnsi(_aglErrorString(code));
@ -451,32 +465,42 @@ namespace OpenTK.Platform.MacOS
/* /*
** Soft reset function ** Soft reset function
*/ */
[DllImport(agl)] static extern void aglResetLibrary(); [DllImport(agl)]
private static extern void aglResetLibrary();
/* /*
** Surface texture function ** Surface texture function
*/ */
[DllImport(agl)] static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ; [DllImport(agl)]
private static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ;
/* /*
** PBuffer functions ** PBuffer functions
*/ */
[DllImport(agl)] static extern byte aglCreatePBuffer (int width, int height, GLenum target, GLenum internalFormat, long max_level, AGLPbuffer *pbuffer); [DllImport(agl)]
[DllImport(agl)] static extern byte aglDestroyPBuffer (AGLPbuffer pbuffer); private static extern byte aglCreatePBuffer (int width, int height, GLenum target, GLenum internalFormat, long max_level, AGLPbuffer *pbuffer);
[DllImport(agl)] static extern byte aglDescribePBuffer (AGLPbuffer pbuffer, int *width, int *height, GLenum *target, GLenum *internalFormat, int *max_level); [DllImport(agl)]
[DllImport(agl)] static extern byte aglTexImagePBuffer (AGLContext ctx, AGLPbuffer pbuffer, int source); private static extern byte aglDestroyPBuffer (AGLPbuffer pbuffer);
[DllImport(agl)]
private static extern byte aglDescribePBuffer (AGLPbuffer pbuffer, int *width, int *height, GLenum *target, GLenum *internalFormat, int *max_level);
[DllImport(agl)]
private static extern byte aglTexImagePBuffer (AGLContext ctx, AGLPbuffer pbuffer, int source);
/* /*
** Pbuffer Drawable Functions ** Pbuffer Drawable Functions
*/ */
[DllImport(agl)] static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ; [DllImport(agl)]
[DllImport(agl)] static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ; private static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ;
[DllImport(agl)]
private static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ;
/* /*
** CGL functions ** CGL functions
*/ */
[DllImport(agl)] static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ; [DllImport(agl)]
[DllImport(agl)] static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix); private static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ;
[DllImport(agl)]
private static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix);
#pragma warning restore 0169 #pragma warning restore 0169
} }

View file

@ -43,13 +43,13 @@ namespace OpenTK.Platform.MacOS
/// <summary> /// <summary>
/// AGL context implementation for WinForms compatibility. /// AGL context implementation for WinForms compatibility.
/// </summary> /// </summary>
class AglContext : IGraphicsContext, IGraphicsContextInternal internal class AglContext : IGraphicsContext, IGraphicsContextInternal
{ {
IWindowInfo carbonWindow; private IWindowInfo carbonWindow;
IGraphicsContext dummyContext; // for extension loading private IGraphicsContext dummyContext; // for extension loading
readonly GetInt XOffset; private readonly GetInt XOffset;
readonly GetInt YOffset; private readonly GetInt YOffset;
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext,
GetInt xoffset, GetInt yoffset) GetInt xoffset, GetInt yoffset)
@ -96,7 +96,7 @@ namespace OpenTK.Platform.MacOS
aglAttributes.Add(value); aglAttributes.Add(value);
} }
void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen) private void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen)
{ {
Debug.Print("AGL pixel format attributes:"); Debug.Print("AGL pixel format attributes:");
@ -134,7 +134,7 @@ namespace OpenTK.Platform.MacOS
}); });
} }
void SetBufferRect(IWindowInfo carbonWindow) private void SetBufferRect(IWindowInfo carbonWindow)
{ {
Rect rect = API.GetControlBounds(carbonWindow.Handle); Rect rect = API.GetControlBounds(carbonWindow.Handle);
@ -160,7 +160,7 @@ namespace OpenTK.Platform.MacOS
MyAGLReportError("aglEnable"); MyAGLReportError("aglEnable");
} }
void SetDrawable(IWindowInfo carbonWindow) private void SetDrawable(IWindowInfo carbonWindow)
{ {
IntPtr windowPort = GetWindowPortForWindowInfo(carbonWindow); IntPtr windowPort = GetWindowPortForWindowInfo(carbonWindow);
//Debug.Print("Setting drawable for context {0} to window port: {1}", Handle.Handle, windowPort); //Debug.Print("Setting drawable for context {0} to window port: {1}", Handle.Handle, windowPort);
@ -185,7 +185,7 @@ namespace OpenTK.Platform.MacOS
Agl.aglUpdateContext(Context.Handle); Agl.aglUpdateContext(Context.Handle);
} }
void MyAGLReportError(string function) private void MyAGLReportError(string function)
{ {
Agl.AglError err = Agl.GetError(); Agl.AglError err = Agl.GetError();
@ -195,7 +195,7 @@ namespace OpenTK.Platform.MacOS
function, err, Agl.ErrorString(err))); function, err, Agl.ErrorString(err)));
} }
bool firstSwap = true; private bool firstSwap = true;
public void SwapBuffers() public void SwapBuffers()
{ {
// this is part of the hack to avoid dropping the first frame when // this is part of the hack to avoid dropping the first frame when
@ -286,7 +286,7 @@ namespace OpenTK.Platform.MacOS
Dispose(true); Dispose(true);
} }
void Dispose(bool disposing) private void Dispose(bool disposing)
{ {
if (IsDisposed || Context.Handle == IntPtr.Zero) if (IsDisposed || Context.Handle == IntPtr.Zero)
return; return;

View file

@ -31,7 +31,7 @@ using OpenTK.Graphics;
namespace OpenTK.Platform.MacOS namespace OpenTK.Platform.MacOS
{ {
class AglGraphicsMode internal class AglGraphicsMode
{ {
public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil, public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil,
int samples, ColorFormat accum, int buffers, bool stereo, out IntPtr pixelformat) int samples, ColorFormat accum, int buffers, bool stereo, out IntPtr pixelformat)
@ -56,7 +56,7 @@ namespace OpenTK.Platform.MacOS
return GetGraphicsModeFromPixelFormat(pixelformat); return GetGraphicsModeFromPixelFormat(pixelformat);
} }
static bool RelaxGraphicsMode(ref ColorFormat color, ref int depth, ref int stencil, ref int samples, ref ColorFormat accum, ref int buffers, ref bool stereo) private static bool RelaxGraphicsMode(ref ColorFormat color, ref int depth, ref int stencil, ref int samples, ref ColorFormat accum, ref int buffers, ref bool stereo)
{ {
// Parameters are relaxed in order of importance. // Parameters are relaxed in order of importance.
// - Accumulator buffers are way outdated as a concept, // - Accumulator buffers are way outdated as a concept,
@ -124,7 +124,7 @@ namespace OpenTK.Platform.MacOS
return false; return false;
} }
GraphicsMode GetGraphicsModeFromPixelFormat(IntPtr pixelformat) private GraphicsMode GetGraphicsModeFromPixelFormat(IntPtr pixelformat)
{ {
int r, g, b, a; int r, g, b, a;
Agl.aglDescribePixelFormat(pixelformat, Agl.PixelFormatAttribute.AGL_RED_SIZE, out r); Agl.aglDescribePixelFormat(pixelformat, Agl.PixelFormatAttribute.AGL_RED_SIZE, out r);
@ -147,7 +147,7 @@ namespace OpenTK.Platform.MacOS
depth, stencil, samples, new ColorFormat(ar, ag, ab, aa), buffers + 1, stereo != 0); depth, stencil, samples, new ColorFormat(ar, ag, ab, aa), buffers + 1, stereo != 0);
} }
IntPtr SelectPixelFormat(ColorFormat color, int depth, int stencil, int samples, private IntPtr SelectPixelFormat(ColorFormat color, int depth, int stencil, int samples,
ColorFormat accum, int buffers, bool stereo) ColorFormat accum, int buffers, bool stereo)
{ {
List<int> attribs = new List<int>(); List<int> attribs = new List<int>();

View file

@ -68,10 +68,10 @@ namespace OpenTK.Platform.MacOS.Carbon
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct Rect internal struct Rect
{ {
short top; private short top;
short left; private short left;
short bottom; private short bottom;
short right; private short right;
internal Rect(int left, int top, int width, int height) internal Rect(int left, int top, int width, int height)
: this((short)left, (short)top, (short)width, (short)height) : this((short)left, (short)top, (short)width, (short)height)
@ -132,16 +132,16 @@ namespace OpenTK.Platform.MacOS.Carbon
} }
} }
class API internal class API
{ {
const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon"; private const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon";
[DllImport(carbon)] [DllImport(carbon)]
internal unsafe static extern OSStatus DMGetGDeviceByDisplayID( internal unsafe static extern OSStatus DMGetGDeviceByDisplayID(
IntPtr displayID, out IntPtr displayDevice, Boolean failToMain); IntPtr displayID, out IntPtr displayDevice, Boolean failToMain);
[DllImport(carbon)] [DllImport(carbon)]
static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds); private static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
internal static Rect GetControlBounds(IntPtr control) internal static Rect GetControlBounds(IntPtr control)
{ {

View file

@ -34,10 +34,10 @@ using OpenTK.Platform.MacOS;
namespace OpenTK namespace OpenTK
{ {
class CarbonGLControl : IGLControl internal class CarbonGLControl : IGLControl
{ {
GraphicsMode mode; private GraphicsMode mode;
Control control; private Control control;
internal CarbonGLControl(GraphicsMode mode, Control owner) internal CarbonGLControl(GraphicsMode mode, Control owner)
{ {
@ -71,7 +71,7 @@ namespace OpenTK
} }
// TODO: Fix this // TODO: Fix this
bool lastIsIdle = false; private bool lastIsIdle = false;
public bool IsIdle public bool IsIdle
{ {
get get

View file

@ -29,7 +29,7 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class DummyGLControl : IGLControl internal class DummyGLControl : IGLControl
{ {
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags) public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{ {
@ -46,11 +46,11 @@ namespace OpenTK
get { return Utilities.CreateDummyWindowInfo(); } get { return Utilities.CreateDummyWindowInfo(); }
} }
class DummyContext : IGraphicsContext, IGraphicsContextInternal private class DummyContext : IGraphicsContext, IGraphicsContextInternal
{ {
static int instance_count; private static int instance_count;
IWindowInfo current_window; private IWindowInfo current_window;
public void SwapBuffers() public void SwapBuffers()
{ {

View file

@ -46,21 +46,22 @@ namespace OpenTK
/// </summary> /// </summary>
public partial class GLControl : UserControl public partial class GLControl : UserControl
{ {
IGraphicsContext context; private IGraphicsContext context;
IGLControl implementation; private IGLControl implementation;
GraphicsMode format; private GraphicsMode format;
int major, minor; private int major, minor;
GraphicsContextFlags flags; private GraphicsContextFlags flags;
bool? initial_vsync_value;
private bool? initial_vsync_value;
// Indicates that OnResize was called before OnHandleCreated. // Indicates that OnResize was called before OnHandleCreated.
// To avoid issues with missing OpenGL contexts, we suppress // To avoid issues with missing OpenGL contexts, we suppress
// the premature Resize event and raise it as soon as the handle // the premature Resize event and raise it as soon as the handle
// is ready. // is ready.
bool resize_event_suppressed; private bool resize_event_suppressed;
// Indicates whether the control is in design mode. Due to issues // Indicates whether the control is in design mode. Due to issues
// wiith the DesignMode property and nested controls,we need to // wiith the DesignMode property and nested controls,we need to
// evaluate this in the constructor. // evaluate this in the constructor.
readonly bool design_mode; private readonly bool design_mode;
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.
@ -121,7 +122,7 @@ namespace OpenTK
InitializeComponent(); InitializeComponent();
} }
IGLControl Implementation private IGLControl Implementation
{ {
get get
{ {
@ -132,7 +133,7 @@ namespace OpenTK
} }
[Conditional("DEBUG")] [Conditional("DEBUG")]
void ValidateContext(string message) private void ValidateContext(string message)
{ {
if (!Context.IsCurrent) if (!Context.IsCurrent)
{ {
@ -140,7 +141,7 @@ namespace OpenTK
} }
} }
void ValidateState() private void ValidateState()
{ {
if (IsDisposed) if (IsDisposed)
throw new ObjectDisposedException(GetType().Name); throw new ObjectDisposedException(GetType().Name);

View file

@ -32,7 +32,7 @@ using OpenTK.Graphics;
namespace OpenTK namespace OpenTK
{ {
// Constructs GLControls. // Constructs GLControls.
class GLControlFactory internal class GLControlFactory
{ {
public IGLControl CreateGLControl(GraphicsMode mode, Control control) public IGLControl CreateGLControl(GraphicsMode mode, Control control)
{ {

View file

@ -32,18 +32,18 @@ namespace OpenTK.Platform.MacOS
{ {
internal class NS internal class NS
{ {
const string Library = "libdl.dylib"; private const string Library = "libdl.dylib";
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")] [DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
static extern bool NSIsSymbolNameDefined(string s); private static extern bool NSIsSymbolNameDefined(string s);
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")] [DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
static extern bool NSIsSymbolNameDefined(IntPtr s); private static extern bool NSIsSymbolNameDefined(IntPtr s);
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")] [DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
static extern IntPtr NSLookupAndBindSymbol(string s); private static extern IntPtr NSLookupAndBindSymbol(string s);
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")] [DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
static extern IntPtr NSLookupAndBindSymbol(IntPtr s); private static extern IntPtr NSLookupAndBindSymbol(IntPtr s);
[DllImport(Library, EntryPoint = "NSAddressOfSymbol")] [DllImport(Library, EntryPoint = "NSAddressOfSymbol")]
static extern IntPtr NSAddressOfSymbol(IntPtr symbol); private static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
[DllImport(Library)] [DllImport(Library)]
private static extern IntPtr dlopen(String fileName, int flags); private static extern IntPtr dlopen(String fileName, int flags);
[DllImport(Library)] [DllImport(Library)]

View file

@ -33,9 +33,9 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class Sdl2GLControl : IGLControl internal class Sdl2GLControl : IGLControl
{ {
GraphicsMode mode; private GraphicsMode mode;
public Sdl2GLControl(GraphicsMode mode, Control control) public Sdl2GLControl(GraphicsMode mode, Control control)
{ {
@ -59,7 +59,7 @@ namespace OpenTK
public Platform.IWindowInfo WindowInfo { get; } public Platform.IWindowInfo WindowInfo { get; }
static class NativeMethods private static class NativeMethods
{ {
[DllImport("SDL2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("SDL2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SDL_HasEvents(int minType, int maxType); public static extern bool SDL_HasEvents(int minType, int maxType);

View file

@ -33,9 +33,9 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class WinGLControl : IGLControl internal class WinGLControl : IGLControl
{ {
struct MSG private struct MSG
{ {
public IntPtr HWnd; public IntPtr HWnd;
public uint Message; public uint Message;
@ -51,7 +51,7 @@ namespace OpenTK
} }
} }
struct POINT private struct POINT
{ {
public int X; public int X;
public int Y; public int Y;
@ -75,10 +75,10 @@ namespace OpenTK
[System.Security.SuppressUnmanagedCodeSecurity] [System.Security.SuppressUnmanagedCodeSecurity]
[System.Runtime.InteropServices.DllImport("User32.dll")] [System.Runtime.InteropServices.DllImport("User32.dll")]
static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags); private static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
MSG msg = new MSG(); private MSG msg = new MSG();
GraphicsMode mode; private GraphicsMode mode;
public WinGLControl(GraphicsMode mode, Control control) public WinGLControl(GraphicsMode mode, Control control)
{ {

View file

@ -15,24 +15,24 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class X11GLControl : IGLControl internal class X11GLControl : IGLControl
{ {
[DllImport("libX11")] [DllImport("libX11")]
static extern IntPtr XCreateColormap(IntPtr display, IntPtr window, IntPtr visual, int alloc); private static extern IntPtr XCreateColormap(IntPtr display, IntPtr window, IntPtr visual, int alloc);
[DllImport("libX11", EntryPoint = "XGetVisualInfo")] [DllImport("libX11", EntryPoint = "XGetVisualInfo")]
static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems); private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo template, out int nitems) private static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo template, out int nitems)
{ {
return XGetVisualInfoInternal(display, (IntPtr)vinfo_mask, ref template, out nitems); return XGetVisualInfoInternal(display, (IntPtr)vinfo_mask, ref template, out nitems);
} }
[DllImport("libX11")] [DllImport("libX11")]
extern static int XPending(IntPtr diplay); private extern static int XPending(IntPtr diplay);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XVisualInfo private struct XVisualInfo
{ {
public IntPtr Visual; public IntPtr Visual;
public IntPtr VisualID; public IntPtr VisualID;
@ -52,12 +52,12 @@ namespace OpenTK
} }
} }
GraphicsMode mode; private GraphicsMode mode;
IntPtr display; private IntPtr display;
IntPtr rootWindow; private IntPtr rootWindow;
// Use reflection to retrieve the necessary values from Mono's Windows.Forms implementation. // Use reflection to retrieve the necessary values from Mono's Windows.Forms implementation.
Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms"); private Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
internal X11GLControl(GraphicsMode mode, Control control) internal X11GLControl(GraphicsMode mode, Control control)
{ {
@ -122,13 +122,13 @@ namespace OpenTK
public IWindowInfo WindowInfo { get; } public IWindowInfo WindowInfo { get; }
static object GetStaticFieldValue(Type type, string fieldName) private static object GetStaticFieldValue(Type type, string fieldName)
{ {
return type.GetField(fieldName, return type.GetField(fieldName,
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null); System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
} }
static void SetStaticFieldValue(Type type, string fieldName, object value) private static void SetStaticFieldValue(Type type, string fieldName, object value)
{ {
type.GetField(fieldName, type.GetField(fieldName,
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value); System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value);

View file

@ -12,7 +12,7 @@ namespace OpenTK.OSX
public static class OSXWindowInfoInitializer public static class OSXWindowInfoInitializer
{ {
#if GTK3 #if GTK3
const string OSXLibGdkName = "libgdk-3.dylib"; private const string OSXLibGdkName = "libgdk-3.dylib";
#else #else
const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib"; const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib";
#endif #endif

View file

@ -33,7 +33,7 @@ namespace OpenTK.Win
#if GTK3 #if GTK3
[SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_win32_window_get_handle(IntPtr w); private static extern IntPtr gdk_win32_window_get_handle(IntPtr w);
#else #else
[SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d); static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);

View file

@ -15,7 +15,7 @@ namespace OpenTK.X11
{ {
#if GTK3 #if GTK3
const string UnixLibGdkName = "libgdk-3.so.0"; private const string UnixLibGdkName = "libgdk-3.so.0";
#else #else
const string UnixLibGdkName = "libgdk-x11-2.0.so.0"; const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
#endif #endif

View file

@ -40,7 +40,7 @@ namespace OpenTK.Audio
public sealed class AudioCapture : IDisposable public sealed class AudioCapture : IDisposable
{ {
// This must stay private info so the end-user cannot call any Alc commands for the recording device. // This must stay private info so the end-user cannot call any Alc commands for the recording device.
IntPtr Handle; private IntPtr Handle;
// Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls. // Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls.
@ -238,7 +238,7 @@ namespace OpenTK.Audio
// Retrieves the sample size in bytes for various ALFormats. // Retrieves the sample size in bytes for various ALFormats.
// Compressed formats always return 1. // Compressed formats always return 1.
static int GetSampleSize(ALFormat format) private static int GetSampleSize(ALFormat format)
{ {
switch (format) switch (format)
{ {
@ -272,7 +272,7 @@ namespace OpenTK.Audio
} }
// Converts an error code to an error string with additional information. // Converts an error code to an error string with additional information.
string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize) private string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize)
{ {
string alcerrmsg; string alcerrmsg;
AlcError alcerrcode = CurrentError; AlcError alcerrcode = CurrentError;

View file

@ -39,14 +39,14 @@ namespace OpenTK.Audio
/// </summary> /// </summary>
public sealed class AudioContext : IDisposable public sealed class AudioContext : IDisposable
{ {
bool disposed; private bool disposed;
bool is_processing, is_synchronized; private bool is_processing, is_synchronized;
ContextHandle context_handle; private ContextHandle context_handle;
bool context_exists; private bool context_exists;
string device_name; private string device_name;
static object audio_context_lock = new object(); private static object audio_context_lock = new object();
static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>(); private static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>();
/// \internal /// \internal
/// <summary> /// <summary>
@ -202,7 +202,7 @@ namespace OpenTK.Audio
/// Values higher than supported will be clamped by the driver. /// Values higher than supported will be clamped by the driver.
/// </para> /// </para>
/// </remarks> /// </remarks>
void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends) private void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends)
{ {
if (!AudioDeviceEnumerator.IsOpenALSupported) if (!AudioDeviceEnumerator.IsOpenALSupported)
throw new DllNotFoundException("openal32.dll"); throw new DllNotFoundException("openal32.dll");
@ -315,7 +315,7 @@ namespace OpenTK.Audio
/// <exception cref="AudioContextException"> /// <exception cref="AudioContextException">
/// Occurs when the AudioContext could not be made current. /// Occurs when the AudioContext could not be made current.
/// </exception> /// </exception>
static void MakeCurrent(AudioContext context) private static void MakeCurrent(AudioContext context)
{ {
lock (audio_context_lock) lock (audio_context_lock)
{ {
@ -580,7 +580,7 @@ namespace OpenTK.Audio
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
void Dispose(bool manual) private void Dispose(bool manual)
{ {
if (!disposed) if (!disposed)
{ {

View file

@ -31,10 +31,10 @@ using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
struct AudioDeviceErrorChecker : IDisposable internal struct AudioDeviceErrorChecker : IDisposable
{ {
readonly IntPtr Device; private readonly IntPtr Device;
static readonly string ErrorString = "Device {0} reported {1}."; private static readonly string ErrorString = "Device {0} reported {1}.";
public AudioDeviceErrorChecker(IntPtr device) public AudioDeviceErrorChecker(IntPtr device)
{ {

View file

@ -75,7 +75,7 @@ namespace OpenTK.Audio.OpenAL
private const CallingConvention Style = CallingConvention.Cdecl; private const CallingConvention Style = CallingConvention.Cdecl;
[DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity] [DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity]
unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist); private unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist);
/// <summary>This function creates a context using a specified device.</summary> /// <summary>This function creates a context using a specified device.</summary>
/// <param name="device">a pointer to a device</param> /// <param name="device">a pointer to a device</param>
@ -106,7 +106,7 @@ namespace OpenTK.Audio.OpenAL
} }
[DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern bool MakeContextCurrent(IntPtr context); private static extern bool MakeContextCurrent(IntPtr context);
/// <summary>This function makes a specified context the current context.</summary> /// <summary>This function makes a specified context the current context.</summary>
/// <param name="context">A pointer to the new context.</param> /// <param name="context">A pointer to the new context.</param>
@ -118,7 +118,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context ); // ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void ProcessContext(IntPtr context); private static extern void ProcessContext(IntPtr context);
/// <summary>This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary> /// <summary>This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
/// <param name="context">a pointer to the new context</param> /// <param name="context">a pointer to the new context</param>
@ -129,7 +129,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context ); // ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void SuspendContext(IntPtr context); private static extern void SuspendContext(IntPtr context);
/// <summary>This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary> /// <summary>This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
/// <param name="context">a pointer to the context to be suspended.</param> /// <param name="context">a pointer to the context to be suspended.</param>
@ -140,7 +140,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context ); // ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void DestroyContext(IntPtr context); private static extern void DestroyContext(IntPtr context);
/// <summary>This function destroys a context.</summary> /// <summary>This function destroys a context.</summary>
/// <param name="context">a pointer to the new context.</param> /// <param name="context">a pointer to the new context.</param>
@ -162,7 +162,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void ); // ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
[DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern IntPtr GetContextsDevice(IntPtr context); private static extern IntPtr GetContextsDevice(IntPtr context);
/// <summary>This function retrieves a context's device pointer.</summary> /// <summary>This function retrieves a context's device pointer.</summary>
/// <param name="context">a pointer to a context.</param> /// <param name="context">a pointer to a context.</param>
@ -307,7 +307,7 @@ namespace OpenTK.Audio.OpenAL
} }
[DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data); private unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data);
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); // ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer );
/// <summary>This function returns integers related to the context.</summary> /// <summary>This function returns integers related to the context.</summary>

View file

@ -41,7 +41,7 @@ namespace OpenTK
/// </remarks> /// </remarks>
public static class BlittableValueType<T> public static class BlittableValueType<T>
{ {
static readonly Type Type; private static readonly Type Type;
static BlittableValueType() static BlittableValueType()
{ {
@ -87,7 +87,7 @@ namespace OpenTK
// Checks whether the parameter is a primitive type or consists of primitive types recursively. // Checks whether the parameter is a primitive type or consists of primitive types recursively.
// Throws a NotSupportedException if it is not. // Throws a NotSupportedException if it is not.
static bool CheckType(Type type) private static bool CheckType(Type type)
{ {
//Debug.Print("Checking type {0} (size: {1} bytes).", type.Name, Marshal.SizeOf(type)); //Debug.Print("Checking type {0} (size: {1} bytes).", type.Name, Marshal.SizeOf(type));
if (type.IsPrimitive) if (type.IsPrimitive)
@ -110,7 +110,7 @@ namespace OpenTK
// Checks whether the specified struct defines [StructLayout(LayoutKind.Sequential, Pack=1)] // Checks whether the specified struct defines [StructLayout(LayoutKind.Sequential, Pack=1)]
// or [StructLayout(LayoutKind.Explicit)] // or [StructLayout(LayoutKind.Explicit)]
static bool CheckStructLayoutAttribute(Type type) private static bool CheckStructLayoutAttribute(Type type)
{ {
StructLayoutAttribute[] attr = (StructLayoutAttribute[]) StructLayoutAttribute[] attr = (StructLayoutAttribute[])
type.GetCustomAttributes(typeof(StructLayoutAttribute), true); type.GetCustomAttributes(typeof(StructLayoutAttribute), true);

View file

@ -40,11 +40,11 @@ namespace OpenTK
/// </summary> /// </summary>
public sealed class Configuration public sealed class Configuration
{ {
static bool runningOnUnix, runningOnMacOS, runningOnLinux; private static bool runningOnUnix, runningOnMacOS, runningOnLinux;
volatile static bool initialized; private volatile static bool initialized;
readonly static object InitLock = new object(); private readonly static object InitLock = new object();
Configuration() { } private Configuration() { }
/// <summary>Gets a System.Boolean indicating whether OpenTK is running on a Windows platform.</summary> /// <summary>Gets a System.Boolean indicating whether OpenTK is running on a Windows platform.</summary>
public static bool RunningOnWindows { get; private set; } public static bool RunningOnWindows { get; private set; }
@ -113,7 +113,7 @@ namespace OpenTK
} }
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct utsname private struct utsname
{ {
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string sysname; public string sysname;
@ -161,7 +161,7 @@ namespace OpenTK
[DllImport("libc")] [DllImport("libc")]
private static extern void uname(out utsname uname_struct); private static extern void uname(out utsname uname_struct);
static bool DetectMono() private static bool DetectMono()
{ {
// Detect the Mono runtime (code taken from http://mono.wikia.com/wiki/Detecting_if_program_is_running_in_Mono). // Detect the Mono runtime (code taken from http://mono.wikia.com/wiki/Detecting_if_program_is_running_in_Mono).
Type t = Type.GetType("Mono.Runtime"); Type t = Type.GetType("Mono.Runtime");
@ -169,7 +169,7 @@ namespace OpenTK
} }
#if SDL2 #if SDL2
static bool DetectSdl2() private static bool DetectSdl2()
{ {
bool supported = false; bool supported = false;
@ -227,7 +227,7 @@ namespace OpenTK
} }
#endif #endif
static void DetectUnix(out bool unix, out bool linux, out bool macos) private static void DetectUnix(out bool unix, out bool linux, out bool macos)
{ {
unix = linux = macos = false; unix = linux = macos = false;
@ -253,7 +253,7 @@ namespace OpenTK
} }
} }
static bool DetectWindows() private static bool DetectWindows()
{ {
return return
System.Environment.OSVersion.Platform == PlatformID.Win32NT || System.Environment.OSVersion.Platform == PlatformID.Win32NT ||
@ -262,7 +262,7 @@ namespace OpenTK
System.Environment.OSVersion.Platform == PlatformID.WinCE; System.Environment.OSVersion.Platform == PlatformID.WinCE;
} }
static bool DetectX11() private static bool DetectX11()
{ {
#if X11 #if X11
// Detect whether X is present. // Detect whether X is present.

View file

@ -15,7 +15,7 @@ namespace OpenTK
/// </summary> /// </summary>
public struct ContextHandle : IComparable<ContextHandle>, IEquatable<ContextHandle> public struct ContextHandle : IComparable<ContextHandle>, IEquatable<ContextHandle>
{ {
IntPtr handle; private IntPtr handle;
/// <summary> /// <summary>
/// Gets a System.IntPtr that represents the handle of this ContextHandle. /// Gets a System.IntPtr that represents the handle of this ContextHandle.

View file

@ -41,18 +41,18 @@ namespace OpenTK
// TODO: Add properties that describe the 'usable' size of the Display, i.e. the maximized size without the taskbar etc. // TODO: Add properties that describe the 'usable' size of the Display, i.e. the maximized size without the taskbar etc.
// TODO: Does not detect changes to primary device. // TODO: Does not detect changes to primary device.
bool primary; private bool primary;
Rectangle bounds; private Rectangle bounds;
DisplayResolution current_resolution = new DisplayResolution(); private DisplayResolution current_resolution = new DisplayResolution();
List<DisplayResolution> available_resolutions = new List<DisplayResolution>(); private List<DisplayResolution> available_resolutions = new List<DisplayResolution>();
IList<DisplayResolution> available_resolutions_readonly; private IList<DisplayResolution> available_resolutions_readonly;
internal object Id; // A platform-specific id for this monitor internal object Id; // A platform-specific id for this monitor
static readonly object display_lock = new object(); private static readonly object display_lock = new object();
static DisplayDevice primary_display; private static DisplayDevice primary_display;
static Platform.IDisplayDeviceDriver implementation; private static Platform.IDisplayDeviceDriver implementation;
static DisplayDevice() static DisplayDevice()
{ {
@ -267,7 +267,7 @@ namespace OpenTK
return null; return null;
} }
DisplayResolution FindResolution(int width, int height, int bitsPerPixel, float refreshRate) private DisplayResolution FindResolution(int width, int height, int bitsPerPixel, float refreshRate)
{ {
return available_resolutions.Find(delegate(DisplayResolution test) return available_resolutions.Find(delegate(DisplayResolution test)
{ {

View file

@ -17,7 +17,7 @@ namespace OpenTK
/// <summary>Contains information regarding a monitor's display resolution.</summary> /// <summary>Contains information regarding a monitor's display resolution.</summary>
public class DisplayResolution public class DisplayResolution
{ {
Rectangle bounds; private Rectangle bounds;
internal DisplayResolution() { } internal DisplayResolution() { }

View file

@ -34,7 +34,7 @@ namespace OpenTK
/// </summary> /// </summary>
public class FrameEventArgs : EventArgs public class FrameEventArgs : EventArgs
{ {
double elapsed; private double elapsed;
/// <summary> /// <summary>
/// Constructs a new FrameEventArgs instance. /// Constructs a new FrameEventArgs instance.

View file

@ -71,29 +71,29 @@ namespace OpenTK
/// </remarks> /// </remarks>
public class GameWindow : NativeWindow, IGameWindow, IDisposable public class GameWindow : NativeWindow, IGameWindow, IDisposable
{ {
const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events private const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events
readonly Stopwatch watch = new Stopwatch(); private readonly Stopwatch watch = new Stopwatch();
IGraphicsContext glContext; private IGraphicsContext glContext;
bool isExiting = false; private bool isExiting = false;
double update_period, render_period; private double update_period, render_period;
double target_update_period, target_render_period; private double target_update_period, target_render_period;
double update_time; // length of last UpdateFrame event private double update_time; // length of last UpdateFrame event
double render_time; // length of last RenderFrame event private double render_time; // length of last RenderFrame event
double update_timestamp; // timestamp of last UpdateFrame event private double update_timestamp; // timestamp of last UpdateFrame event
double render_timestamp; // timestamp of last RenderFrame event private double render_timestamp; // timestamp of last RenderFrame event
double update_epsilon; // quantization error for UpdateFrame events private double update_epsilon; // quantization error for UpdateFrame events
bool is_running_slowly; // true, when UpdatePeriod cannot reach TargetUpdatePeriod private bool is_running_slowly; // true, when UpdatePeriod cannot reach TargetUpdatePeriod
FrameEventArgs update_args = new FrameEventArgs(); private FrameEventArgs update_args = new FrameEventArgs();
FrameEventArgs render_args = new FrameEventArgs(); private FrameEventArgs render_args = new FrameEventArgs();
/// <summary>Constructs a new GameWindow with sensible default attributes.</summary> /// <summary>Constructs a new GameWindow with sensible default attributes.</summary>
public GameWindow() public GameWindow()
@ -361,12 +361,12 @@ namespace OpenTK
} }
} }
double ClampElapsed(double elapsed) private double ClampElapsed(double elapsed)
{ {
return MathHelper.Clamp(elapsed, 0.0, 1.0); return MathHelper.Clamp(elapsed, 0.0, 1.0);
} }
void DispatchUpdateAndRenderFrame(object sender, EventArgs e) private void DispatchUpdateAndRenderFrame(object sender, EventArgs e)
{ {
int is_running_slowly_retries = 4; int is_running_slowly_retries = 4;
double timestamp = watch.Elapsed.TotalSeconds; double timestamp = watch.Elapsed.TotalSeconds;
@ -410,7 +410,7 @@ namespace OpenTK
} }
} }
void RaiseUpdateFrame(double elapsed, ref double timestamp) private void RaiseUpdateFrame(double elapsed, ref double timestamp)
{ {
// Raise UpdateFrame event // Raise UpdateFrame event
update_args.Time = elapsed; update_args.Time = elapsed;
@ -426,7 +426,7 @@ namespace OpenTK
} }
void RaiseRenderFrame(double elapsed, ref double timestamp) private void RaiseRenderFrame(double elapsed, ref double timestamp)
{ {
// Raise RenderFrame event // Raise RenderFrame event
render_args.Time = elapsed; render_args.Time = elapsed;

View file

@ -36,7 +36,7 @@ namespace OpenTK.Graphics
/// </remarks> /// </remarks>
public struct ColorFormat : IComparable<ColorFormat>, IEquatable<ColorFormat> public struct ColorFormat : IComparable<ColorFormat>, IEquatable<ColorFormat>
{ {
byte red, green, blue, alpha; private byte red, green, blue, alpha;
/// <summary> /// <summary>
/// Constructs a new ColorFormat with the specified aggregate bits per pixel. /// Constructs a new ColorFormat with the specified aggregate bits per pixel.

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES10
// //
// Make sure that no error checking is added to the GetError function, // Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion! // as that would cause infinite recursion!
struct ErrorHelper : IDisposable internal struct ErrorHelper : IDisposable
{ {
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>(); new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context) public ErrorHelper(IGraphicsContext context)
{ {

View file

@ -9,6 +9,6 @@ namespace OpenTK.Graphics.ES10
/// </summary> /// </summary>
public sealed partial class GL public sealed partial class GL
{ {
const string Library = "libGLES.dll"; private const string Library = "libGLES.dll";
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES11
// //
// Make sure that no error checking is added to the GetError function, // Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion! // as that would cause infinite recursion!
struct ErrorHelper : IDisposable internal struct ErrorHelper : IDisposable
{ {
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>(); new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context) public ErrorHelper(IGraphicsContext context)
{ {

View file

@ -15,13 +15,13 @@ namespace OpenTK.Graphics.ES11
#if IPHONE #if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else #else
const string Library = "GLESv1_CM"; private const string Library = "GLESv1_CM";
#endif #endif
static readonly object sync_root = new object(); private static readonly object sync_root = new object();
static IntPtr[] EntryPoints; private static IntPtr[] EntryPoints;
static byte[] EntryPointNames; private static byte[] EntryPointNames;
static int[] EntryPointNameOffsets; private static int[] EntryPointNameOffsets;
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES20
// //
// Make sure that no error checking is added to the GetError function, // Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion! // as that would cause infinite recursion!
struct ErrorHelper : IDisposable internal struct ErrorHelper : IDisposable
{ {
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>(); new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context) public ErrorHelper(IGraphicsContext context)
{ {

View file

@ -41,13 +41,13 @@ namespace OpenTK.Graphics.ES20
#if IPHONE #if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else #else
const string Library = "libGLESv2.dll"; private const string Library = "libGLESv2.dll";
#endif #endif
static readonly object sync_root = new object(); private static readonly object sync_root = new object();
static IntPtr[] EntryPoints; private static IntPtr[] EntryPoints;
static byte[] EntryPointNames; private static byte[] EntryPointNames;
static int[] EntryPointNameOffsets; private static int[] EntryPointNameOffsets;
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.

File diff suppressed because it is too large Load diff

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.ES30
// //
// Make sure that no error checking is added to the GetError function, // Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion! // as that would cause infinite recursion!
struct ErrorHelper : IDisposable internal struct ErrorHelper : IDisposable
{ {
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>(); new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context) public ErrorHelper(IGraphicsContext context)
{ {

View file

@ -41,13 +41,13 @@ namespace OpenTK.Graphics.ES30
#if IPHONE #if IPHONE
const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES"; const string Library = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES";
#else #else
const string Library = "libGLESv2.dll"; private const string Library = "libGLESv2.dll";
#endif #endif
static readonly object sync_root = new object(); private static readonly object sync_root = new object();
static IntPtr[] EntryPoints; private static IntPtr[] EntryPoints;
static byte[] EntryPointNames; private static byte[] EntryPointNames;
static int[] EntryPointNameOffsets; private static int[] EntryPointNameOffsets;
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.

View file

@ -50,8 +50,8 @@ namespace OpenTK.Graphics
/// <returns>The current OpenGL context, or <c>IntPtr.Zero</c> if no context is on the calling thread.</returns> /// <returns>The current OpenGL context, or <c>IntPtr.Zero</c> if no context is on the calling thread.</returns>
public delegate ContextHandle GetCurrentContextDelegate(); public delegate ContextHandle GetCurrentContextDelegate();
IGraphicsContext implementation; // The actual render context implementation for the underlying platform. private IGraphicsContext implementation; // The actual render context implementation for the underlying platform.
bool disposed; private bool disposed;
// Cache for the context handle. We need this for RemoveContext() // Cache for the context handle. We need this for RemoveContext()
// in case the user does not call Dispose(). When this happens, // in case the user does not call Dispose(). When this happens,
@ -59,11 +59,11 @@ namespace OpenTK.Graphics
// the IGraphicsContext implementation may already be null // the IGraphicsContext implementation may already be null
// (hence we cannot call implementation.Context to retrieve // (hence we cannot call implementation.Context to retrieve
// the handle.) // the handle.)
ContextHandle handle_cached; private ContextHandle handle_cached;
readonly static object SyncRoot = new object(); private readonly static object SyncRoot = new object();
// Maps OS-specific context handles to GraphicsContext instances. // Maps OS-specific context handles to GraphicsContext instances.
readonly static Dictionary<ContextHandle, IGraphicsContext> available_contexts = private readonly static Dictionary<ContextHandle, IGraphicsContext> available_contexts =
new Dictionary<ContextHandle, IGraphicsContext>(); new Dictionary<ContextHandle, IGraphicsContext>();
/// <summary> /// <summary>
@ -294,7 +294,7 @@ namespace OpenTK.Graphics
(this as IGraphicsContextInternal).Context == (obj as IGraphicsContextInternal).Context; (this as IGraphicsContextInternal).Context == (obj as IGraphicsContextInternal).Context;
} }
static void AddContext(IGraphicsContextInternal context) private static void AddContext(IGraphicsContextInternal context)
{ {
ContextHandle ctx = context.Context; ContextHandle ctx = context.Context;
if (!available_contexts.ContainsKey(ctx)) if (!available_contexts.ContainsKey(ctx))
@ -309,7 +309,7 @@ namespace OpenTK.Graphics
} }
} }
static void RemoveContext(IGraphicsContextInternal context) private static void RemoveContext(IGraphicsContextInternal context)
{ {
ContextHandle ctx = context.Context; ContextHandle ctx = context.Context;
if (available_contexts.ContainsKey(ctx)) if (available_contexts.ContainsKey(ctx))
@ -322,7 +322,7 @@ namespace OpenTK.Graphics
} }
} }
static IGraphicsContext FindSharedContext() private static IGraphicsContext FindSharedContext()
{ {
if (GraphicsContext.ShareContexts) if (GraphicsContext.ShareContexts)
{ {
@ -562,7 +562,7 @@ namespace OpenTK.Graphics
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
void Dispose(bool manual) private void Dispose(bool manual)
{ {
if (!IsDisposed) if (!IsDisposed)
{ {

View file

@ -34,7 +34,7 @@ using OpenTK.Platform;
namespace OpenTK.Graphics namespace OpenTK.Graphics
{ {
// Provides the foundation for all IGraphicsContext implementations. // Provides the foundation for all IGraphicsContext implementations.
abstract class GraphicsContextBase : IGraphicsContext, IGraphicsContextInternal, IEquatable<IGraphicsContextInternal> internal abstract class GraphicsContextBase : IGraphicsContext, IGraphicsContextInternal, IEquatable<IGraphicsContextInternal>
{ {
protected ContextHandle Handle; protected ContextHandle Handle;
protected GraphicsMode Mode; protected GraphicsMode Mode;

View file

@ -14,10 +14,10 @@ namespace OpenTK.Graphics
/// <summary>Defines the format for graphics operations.</summary> /// <summary>Defines the format for graphics operations.</summary>
public class GraphicsMode : IEquatable<GraphicsMode> public class GraphicsMode : IEquatable<GraphicsMode>
{ {
int samples; private int samples;
static GraphicsMode defaultMode; private static GraphicsMode defaultMode;
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
// Disable BeforeFieldInit // Disable BeforeFieldInit
static GraphicsMode() { } static GraphicsMode() { }

View file

@ -29,7 +29,7 @@ using System.Text;
namespace OpenTK.Graphics namespace OpenTK.Graphics
{ {
sealed class GraphicsModeComparer : IComparer<GraphicsMode> internal sealed class GraphicsModeComparer : IComparer<GraphicsMode>
{ {
public int Compare(GraphicsMode x, GraphicsMode y) public int Compare(GraphicsMode x, GraphicsMode y)
{ {

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.OpenGL
// //
// Make sure that no error checking is added to the GetError function, // Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion! // as that would cause infinite recursion!
struct ErrorHelper : IDisposable internal struct ErrorHelper : IDisposable
{ {
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>(); new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context) public ErrorHelper(IGraphicsContext context)
{ {

File diff suppressed because it is too large Load diff

View file

@ -67,11 +67,11 @@ namespace OpenTK.Graphics.OpenGL
{ {
internal const string Library = "opengl32.dll"; internal const string Library = "opengl32.dll";
static readonly object sync_root = new object(); private static readonly object sync_root = new object();
static IntPtr[] EntryPoints; private static IntPtr[] EntryPoints;
static byte[] EntryPointNames; private static byte[] EntryPointNames;
static int[] EntryPointNameOffsets; private static int[] EntryPointNameOffsets;
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.

View file

@ -40,12 +40,14 @@ namespace OpenTK.Graphics.OpenGL4
// //
// Make sure that no error checking is added to the GetError function, // Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion! // as that would cause infinite recursion!
struct ErrorHelper : IDisposable internal struct ErrorHelper : IDisposable
{ {
static readonly object SyncRoot = new object(); private static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
private static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>(); new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
private readonly GraphicsContext Context;
public ErrorHelper(IGraphicsContext context) public ErrorHelper(IGraphicsContext context)
{ {

File diff suppressed because it is too large Load diff

View file

@ -38,12 +38,12 @@ namespace OpenTK.Graphics.OpenGL4
/// </summary> /// </summary>
public sealed partial class GL : GraphicsBindingsBase public sealed partial class GL : GraphicsBindingsBase
{ {
const string Library = "opengl32.dll"; private const string Library = "opengl32.dll";
static readonly object sync_root = new object(); private static readonly object sync_root = new object();
static IntPtr[] EntryPoints; private static IntPtr[] EntryPoints;
static byte[] EntryPointNames; private static byte[] EntryPointNames;
static int[] EntryPointNameOffsets; private static int[] EntryPointNameOffsets;
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.

View file

@ -29,7 +29,7 @@ using System;
namespace OpenTK.Input namespace OpenTK.Input
{ {
enum ConfigurationType internal enum ConfigurationType
{ {
Unmapped = 0, Unmapped = 0,
Axis, Axis,

View file

@ -7,7 +7,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public class FileDropEventArgs : EventArgs public class FileDropEventArgs : EventArgs
{ {
string fileName; private string fileName;
/// <summary> /// <summary>
/// Gets the name of the file. /// Gets the name of the file.

View file

@ -45,7 +45,7 @@ namespace OpenTK.Input
internal const int MaxAxisCount = 10; internal const int MaxAxisCount = 10;
internal const int MaxDPadCount = 2; internal const int MaxDPadCount = 2;
static readonly IGamePadDriver driver = private static readonly IGamePadDriver driver =
Platform.Factory.Default.CreateGamePadDriver(); Platform.Factory.Default.CreateGamePadDriver();
private GamePad() { } private GamePad() { }

View file

@ -34,7 +34,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public struct GamePadButtons : IEquatable<GamePadButtons> public struct GamePadButtons : IEquatable<GamePadButtons>
{ {
Buttons buttons; private Buttons buttons;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="OpenTK.Input.GamePadButtons"/> structure. /// Initializes a new instance of the <see cref="OpenTK.Input.GamePadButtons"/> structure.
@ -232,7 +232,7 @@ namespace OpenTK.Input
return buttons == other.buttons; return buttons == other.buttons;
} }
ButtonState GetButton(Buttons b) private ButtonState GetButton(Buttons b)
{ {
return (buttons & b) != 0 ? ButtonState.Pressed : ButtonState.Released; return (buttons & b) != 0 ? ButtonState.Pressed : ButtonState.Released;
} }

View file

@ -34,9 +34,9 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public struct GamePadCapabilities : IEquatable<GamePadCapabilities> public struct GamePadCapabilities : IEquatable<GamePadCapabilities>
{ {
Buttons buttons; private Buttons buttons;
GamePadAxes axes; private GamePadAxes axes;
byte gamepad_type; private byte gamepad_type;
internal GamePadCapabilities(GamePadType type, GamePadAxes axes, Buttons buttons, bool is_connected, bool is_mapped) internal GamePadCapabilities(GamePadType type, GamePadAxes axes, Buttons buttons, bool is_connected, bool is_mapped)
: this() : this()

View file

@ -30,11 +30,11 @@ using System.Collections.Generic;
namespace OpenTK.Input namespace OpenTK.Input
{ {
sealed class GamePadConfiguration internal sealed class GamePadConfiguration
{ {
static readonly char[] ConfigurationSeparator = new char[] { ',' }; private static readonly char[] ConfigurationSeparator = new char[] { ',' };
readonly List<GamePadConfigurationItem> configuration_items = private readonly List<GamePadConfigurationItem> configuration_items =
new List<GamePadConfigurationItem>(); new List<GamePadConfigurationItem>();
public Guid Guid { get; private set; } public Guid Guid { get; private set; }
@ -55,10 +55,10 @@ namespace OpenTK.Input
/// Parses a GamePad configuration string. /// Parses a GamePad configuration string.
/// This string must follow the rules for SDL2 /// This string must follow the rules for SDL2
/// GameController outlined here: /// GameController outlined here:
/// http://wiki.libsdl.org/SDL_GameControllerAddMapping /// http://wiki.libsdl.org/SDL_GameControllerAddMapping
/// </summary> /// </summary>
/// <param name="configuration"></param> /// <param name="configuration"></param>
void ParseConfiguration(string configuration) private void ParseConfiguration(string configuration)
{ {
if (String.IsNullOrEmpty(configuration)) if (String.IsNullOrEmpty(configuration))
{ {
@ -93,7 +93,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
/// <param name="target">The string to parse</param> /// <param name="target">The string to parse</param>
/// <returns>The configuration target (Button index, axis index etc.)</returns> /// <returns>The configuration target (Button index, axis index etc.)</returns>
static GamePadConfigurationTarget ParseTarget(string target) private static GamePadConfigurationTarget ParseTarget(string target)
{ {
switch (target) switch (target)
{ {
@ -157,7 +157,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
/// <param name="item">The string to parse</param> /// <param name="item">The string to parse</param>
/// <returns>The new gamepad configuration source</returns> /// <returns>The new gamepad configuration source</returns>
static GamePadConfigurationSource ParseSource(string item) private static GamePadConfigurationSource ParseSource(string item)
{ {
if (String.IsNullOrEmpty(item)) if (String.IsNullOrEmpty(item))
{ {
@ -190,7 +190,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
/// <param name="item">The string to parse</param> /// <param name="item">The string to parse</param>
/// <returns>The index of the axis or button</returns> /// <returns>The index of the axis or button</returns>
static int ParseIndex(string item) private static int ParseIndex(string item)
{ {
// item is in the format "a#" where # a zero-based integer number // item is in the format "a#" where # a zero-based integer number
return Int32.Parse(item.Substring(1)); ; return Int32.Parse(item.Substring(1)); ;
@ -204,7 +204,7 @@ namespace OpenTK.Input
/// <param name="item">The string to parse</param> /// <param name="item">The string to parse</param>
/// <param name="position">The hat position assigned via 'out'</param> /// <param name="position">The hat position assigned via 'out'</param>
/// <returns>The new joystick hat</returns> /// <returns>The new joystick hat</returns>
static JoystickHat ParseHat(string item, out HatPosition position) private static JoystickHat ParseHat(string item, out HatPosition position)
{ {
JoystickHat hat = JoystickHat.Hat0; JoystickHat hat = JoystickHat.Hat0;
int id = Int32.Parse(item.Substring(1, 1)); int id = Int32.Parse(item.Substring(1, 1));

View file

@ -30,11 +30,11 @@ using System.Collections.Generic;
namespace OpenTK.Input namespace OpenTK.Input
{ {
class GamePadConfigurationDatabase internal class GamePadConfigurationDatabase
{ {
internal const string UnmappedName = "Unmapped Controller"; internal const string UnmappedName = "Unmapped Controller";
readonly Dictionary<Guid, string> Configurations = new Dictionary<Guid, string>(); private readonly Dictionary<Guid, string> Configurations = new Dictionary<Guid, string>();
internal GamePadConfigurationDatabase() internal GamePadConfigurationDatabase()
{ {

View file

@ -29,7 +29,7 @@ using System;
namespace OpenTK.Input namespace OpenTK.Input
{ {
class GamePadConfigurationItem internal class GamePadConfigurationItem
{ {
public GamePadConfigurationItem(GamePadConfigurationSource source, GamePadConfigurationTarget target) public GamePadConfigurationItem(GamePadConfigurationSource source, GamePadConfigurationTarget target)
{ {

View file

@ -27,12 +27,12 @@
namespace OpenTK.Input namespace OpenTK.Input
{ {
struct GamePadConfigurationSource internal struct GamePadConfigurationSource
{ {
int? map_button; private int? map_button;
int? map_axis; private int? map_axis;
JoystickHat? map_hat; private JoystickHat? map_hat;
HatPosition? map_hat_position; private HatPosition? map_hat_position;
/// <summary> /// <summary>
/// Creates a new gamepad configuration source from an axis or a button /// Creates a new gamepad configuration source from an axis or a button

View file

@ -29,10 +29,10 @@ using System;
namespace OpenTK.Input namespace OpenTK.Input
{ {
struct GamePadConfigurationTarget internal struct GamePadConfigurationTarget
{ {
Nullable<Buttons> map_button; private Nullable<Buttons> map_button;
Nullable<GamePadAxes> map_axis; private Nullable<GamePadAxes> map_axis;
public GamePadConfigurationTarget(Buttons button) public GamePadConfigurationTarget(Buttons button)
: this() : this()

View file

@ -35,7 +35,7 @@ namespace OpenTK.Input
public struct GamePadDPad : IEquatable<GamePadDPad> public struct GamePadDPad : IEquatable<GamePadDPad>
{ {
[Flags] [Flags]
enum DPadButtons : byte private enum DPadButtons : byte
{ {
Up = Buttons.DPadUp, Up = Buttons.DPadUp,
Down = Buttons.DPadDown, Down = Buttons.DPadDown,
@ -43,7 +43,7 @@ namespace OpenTK.Input
Right = Buttons.DPadRight Right = Buttons.DPadRight
} }
DPadButtons buttons; private DPadButtons buttons;
internal GamePadDPad(Buttons state) internal GamePadDPad(Buttons state)
{ {
@ -179,7 +179,7 @@ namespace OpenTK.Input
Equals((GamePadDPad)obj); Equals((GamePadDPad)obj);
} }
void SetButton(DPadButtons button, bool value) private void SetButton(DPadButtons button, bool value)
{ {
if (value) if (value)
{ {

View file

@ -32,15 +32,15 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public struct GamePadState : IEquatable<GamePadState> public struct GamePadState : IEquatable<GamePadState>
{ {
const float RangeMultiplier = 1.0f / (short.MaxValue + 1); private const float RangeMultiplier = 1.0f / (short.MaxValue + 1);
Buttons buttons; private Buttons buttons;
short left_stick_x; private short left_stick_x;
short left_stick_y; private short left_stick_y;
short right_stick_x; private short right_stick_x;
short right_stick_y; private short right_stick_y;
byte left_trigger; private byte left_trigger;
byte right_trigger; private byte right_trigger;
/// <summary> /// <summary>
/// Gets a <see cref="GamePadThumbSticks"/> structure describing the /// Gets a <see cref="GamePadThumbSticks"/> structure describing the
@ -205,13 +205,13 @@ namespace OpenTK.Input
PacketNumber = number; PacketNumber = number;
} }
bool IsAxisValid(GamePadAxes axis) private bool IsAxisValid(GamePadAxes axis)
{ {
int index = (int)axis; int index = (int)axis;
return index >= 0 && index < GamePad.MaxAxisCount; return index >= 0 && index < GamePad.MaxAxisCount;
} }
bool IsDPadValid(int index) private bool IsDPadValid(int index)
{ {
return index >= 0 && index < GamePad.MaxDPadCount; return index >= 0 && index < GamePad.MaxDPadCount;
} }

View file

@ -34,9 +34,9 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public struct GamePadThumbSticks : IEquatable<GamePadThumbSticks> public struct GamePadThumbSticks : IEquatable<GamePadThumbSticks>
{ {
const float ConversionFactor = 1.0f / short.MaxValue; private const float ConversionFactor = 1.0f / short.MaxValue;
short left_x, left_y; private short left_x, left_y;
short right_x, right_y; private short right_x, right_y;
internal GamePadThumbSticks( internal GamePadThumbSticks(
short left_x, short left_y, short left_x, short left_y,

View file

@ -35,9 +35,9 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public struct GamePadTriggers : IEquatable<GamePadTriggers> public struct GamePadTriggers : IEquatable<GamePadTriggers>
{ {
const float ConversionFactor = 1.0f / byte.MaxValue; private const float ConversionFactor = 1.0f / byte.MaxValue;
byte left; private byte left;
byte right; private byte right;
internal GamePadTriggers(byte left, byte right) internal GamePadTriggers(byte left, byte right)
{ {

View file

@ -4,7 +4,7 @@ using System.Text;
namespace OpenTK.Input namespace OpenTK.Input
{ {
interface IGamePadDriver internal interface IGamePadDriver
{ {
GamePadState GetState(int index); GamePadState GetState(int index);

View file

@ -30,7 +30,7 @@ using System.Text;
namespace OpenTK.Input namespace OpenTK.Input
{ {
// Defines the interface for a 2nd generation input driver. // Defines the interface for a 2nd generation input driver.
interface IInputDriver2 : IDisposable internal interface IInputDriver2 : IDisposable
{ {
IMouseDriver2 MouseDriver { get; } IMouseDriver2 MouseDriver { get; }
IKeyboardDriver2 KeyboardDriver { get; } IKeyboardDriver2 KeyboardDriver { get; }

View file

@ -31,7 +31,7 @@ using System.Text;
namespace OpenTK.Input namespace OpenTK.Input
{ {
interface IJoystickDriver2 internal interface IJoystickDriver2
{ {
JoystickState GetState(int index); JoystickState GetState(int index);
JoystickCapabilities GetCapabilities(int index); JoystickCapabilities GetCapabilities(int index);

View file

@ -4,7 +4,7 @@ using System.Text;
namespace OpenTK.Input namespace OpenTK.Input
{ {
interface IKeyboardDriver2 internal interface IKeyboardDriver2
{ {
/// <summary> /// <summary>
/// Retrieves the combined <see cref="OpenTK.Input.KeyboardState"/> for all keyboard devices. /// Retrieves the combined <see cref="OpenTK.Input.KeyboardState"/> for all keyboard devices.

View file

@ -29,7 +29,7 @@ using System.Text;
namespace OpenTK.Input namespace OpenTK.Input
{ {
interface IMouseDriver2 internal interface IMouseDriver2
{ {
MouseState GetState(); MouseState GetState();
MouseState GetState(int index); MouseState GetState(int index);

View file

@ -41,7 +41,7 @@ namespace OpenTK.Input
/// <seealso cref="GamePad"/> /// <seealso cref="GamePad"/>
public sealed class Joystick public sealed class Joystick
{ {
static readonly IJoystickDriver2 implementation = private static readonly IJoystickDriver2 implementation =
Platform.Factory.Default.CreateJoystickDriver(); Platform.Factory.Default.CreateJoystickDriver();
private Joystick() { } private Joystick() { }

View file

@ -37,9 +37,9 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public struct JoystickCapabilities : IEquatable<JoystickCapabilities> public struct JoystickCapabilities : IEquatable<JoystickCapabilities>
{ {
byte axis_count; private byte axis_count;
byte button_count; private byte button_count;
byte hat_count; private byte hat_count;
internal JoystickCapabilities(int axis_count, int button_count, int hat_count, bool is_connected) internal JoystickCapabilities(int axis_count, int button_count, int hat_count, bool is_connected)
{ {

View file

@ -33,8 +33,8 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public abstract class JoystickDevice : IInputDevice public abstract class JoystickDevice : IInputDevice
{ {
JoystickMoveEventArgs move_args = new JoystickMoveEventArgs(0, 0, 0); private JoystickMoveEventArgs move_args = new JoystickMoveEventArgs(0, 0, 0);
JoystickButtonEventArgs button_args = new JoystickButtonEventArgs(0, false); private JoystickButtonEventArgs button_args = new JoystickButtonEventArgs(0, false);
internal JoystickDevice(int id, int axes, int buttons) internal JoystickDevice(int id, int axes, int buttons)
{ {
@ -206,7 +206,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public sealed class JoystickButtonCollection public sealed class JoystickButtonCollection
{ {
bool[] button_state; private bool[] button_state;
internal JoystickButtonCollection(int numButtons) internal JoystickButtonCollection(int numButtons)
{ {
@ -241,7 +241,7 @@ namespace OpenTK.Input
/// </summary> /// </summary>
public sealed class JoystickAxisCollection public sealed class JoystickAxisCollection
{ {
float[] axis_state; private float[] axis_state;
internal JoystickAxisCollection(int numAxes) internal JoystickAxisCollection(int numAxes)
{ {

Some files were not shown because too many files have changed in this diff Show more