コード例 #1
0
ファイル: Program.cs プロジェクト: xiaohszx/OpenGL.NET
        private static void BuildReturnType(GLParser.GLVersion version, GLParser.GLCommand c, StringBuilder builder)
        {
            if (c.ReturnType.Type == "GLenum")
            {
                bool groupExists = version.Groups.Exists(g => g.Name == c.ReturnType.Group);

                var groupName = c.ReturnType.Group;

                // For GLenums that don't appear in the gl.xml file.
                if (!groupExists)
                {
                    groupName = "uint";
                }

                builder.Append($"{groupName}");
            }
            else
            {
                builder.Append($"{ConvertGLType(c.ReturnType.Type)}");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: xiaohszx/OpenGL.NET
        private static void BuildParameterList(GLParser.GLVersion version, GLParser.GLCommand c, StringBuilder builder)
        {
            if (c.Parameters.Count > 0)
            {
                foreach (var p in c.Parameters)
                {
                    var name = p.Name;

                    // Add @ to start of any names that are C# keywords to avoid conflict
                    if (name == "params" || name == "string" || name == "ref" || name == "base")
                    {
                        name = "@" + name;
                    }

                    if (p.Type == "GLenum")
                    {
                        bool groupExists = version.Groups.Exists(g => g.Name == p.Group);

                        var groupName = p.Group;

                        // For GLenums that don't appear in the gl.xml file.
                        if (!groupExists)
                        {
                            groupName = "uint";
                        }

                        builder.Append($"{groupName} {name}, ");
                    }
                    else
                    {
                        builder.Append($"{ConvertGLType(p.Type)} {name}, ");
                    }
                }
                builder.Length -= 2;
            }
        }