Skip to content

Commit 2a3ea35

Browse files
committed
Added bitfield support in the generator.
1 parent b978948 commit 2a3ea35

22 files changed

+207
-326
lines changed

Generator/Generator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="HexaGen.Legacy" Version="1.0.4" />
13+
<PackageReference Include="HexaGen.Legacy" Version="1.0.7" />
1414
<PackageReference Include="HexaGen.BuildSystems" Version="0.0.1-alpha" />
1515
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
1616
</ItemGroup>

Hexa.NET.ImGui.Backends.GLFW/Hexa.NET.ImGui.Backends.GLFW.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IsAotCompatible>true</IsAotCompatible>
1414

1515
<AssemblyVersion>1.0.12</AssemblyVersion>
16-
<PackageVersion>1.0.17.2</PackageVersion>
16+
<PackageVersion>1.0.17.3</PackageVersion>
1717
<Description>A .NET wrapper for the Dear ImGui (1.92.1) library backend GLFW.</Description>
1818
<PackageTags>ImGui Backends GLFW UI Immidate GUI Hexa HexaGen Source Generator C# .NET DotNet Sharp Windows macOS Android Bindings Wrapper Native</PackageTags>
1919
<Authors>Juna Meinhold</Authors>
@@ -31,7 +31,7 @@
3131
</PropertyGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="HexaGen.Runtime" Version="1.1.18" />
34+
<PackageReference Include="HexaGen.Runtime" Version="1.1.20" />
3535
</ItemGroup>
3636

3737
<ItemGroup>

Hexa.NET.ImGui.Backends.SDL2/Hexa.NET.ImGui.Backends.SDL2.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IsAotCompatible>true</IsAotCompatible>
1414

1515
<AssemblyVersion>1.0.12</AssemblyVersion>
16-
<PackageVersion>1.0.17.2</PackageVersion>
16+
<PackageVersion>1.0.17.3</PackageVersion>
1717
<Description>A .NET wrapper for the Dear ImGui (1.92.1) library backend SDL2.</Description>
1818
<PackageTags>ImGui Backends SDL2 UI Immidate GUI Hexa HexaGen Source Generator C# .NET DotNet Sharp Windows macOS Android Bindings Wrapper Native</PackageTags>
1919
<Authors>Juna Meinhold</Authors>
@@ -31,7 +31,7 @@
3131
</PropertyGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="HexaGen.Runtime" Version="1.1.18" />
34+
<PackageReference Include="HexaGen.Runtime" Version="1.1.20" />
3535
</ItemGroup>
3636

3737
<ItemGroup>

Hexa.NET.ImGui.Backends.SDL3/Hexa.NET.ImGui.Backends.SDL3.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IsAotCompatible>true</IsAotCompatible>
1414

1515
<AssemblyVersion>1.0.12</AssemblyVersion>
16-
<PackageVersion>1.0.17.2</PackageVersion>
16+
<PackageVersion>1.0.17.3</PackageVersion>
1717
<Description>A .NET wrapper for the Dear ImGui (1.92.1) library backend SDL3.</Description>
1818
<PackageTags>ImGui Backends SDL3 UI Immidate GUI Hexa HexaGen Source Generator C# .NET DotNet Sharp Windows macOS Android Bindings Wrapper Native</PackageTags>
1919
<Authors>Juna Meinhold</Authors>
@@ -31,7 +31,7 @@
3131
</PropertyGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="HexaGen.Runtime" Version="1.1.18" />
34+
<PackageReference Include="HexaGen.Runtime" Version="1.1.20" />
3535
</ItemGroup>
3636

3737
<ItemGroup>

Hexa.NET.ImGui.Backends/Hexa.NET.ImGui.Backends.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<IsAotCompatible>true</IsAotCompatible>
1414

