* Structures/Type.cs: Try to translate GLenum even if category is

unknown.
This commit is contained in:
the_fiddler 2009-07-15 14:05:40 +00:00
parent 35dc431d4d
commit 165287fdd2

View file

@ -294,18 +294,26 @@ namespace Bind.Structures
} }
else if (Bind.Structures.Type.GLTypes.TryGetValue(CurrentType, out s)) else if (Bind.Structures.Type.GLTypes.TryGetValue(CurrentType, out s))
{ {
// Check if the parameter is a generic GLenum. If yes, // Check if the parameter is a generic GLenum. If it is, search for a better match,
// check if a better match exists: // otherwise fallback to Settings.CompleteEnumName (named 'All' by default).
if (s.Contains("GLenum") && !String.IsNullOrEmpty(category)) if (s.Contains("GLenum") /*&& !String.IsNullOrEmpty(category)*/)
{ {
if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) != Settings.Legacy.None) if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) != Settings.Legacy.None)
{
CurrentType = "int"; CurrentType = "int";
}
else else
{
// Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc) // Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc)
if (Enum.GLEnums.ContainsKey(category)) if (Enum.GLEnums.ContainsKey(category))
{
CurrentType = String.Format("{0}.{1}", Settings.EnumsOutput, Enum.TranslateName(category)); CurrentType = String.Format("{0}.{1}", Settings.EnumsOutput, Enum.TranslateName(category));
}
else else
{
CurrentType = String.Format("{0}.{1}", Settings.EnumsOutput, Settings.CompleteEnumName); CurrentType = String.Format("{0}.{1}", Settings.EnumsOutput, Settings.CompleteEnumName);
}
}
} }
else else
{ {