Update json files from cimgui and handle new syntax.

internals
Eric Mellino 6 years ago
parent bb8b9ecc0c
commit 568024f5a0
  1. 14
      src/CodeGenerator/Program.cs
  2. 13453
      src/CodeGenerator/definitions.json
  3. 2565
      src/CodeGenerator/structs_and_enums.json
  4. 2
      src/ImGui.NET/Generated/GlyphRangesBuilder.gen.cs
  5. 4
      src/ImGui.NET/Generated/ImDrawChannel.gen.cs
  6. 14
      src/ImGui.NET/Generated/ImDrawList.gen.cs
  7. 6
      src/ImGui.NET/Generated/ImFont.gen.cs
  8. 6
      src/ImGui.NET/Generated/ImFontAtlas.gen.cs
  9. 28
      src/ImGui.NET/Generated/ImGui.gen.cs
  10. 2
      src/ImGui.NET/Generated/ImGuiNative.gen.cs
  11. 2
      src/ImGui.NET/Generated/ImGuiStorage.gen.cs
  12. 2
      src/ImGui.NET/Generated/ImGuiTextBuffer.gen.cs
  13. 2
      src/ImGui.NET/Generated/ImGuiTextFilter.gen.cs

@ -77,6 +77,7 @@ namespace CodeGenerator
{ "ImVec4(0,0,0,0)", "new Vector4()" },
{ "ImVec4(1,1,1,1)", "new Vector4(1, 1, 1, 1)" },
{ "ImDrawCornerFlags_All", "(int)ImDrawCornerFlags.All" },
{ "FLT_MAX", "float.MaxValue" },
};
private static readonly Dictionary<string, string> s_identifierReplacements = new Dictionary<string, string>()
@ -145,7 +146,11 @@ namespace CodeGenerator
string name = jp.Name;
TypeReference[] fields = jp.Values().Select(v =>
{
return new TypeReference(v["name"].ToString(), v["type"].ToString(), enums);
return new TypeReference(
v["name"].ToString(),
v["type"].ToString(),
v["template_type"]?.ToString(),
enums);
}).ToArray();
return new TypeDefinition(name, fields);
}).ToArray();
@ -309,7 +314,7 @@ namespace CodeGenerator
}
else if (typeStr.Contains("ImVector"))
{
string vectorElementType = GetImVectorElementType(typeStr);
string vectorElementType = GetTypeString(field.TemplateType, false);
if (s_wellKnownTypes.TryGetValue(vectorElementType, out string wellKnown))
{
@ -1002,13 +1007,18 @@ namespace CodeGenerator
{
public string Name { get; }
public string Type { get; }
public string TemplateType { get; }
public int ArraySize { get; }
public bool IsFunctionPointer { get; }
public TypeReference(string name, string type, EnumDefinition[] enums)
: this(name, type, null, enums) { }
public TypeReference(string name, string type, string templateType, EnumDefinition[] enums)
{
Name = name;
Type = type.Replace("const", string.Empty).Trim();
TemplateType = templateType;
int startBracket = name.IndexOf('[');
if (startBracket != -1)
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -7,7 +7,7 @@ namespace ImGuiNET
{
public unsafe partial struct GlyphRangesBuilder
{
public ImVector/*<unsigned char>*/ UsedChars;
public ImVector UsedChars;
}
public unsafe partial struct GlyphRangesBuilderPtr
{

@ -7,8 +7,8 @@ namespace ImGuiNET
{
public unsafe partial struct ImDrawChannel
{
public ImVector/*<ImDrawCmd>*/ CmdBuffer;
public ImVector/*<ImDrawIdx>*/ IdxBuffer;
public ImVector CmdBuffer;
public ImVector IdxBuffer;
}
public unsafe partial struct ImDrawChannelPtr
{

@ -7,21 +7,21 @@ namespace ImGuiNET
{
public unsafe partial struct ImDrawList
{
public ImVector/*<ImDrawCmd>*/ CmdBuffer;
public ImVector/*<ImDrawIdx>*/ IdxBuffer;
public ImVector/*<ImDrawVert>*/ VtxBuffer;
public ImVector CmdBuffer;
public ImVector IdxBuffer;
public ImVector VtxBuffer;
public ImDrawListFlags Flags;
public IntPtr _Data;
public byte* _OwnerName;
public uint _VtxCurrentIdx;
public ImDrawVert* _VtxWritePtr;
public ushort* _IdxWritePtr;
public ImVector/*<ImVec4>*/ _ClipRectStack;
public ImVector/*<ImTextureID>*/ _TextureIdStack;
public ImVector/*<ImVec2>*/ _Path;
public ImVector _ClipRectStack;
public ImVector _TextureIdStack;
public ImVector _Path;
public int _ChannelsCurrent;
public int _ChannelsCount;
public ImVector/*<ImDrawChannel>*/ _Channels;
public ImVector _Channels;
}
public unsafe partial struct ImDrawListPtr
{

@ -10,9 +10,9 @@ namespace ImGuiNET
public float FontSize;
public float Scale;
public Vector2 DisplayOffset;
public ImVector/*<ImFontGlyph>*/ Glyphs;
public ImVector/*<float>*/ IndexAdvanceX;
public ImVector/*<unsigned short>*/ IndexLookup;
public ImVector Glyphs;
public ImVector IndexAdvanceX;
public ImVector IndexLookup;
public ImFontGlyph* FallbackGlyph;
public float FallbackAdvanceX;
public ushort FallbackChar;

@ -18,9 +18,9 @@ namespace ImGuiNET
public int TexHeight;
public Vector2 TexUvScale;
public Vector2 TexUvWhitePixel;
public ImVector/*<ImFont*>*/ Fonts;
public ImVector/*<CustomRect>*/ CustomRects;
public ImVector/*<ImFontConfig>*/ ConfigData;
public ImVector Fonts;
public ImVector CustomRects;
public ImVector ConfigData;
public fixed int CustomRectIds[1];
}
public unsafe partial struct ImFontAtlasPtr

@ -1528,8 +1528,8 @@ namespace ImGuiNET
}
int values_offset = 0;
byte* native_overlay_text = null;
float scale_min = 3.40282347e+38F;
float scale_max = 3.40282347e+38F;
float scale_min = float.MaxValue;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1547,8 +1547,8 @@ namespace ImGuiNET
native_label[native_label_offset] = 0;
}
byte* native_overlay_text = null;
float scale_min = 3.40282347e+38F;
float scale_max = 3.40282347e+38F;
float scale_min = float.MaxValue;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1572,8 +1572,8 @@ namespace ImGuiNET
int native_overlay_text_offset = Encoding.UTF8.GetBytes(overlay_text_ptr, overlay_text.Length, native_overlay_text, overlay_text_byteCount);
native_overlay_text[native_overlay_text_offset] = 0;
}
float scale_min = 3.40282347e+38F;
float scale_max = 3.40282347e+38F;
float scale_min = float.MaxValue;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1597,7 +1597,7 @@ namespace ImGuiNET
int native_overlay_text_offset = Encoding.UTF8.GetBytes(overlay_text_ptr, overlay_text.Length, native_overlay_text, overlay_text_byteCount);
native_overlay_text[native_overlay_text_offset] = 0;
}
float scale_max = 3.40282347e+38F;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1726,8 +1726,8 @@ namespace ImGuiNET
}
int values_offset = 0;
byte* native_overlay_text = null;
float scale_min = 3.40282347e+38F;
float scale_max = 3.40282347e+38F;
float scale_min = float.MaxValue;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1745,8 +1745,8 @@ namespace ImGuiNET
native_label[native_label_offset] = 0;
}
byte* native_overlay_text = null;
float scale_min = 3.40282347e+38F;
float scale_max = 3.40282347e+38F;
float scale_min = float.MaxValue;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1770,8 +1770,8 @@ namespace ImGuiNET
int native_overlay_text_offset = Encoding.UTF8.GetBytes(overlay_text_ptr, overlay_text.Length, native_overlay_text, overlay_text_byteCount);
native_overlay_text[native_overlay_text_offset] = 0;
}
float scale_min = 3.40282347e+38F;
float scale_max = 3.40282347e+38F;
float scale_min = float.MaxValue;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)
@ -1795,7 +1795,7 @@ namespace ImGuiNET
int native_overlay_text_offset = Encoding.UTF8.GetBytes(overlay_text_ptr, overlay_text.Length, native_overlay_text, overlay_text_byteCount);
native_overlay_text[native_overlay_text_offset] = 0;
}
float scale_max = 3.40282347e+38F;
float scale_max = float.MaxValue;
Vector2 graph_size = new Vector2();
int stride = sizeof(float);
fixed (float* native_values = &values)

@ -355,7 +355,7 @@ namespace ImGuiNET
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
public static extern uint igGetIDStr(byte* str_id);
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
public static extern uint igGetIDStrStr(byte* str_id_begin, byte* str_id_end);
public static extern uint igGetIDRange(byte* str_id_begin, byte* str_id_end);
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
public static extern uint igGetIDPtr(void* ptr_id);
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]

@ -7,7 +7,7 @@ namespace ImGuiNET
{
public unsafe partial struct ImGuiStorage
{
public ImVector/*<Pair>*/ Data;
public ImVector Data;
}
public unsafe partial struct ImGuiStoragePtr
{

@ -7,7 +7,7 @@ namespace ImGuiNET
{
public unsafe partial struct ImGuiTextBuffer
{
public ImVector/*<char>*/ Buf;
public ImVector Buf;
}
public unsafe partial struct ImGuiTextBufferPtr
{

@ -8,7 +8,7 @@ namespace ImGuiNET
public unsafe partial struct ImGuiTextFilter
{
public fixed byte InputBuf[256];
public ImVector/*<TextRange>*/ Filters;
public ImVector Filters;
public int CountGrep;
}
public unsafe partial struct ImGuiTextFilterPtr

Loading…
Cancel
Save