1515
<AssemblyVersion>1.0.12</AssemblyVersion>
16-
<PackageVersion>1.0.17.2</PackageVersion>
16+
<PackageVersion>1.0.17.3</PackageVersion>
1717
<Description>A .NET wrapper for the Dear ImGui (1.92.1) library backends (Win32, Vulkan, OpenGL2, OpenGL3, D3D11, D3D12, OSX, Metal, Android).</Description>
1818
<PackageTags>ImGui Backends UI Immidate GUI Hexa HexaGen Source Generator C# .NET DotNet Sharp Windows macOS Android Bindings Wrapper Native</PackageTags>
1919
<Authors>Juna Meinhold</Authors>
@@ -31,7 +31,7 @@
3131
</PropertyGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="HexaGen.Runtime" Version="1.1.18" />
34+
<PackageReference Include="HexaGen.Runtime" Version="1.1.20" />
3535
</ItemGroup>
3636

3737
<ItemGroup>

Hexa.NET.ImGui/Generated/Structs/ImFontAtlasRectEntry.cs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,8 @@ namespace Hexa.NET.ImGui
2222
[StructLayout(LayoutKind.Sequential)]
2323
public partial struct ImFontAtlasRectEntry
2424
{
25-
/// <summary>
26-
/// To be documented.
27-
/// </summary>
28-
public int TargetIndex;
29-
30-
/// <summary>
31-
/// To be documented.
32-
/// </summary>
33-
public int Generation;
34-
35-
/// <summary>
36-
/// To be documented.
37-
/// </summary>
38-
public uint IsUsed;
39-
25+
public int RawBits0;
26+
public uint RawBits1;
4027

4128
/// <summary>
4229
/// To be documented.
@@ -49,6 +36,12 @@ public unsafe ImFontAtlasRectEntry(int targetIndex = default, int generation = d
4936
}
5037

5138

39+
public int TargetIndex { get => Bitfield.Get(RawBits0, 0, 20); set => Bitfield.Set(ref RawBits0, value, 0, 20); }
40+
41+
public int Generation { get => Bitfield.Get(RawBits0, 20, 10); set => Bitfield.Set(ref RawBits0, value, 20, 10); }
42+
43+
public uint IsUsed { get => Bitfield.Get(RawBits1, 0, 1); set => Bitfield.Set(ref RawBits1, value, 0, 1); }
44+
5245
}
5346

5447
/// <summary>
@@ -95,15 +88,15 @@ public unsafe struct ImFontAtlasRectEntryPtr : IEquatable<ImFontAtlasRectEntryPt
9588
/// <summary>
9689
/// To be documented.
9790
/// </summary>
98-
public ref int TargetIndex => ref Unsafe.AsRef<int>(&Handle->TargetIndex);
91+
public int TargetIndex { get => Handle->TargetIndex; set => Handle->TargetIndex = value; }
9992
/// <summary>
10093
/// To be documented.
10194
/// </summary>
102-
public ref int Generation => ref Unsafe.AsRef<int>(&Handle->Generation);
95+
public int Generation { get => Handle->Generation; set => Handle->Generation = value; }
10396
/// <summary>
10497
/// To be documented.
10598
/// </summary>
106-
public ref uint IsUsed => ref Unsafe.AsRef<uint>(&Handle->IsUsed);
99+
public uint IsUsed { get => Handle->IsUsed; set => Handle->IsUsed = value; }
107100
}
108101

109102
}

Hexa.NET.ImGui/Generated/Structs/ImFontBaked.cs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,7 @@ public partial struct ImFontBaked
6767
/// </summary>
6868
public float Descent;
6969

70-
/// <summary>
71-
/// To be documented.
72-
/// </summary>
73-
public uint MetricsTotalSurface;
74-
75-
/// <summary>
76-
/// To be documented.
77-
/// </summary>
78-
public uint WantDestroy;
79-
80-
/// <summary>
81-
/// To be documented.
82-
/// </summary>
83-
public uint LockLoadingFallback;
84-
70+
public uint RawBits0;
8571
/// <summary>
8672
/// To be documented.
8773
/// </summary>
@@ -127,6 +113,12 @@ public unsafe ImFontBaked(ImVector<float> indexAdvanceX = default, float fallbac
127113
}
128114

129115

116+
public uint MetricsTotalSurface { get => Bitfield.Get(RawBits0, 0, 26); set => Bitfield.Set(ref RawBits0, value, 0, 26); }
117+
118+
public uint WantDestroy { get => Bitfield.Get(RawBits0, 26, 1); set => Bitfield.Set(ref RawBits0, value, 26, 1); }
119+
120+
public uint LockLoadingFallback { get => Bitfield.Get(RawBits0, 27, 1); set => Bitfield.Set(ref RawBits0, value, 27, 1); }
121+
130122
/// <summary>
131123
/// To be documented.
132124
/// </summary>
@@ -279,15 +271,15 @@ public unsafe struct ImFontBakedPtr : IEquatable<ImFontBakedPtr>
279271
/// <summary>
280272
/// To be documented.
281273
/// </summary>
282-
public ref uint MetricsTotalSurface => ref Unsafe.AsRef<uint>(&Handle->MetricsTotalSurface);
274+
public uint MetricsTotalSurface { get => Handle->MetricsTotalSurface; set => Handle->MetricsTotalSurface = value; }
283275
/// <summary>
284276
/// To be documented.
285277
/// </summary>
286-
public ref uint WantDestroy => ref Unsafe.AsRef<uint>(&Handle->WantDestroy);
278+
public uint WantDestroy { get => Handle->WantDestroy; set => Handle->WantDestroy = value; }
287279
/// <summary>
288280
/// To be documented.
289281
/// </summary>
290-
public ref uint LockLoadingFallback => ref Unsafe.AsRef<uint>(&Handle->LockLoadingFallback);
282+
public uint LockLoadingFallback { get => Handle->LockLoadingFallback; set => Handle->LockLoadingFallback = value; }
291283
/// <summary>
292284
/// To be documented.
293285
/// </summary>

Hexa.NET.ImGui/Generated/Structs/ImFontGlyph.cs

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,7 @@ namespace Hexa.NET.ImGui
2222
[StructLayout(LayoutKind.Sequential)]
2323
public partial struct ImFontGlyph
2424
{
25-
/// <summary>
26-
/// To be documented.
27-
/// </summary>
28-
public uint Colored;
29-
30-
/// <summary>
31-
/// To be documented.
32-
/// </summary>
33-
public uint Visible;
34-
35-
/// <summary>
36-
/// To be documented.
37-
/// </summary>
38-
public uint SourceIdx;
39-
40-
/// <summary>
41-
/// To be documented.
42-
/// </summary>
43-
public uint Codepoint;
44-
25+
public uint RawBits0;
4526
/// <summary>
4627
/// To be documented.
4728
/// </summary>
@@ -115,6 +96,14 @@ public unsafe ImFontGlyph(uint colored = default, uint visible = default, uint s
11596
}
11697

11798

99+
public uint Colored { get => Bitfield.Get(RawBits0, 0, 1); set => Bitfield.Set(ref RawBits0, value, 0, 1); }
100+
101+
public uint Visible { get => Bitfield.Get(RawBits0, 1, 1); set => Bitfield.Set(ref RawBits0, value, 1, 1); }
102+
103+
public uint SourceIdx { get => Bitfield.Get(RawBits0, 2, 4); set => Bitfield.Set(ref RawBits0, value, 2, 4); }
104+
105+
public uint Codepoint { get => Bitfield.Get(RawBits0, 6, 26); set => Bitfield.Set(ref RawBits0, value, 6, 26); }
106+
118107
/// <summary>
119108
/// To be documented.
120109
/// </summary>
@@ -172,19 +161,19 @@ public unsafe struct ImFontGlyphPtr : IEquatable<ImFontGlyphPtr>
172161
/// <summary>
173162
/// To be documented.
174163
/// </summary>
175-
public ref uint Colored => ref Unsafe.AsRef<uint>(&Handle->Colored);
164+
public uint Colored { get => Handle->Colored; set => Handle->Colored = value; }
176165
/// <summary>
177166
/// To be documented.
178167
/// </summary>
179-
public ref uint Visible => ref Unsafe.AsRef<uint>(&Handle->Visible);
168+
public uint Visible { get => Handle->Visible; set => Handle->Visible = value; }
180169
/// <summary>
181170
/// To be documented.
182171
/// </summary>
183-
public ref uint SourceIdx => ref Unsafe.AsRef<uint>(&Handle->SourceIdx);
172+
public uint SourceIdx { get => Handle->SourceIdx; set => Handle->SourceIdx = value; }
184173
/// <summary>
185174
/// To be documented.
186175
/// </summary>
187-
public ref uint Codepoint => ref Unsafe.AsRef<uint>(&Handle->Codepoint);
176+
public uint Codepoint { get => Handle->Codepoint; set => Handle->Codepoint = value; }
188177
/// <summary>
189178
/// To be documented.
190179
/// </summary>

Hexa.NET.ImGui/Generated/Structs/ImGuiBoxSelectState.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ public partial struct ImGuiBoxSelectState
5252
/// </summary>
5353
public byte RequestClear;
5454

55-
/// <summary>
56-
/// To be documented.
57-
/// </summary>
58-
public int KeyMods;
59-
55+
public int RawBits0;
6056
/// <summary>
6157
/// To be documented.
6258
/// </summary>
@@ -121,6 +117,8 @@ public unsafe ImGuiBoxSelectState(uint id = default, bool isActive = default, bo
121117
}
122118

123119

120+
public int KeyMods { get => Bitfield.Get(RawBits0, 0, 16); set => Bitfield.Set(ref RawBits0, value, 0, 16); }
121+
124122
}
125123

126124
/// <summary>
@@ -191,7 +189,7 @@ public unsafe struct ImGuiBoxSelectStatePtr : IEquatable<ImGuiBoxSelectStatePtr>
191189
/// <summary>
192190
/// To be documented.
193191
/// </summary>
194-
public ref int KeyMods => ref Unsafe.AsRef<int>(&Handle->KeyMods);
192+
public int KeyMods { get => Handle->KeyMods; set => Handle->KeyMods = value; }
195193
/// <summary>
196194
/// To be documented.
197195
/// </summary>

Hexa.NET.ImGui/Generated/Structs/ImGuiContext.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,7 @@ public partial struct ImGuiContext
392392
/// </summary>
393393
public byte ActiveIdFromShortcut;
394394

395-
/// <summary>
396-
/// To be documented.
397-
/// </summary>
398-
public int ActiveIdMouseButton;
399-
395+
public int RawBits0;
400396
/// <summary>
401397
/// To be documented.
402398
/// </summary>
@@ -3253,6 +3249,8 @@ public unsafe ImGuiContext(bool initialized = default, ImGuiIO io = default, ImG
32533249
}
32543250

32553251

3252+
public int ActiveIdMouseButton { get => Bitfield.Get(RawBits0, 0, 8); set => Bitfield.Set(ref RawBits0, value, 0, 8); }
3253+
32563254
/// <summary>
32573255
/// To be documented.
32583256
/// </summary>
@@ -3618,7 +3616,7 @@ public unsafe Span<byte> ContextName
36183616
/// <summary>
36193617
/// To be documented.
36203618
/// </summary>
3621-
public ref int ActiveIdMouseButton => ref Unsafe.AsRef<int>(&Handle->ActiveIdMouseButton);
3619+
public int ActiveIdMouseButton { get => Handle->ActiveIdMouseButton; set => Handle->ActiveIdMouseButton = value; }
36223620
/// <summary>
36233621
/// To be documented.
36243622
/// </summary>

0 commit comments

Comments
 (0)