Overhaul the library with autogenerated code.

This change overhauls ImGui.NET to be almost entirely auto-generated.
It parses data files from cimgui, which contain pre-processed
information about Dear ImGui's structures, enums, and functions. The
code generator spits out identical C# types and functions, and also
generates a safe, friendly wrapper layer.

--- This is a combination of 22 commits. ---

Initial attempt at auto-generating the native bindings.

More WIP generator stuff.

Mostly-working bindings with some TODO's left.

More WIP stuff for safe wrappers and bindings.

WIP

Update cimgui definitions and even better safe wrappers.

Fix "nonUDT" overloads and add a "RangeAccessor" struct.

Remove constructor methods from wrapper types.

More WIP

Grab latest structs_and_enums.json file

Attempted improvements

Very good state, everything working.

Correct cimgui.dll (win-x64)

Rework how ref/out parameters are marshalled.

Remove problematic string begin/end parameter pairs.

Update native deps to 1.0.65, update ImGui.NET.csproj.

Fix sample program compilation.

Fix up XNA sample program with new binding changes.

Add several more manual ImGui overloads to ease the upgrade.

Add [Flags] to flags enums.

Change version to 1.65.0.

Capitalize "Dear ImGui".
internals
Eric Mellino 7 years ago
parent b5407eeba5
commit 94908a2890
  1. 3
      .gitignore
  2. BIN
      deps/cimgui/linux-x64/cimgui.so
  3. BIN
      deps/cimgui/osx-x64/cimgui.dylib
  4. BIN
      deps/cimgui/win-x64/cimgui.dll
  5. BIN
      deps/cimgui/win-x86/cimgui.dll
  6. 65
      download-native-deps.ps1
  7. 55
      src/CodeGenerator/CSharpCodeWriter.cs
  8. 17
      src/CodeGenerator/CodeGenerator.csproj
  9. 1119
      src/CodeGenerator/Program.cs
  10. 8
      src/CodeGenerator/Properties/launchSettings.json
  11. 13452
      src/CodeGenerator/definitions.json
  12. 2564
      src/CodeGenerator/structs_and_enums.json
  13. 2
      src/ImGui.NET.SampleProgram.XNA/DrawVertDeclaration.cs
  14. 137
      src/ImGui.NET.SampleProgram.XNA/ImGuiRenderer.cs
  15. 14
      src/ImGui.NET.SampleProgram.XNA/SampleGame.cs
  16. 184
      src/ImGui.NET.SampleProgram/ImGuiController.cs
  17. 59
      src/ImGui.NET.SampleProgram/MemoryEditor.cs
  18. 30
      src/ImGui.NET.SampleProgram/Program.cs
  19. 16
      src/ImGui.NET.sln
  20. 21
      src/ImGui.NET/Bool8.cs
  21. 29
      src/ImGui.NET/ColorEditFlags.cs
  22. 59
      src/ImGui.NET/ColorTarget.cs
  23. 27
      src/ImGui.NET/ComboFlags.cs
  24. 26
      src/ImGui.NET/Condition.cs
  25. 43
      src/ImGui.NET/DragDropFlags.cs
  26. 36
      src/ImGui.NET/DrawCmd.cs
  27. 26
      src/ImGui.NET/DrawData.cs
  28. 190
      src/ImGui.NET/DrawList.cs
  29. 17
      src/ImGui.NET/DrawVert.cs
  30. 10
      src/ImGui.NET/FocusedFlags.cs
  31. 95
      src/ImGui.NET/Font.cs
  32. 63
      src/ImGui.NET/FontAtlas.cs
  33. 87
      src/ImGui.NET/FontConfig.cs
  34. 41
      src/ImGui.NET/Generated/CustomRect.gen.cs
  35. 61
      src/ImGui.NET/Generated/GlyphRangesBuilder.gen.cs
  36. 42
      src/ImGui.NET/Generated/ImColor.gen.cs
  37. 24
      src/ImGui.NET/Generated/ImDrawChannel.gen.cs
  38. 30
      src/ImGui.NET/Generated/ImDrawCmd.gen.cs
  39. 16
      src/ImGui.NET/Generated/ImDrawCornerFlags.gen.cs
  40. 46
      src/ImGui.NET/Generated/ImDrawData.gen.cs
  41. 414
      src/ImGui.NET/Generated/ImDrawList.gen.cs
  42. 9
      src/ImGui.NET/Generated/ImDrawListFlags.gen.cs
  43. 26
      src/ImGui.NET/Generated/ImDrawVert.gen.cs
  44. 112
      src/ImGui.NET/Generated/ImFont.gen.cs
  45. 386
      src/ImGui.NET/Generated/ImFontAtlas.gen.cs
  46. 10
      src/ImGui.NET/Generated/ImFontAtlasFlags.gen.cs
  47. 56
      src/ImGui.NET/Generated/ImFontConfig.gen.cs
  48. 40
      src/ImGui.NET/Generated/ImFontGlyph.gen.cs
  49. 6907
      src/ImGui.NET/Generated/ImGui.gen.cs
  50. 10
      src/ImGui.NET/Generated/ImGuiBackendFlags.gen.cs
  51. 50
      src/ImGui.NET/Generated/ImGuiCol.gen.cs
  52. 32
      src/ImGui.NET/Generated/ImGuiColorEditFlags.gen.cs
  53. 16
      src/ImGui.NET/Generated/ImGuiComboFlags.gen.cs
  54. 10
      src/ImGui.NET/Generated/ImGuiCond.gen.cs
  55. 15
      src/ImGui.NET/Generated/ImGuiConfigFlags.gen.cs
  56. 13
      src/ImGui.NET/Generated/ImGuiDataType.gen.cs
  57. 12
      src/ImGui.NET/Generated/ImGuiDir.gen.cs
  58. 18
      src/ImGui.NET/Generated/ImGuiDragDropFlags.gen.cs
  59. 12
      src/ImGui.NET/Generated/ImGuiFocusedFlags.gen.cs
  60. 17
      src/ImGui.NET/Generated/ImGuiHoveredFlags.gen.cs
  61. 189
      src/ImGui.NET/Generated/ImGuiIO.gen.cs
  62. 65
      src/ImGui.NET/Generated/ImGuiInputTextCallbackData.gen.cs
  63. 28
      src/ImGui.NET/Generated/ImGuiInputTextFlags.gen.cs
  64. 28
      src/ImGui.NET/Generated/ImGuiKey.gen.cs
  65. 50
      src/ImGui.NET/Generated/ImGuiListClipper.gen.cs
  66. 16
      src/ImGui.NET/Generated/ImGuiMouseCursor.gen.cs
  67. 1012
      src/ImGui.NET/Generated/ImGuiNative.gen.cs
  68. 29
      src/ImGui.NET/Generated/ImGuiNavInput.gen.cs
  69. 22
      src/ImGui.NET/Generated/ImGuiOnceUponAFrame.gen.cs
  70. 62
      src/ImGui.NET/Generated/ImGuiPayload.gen.cs
  71. 12
      src/ImGui.NET/Generated/ImGuiSelectableFlags.gen.cs
  72. 28
      src/ImGui.NET/Generated/ImGuiSizeCallbackData.gen.cs
  73. 137
      src/ImGui.NET/Generated/ImGuiStorage.gen.cs
  74. 126
      src/ImGui.NET/Generated/ImGuiStyle.gen.cs
  75. 28
      src/ImGui.NET/Generated/ImGuiStyleVar.gen.cs
  76. 66
      src/ImGui.NET/Generated/ImGuiTextBuffer.gen.cs
  77. 90
      src/ImGui.NET/Generated/ImGuiTextFilter.gen.cs
  78. 21
      src/ImGui.NET/Generated/ImGuiTreeNodeFlags.gen.cs
  79. 33
      src/ImGui.NET/Generated/ImGuiWindowFlags.gen.cs
  80. 46
      src/ImGui.NET/Generated/TextRange.gen.cs
  81. 80
      src/ImGui.NET/GuiKey.cs
  82. 15
      src/ImGui.NET/HoveredFlags.cs
  83. 336
      src/ImGui.NET/IO.cs
  84. 7
      src/ImGui.NET/ImDrawData.Manual.cs
  85. 37
      src/ImGui.NET/ImDrawList.Manual.cs
  86. 122
      src/ImGui.NET/ImGui.Manual.cs
  87. 11
      src/ImGui.NET/ImGui.NET.csproj
  88. 1301
      src/ImGui.NET/ImGui.cs
  89. 1060
      src/ImGui.NET/ImGuiNative.cs
  90. 4
      src/ImGui.NET/ImGuiSizeCallback.cs
  91. 4
      src/ImGui.NET/ImGuiTextEditCallback.cs
  92. 26
      src/ImGui.NET/ImRect.cs
  93. 74
      src/ImGui.NET/ImVector.cs
  94. 82
      src/ImGui.NET/InputTextFlags.cs
  95. 22
      src/ImGui.NET/IntStructs.cs
  96. 34
      src/ImGui.NET/MouseCursorKind.cs
  97. 142
      src/ImGui.NET/NativeContext.cs
  98. 55
      src/ImGui.NET/NativeDrawContext.cs
  99. 354
      src/ImGui.NET/NativeIO.cs
  100. 19
      src/ImGui.NET/NativePayload.cs
  101. Some files were not shown because too many files have changed in this diff Show More

3
.gitignore vendored

@ -257,3 +257,6 @@ Session.vim
# Rider/Jetbrains IDEs
.idea
# download dir
deps/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,65 @@
param (
[Parameter(Mandatory=$true)][string]$tag
)
Write-Host Downloading native binaries from GitHub Releases...
if (Test-Path $PSScriptRoot\deps\cimgui\)
{
Remove-Item $PSScriptRoot\deps\cimgui\ -Force -Recurse | Out-Null
}
New-Item -ItemType Directory -Force -Path $PSScriptRoot\deps\cimgui\linux-x64 | Out-Null
New-Item -ItemType Directory -Force -Path $PSScriptRoot\deps\cimgui\osx-x64 | Out-Null
New-Item -ItemType Directory -Force -Path $PSScriptRoot\deps\cimgui\win-x86 | Out-Null
New-Item -ItemType Directory -Force -Path $PSScriptRoot\deps\cimgui\win-x64 | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$client = New-Object System.Net.WebClient
$client.DownloadFile(
"https://github.com/mellinoe/imgui.net-nativebuild/releases/download/$tag/cimgui.win-x86.dll",
"$PSScriptRoot/deps/cimgui/win-x86/cimgui.dll")
if( -not $? )
{
$msg = $Error[0].Exception.Message
Write-Error "Couldn't download x86 cimgui.dll. This most likely indicates the Windows native build failed."
exit
}
Write-Host "- cimgui.dll (x86)"
$client.DownloadFile(
"https://github.com/mellinoe/imgui.net-nativebuild/releases/download/$tag/cimgui.win-x64.dll",
"$PSScriptRoot/deps/cimgui/win-x64/$configuration/cimgui.dll")
if( -not $? )
{
$msg = $Error[0].Exception.Message
Write-Error "Couldn't download x64 cimgui.dll. This most likely indicates the Windows native build failed."
exit
}
Write-Host "- cimgui.dll (x64)"
$client.DownloadFile(
"https://github.com/mellinoe/imgui.net-nativebuild/releases/download/$tag/cimgui.so",
"$PSScriptRoot/deps/cimgui/linux-x64/cimgui.so")
if( -not $? )
{
$msg = $Error[0].Exception.Message
Write-Error "Couldn't download cimgui.so. This most likely indicates the Linux native build failed."
exit
}
Write-Host - cimgui.so
$client.DownloadFile(
"https://github.com/mellinoe/imgui.net-nativebuild/releases/download/$tag/cimgui.dylib",
"$PSScriptRoot/deps/cimgui/osx-x64/cimgui.dylib")
if( -not $? )
{
$msg = $Error[0].Exception.Message
Write-Error "Couldn't download cimgui.dylib. This most likely indicates the macOS native build failed."
exit
}
Write-Host - cimgui.dylib

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace CodeGenerator
{
class CSharpCodeWriter : IDisposable
{
private readonly StreamWriter _sw;
private int _indentLevel = 0;
public CSharpCodeWriter(string outputPath)
{
_sw = File.CreateText(outputPath);
}
public void Using(string ns)
{
WriteIndented($"using {ns};");
}
public void PushBlock(string blockHeader)
{
WriteIndented(blockHeader);
WriteIndented("{");
_indentLevel += 4;
}
public void PopBlock()
{
_indentLevel -= 4;
WriteIndented("}");
}
public void WriteLine(string text)
{
WriteIndented(text);
}
private void WriteIndented(string text)
{
for (int i = 0; i < _indentLevel; i++)
{
_sw.Write(' ');
}
_sw.WriteLine(text);
}
public void Dispose()
{
_sw.Dispose();
}
}
}

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="structs_and_enums.json" CopyToOutputDirectory="PreserveNewest" />
<Content Include="definitions.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,8 @@
{
"profiles": {
"CodeGenerator": {
"commandName": "Project",
"commandLineArgs": "E:\\projects\\imgui.net\\src\\ImGui.NET\\Generated"
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -10,7 +10,7 @@ namespace ImGuiNET.SampleProgram.XNA
static DrawVertDeclaration()
{
unsafe { Size = sizeof(DrawVert); }
unsafe { Size = sizeof(ImDrawVert); }
Declaration = new VertexDeclaration(
Size,

@ -41,6 +41,9 @@ namespace ImGuiNET.SampleProgram.XNA
public ImGuiRenderer(Game game)
{
var context = ImGui.CreateContext();
ImGui.SetCurrentContext(context);
_game = game ?? throw new ArgumentNullException(nameof(game));
_graphicsDevice = game.GraphicsDevice;
@ -64,18 +67,18 @@ namespace ImGuiNET.SampleProgram.XNA
/// <summary>
/// Creates a texture and loads the font data from ImGui. Should be called when the <see cref="GraphicsDevice" /> is initialized but before any rendering is done
/// </summary>
public virtual void RebuildFontAtlas()
public virtual unsafe void RebuildFontAtlas()
{
// Get font texture from ImGui
var io = ImGui.GetIO();
var texData = io.FontAtlas.GetTexDataAsRGBA32();
io.Fonts.GetTexDataAsRGBA32(out byte* pixelData, out int width, out int height, out int bytesPerPixel);
// Copy the data to a managed array
var pixels = new byte[texData.Width * texData.Height * texData.BytesPerPixel];
unsafe { Marshal.Copy(new IntPtr(texData.Pixels), pixels, 0, pixels.Length); }
var pixels = new byte[width * height * bytesPerPixel];
unsafe { Marshal.Copy(new IntPtr(pixelData), pixels, 0, pixels.Length); }
// Create and register the texture as an XNA texture
var tex2d = new Texture2D(_graphicsDevice, texData.Width, texData.Height, false, SurfaceFormat.Color);
var tex2d = new Texture2D(_graphicsDevice, width, height, false, SurfaceFormat.Color);
tex2d.SetData(pixels);
// Should a texture already have been build previously, unbind it first so it can be deallocated
@ -85,8 +88,8 @@ namespace ImGuiNET.SampleProgram.XNA
_fontTextureId = BindTexture(tex2d);
// Let ImGui know where to find the texture
io.FontAtlas.SetTexID(_fontTextureId.Value);
io.FontAtlas.ClearTexData(); // Clears CPU side texture data
io.Fonts.SetTexID(_fontTextureId.Value);
io.Fonts.ClearTexData(); // Clears CPU side texture data
}
/// <summary>
@ -142,32 +145,32 @@ namespace ImGuiNET.SampleProgram.XNA
{
var io = ImGui.GetIO();
_keys.Add(io.KeyMap[GuiKey.Tab] = (int)Keys.Tab);
_keys.Add(io.KeyMap[GuiKey.LeftArrow] = (int)Keys.Left);
_keys.Add(io.KeyMap[GuiKey.RightArrow] = (int)Keys.Right);
_keys.Add(io.KeyMap[GuiKey.UpArrow] = (int)Keys.Up);
_keys.Add(io.KeyMap[GuiKey.DownArrow] = (int)Keys.Down);
_keys.Add(io.KeyMap[GuiKey.PageUp] = (int)Keys.PageUp);
_keys.Add(io.KeyMap[GuiKey.PageDown] = (int)Keys.PageDown);
_keys.Add(io.KeyMap[GuiKey.Home] = (int)Keys.Home);
_keys.Add(io.KeyMap[GuiKey.End] = (int)Keys.End);
_keys.Add(io.KeyMap[GuiKey.Delete] = (int)Keys.Delete);
_keys.Add(io.KeyMap[GuiKey.Backspace] = (int)Keys.Back);
_keys.Add(io.KeyMap[GuiKey.Enter] = (int)Keys.Enter);
_keys.Add(io.KeyMap[GuiKey.Escape] = (int)Keys.Escape);
_keys.Add(io.KeyMap[GuiKey.A] = (int)Keys.A);
_keys.Add(io.KeyMap[GuiKey.C] = (int)Keys.C);
_keys.Add(io.KeyMap[GuiKey.V] = (int)Keys.V);
_keys.Add(io.KeyMap[GuiKey.X] = (int)Keys.X);
_keys.Add(io.KeyMap[GuiKey.Y] = (int)Keys.Y);
_keys.Add(io.KeyMap[GuiKey.Z] = (int)Keys.Z);
_keys.Add(io.KeyMap[(int)ImGuiKey.Tab] = (int)Keys.Tab);
_keys.Add(io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)Keys.Left);
_keys.Add(io.KeyMap[(int)ImGuiKey.RightArrow] = (int)Keys.Right);
_keys.Add(io.KeyMap[(int)ImGuiKey.UpArrow] = (int)Keys.Up);
_keys.Add(io.KeyMap[(int)ImGuiKey.DownArrow] = (int)Keys.Down);
_keys.Add(io.KeyMap[(int)ImGuiKey.PageUp] = (int)Keys.PageUp);
_keys.Add(io.KeyMap[(int)ImGuiKey.PageDown] = (int)Keys.PageDown);
_keys.Add(io.KeyMap[(int)ImGuiKey.Home] = (int)Keys.Home);
_keys.Add(io.KeyMap[(int)ImGuiKey.End] = (int)Keys.End);
_keys.Add(io.KeyMap[(int)ImGuiKey.Delete] = (int)Keys.Delete);
_keys.Add(io.KeyMap[(int)ImGuiKey.Backspace] = (int)Keys.Back);
_keys.Add(io.KeyMap[(int)ImGuiKey.Enter] = (int)Keys.Enter);
_keys.Add(io.KeyMap[(int)ImGuiKey.Escape] = (int)Keys.Escape);
_keys.Add(io.KeyMap[(int)ImGuiKey.A] = (int)Keys.A);
_keys.Add(io.KeyMap[(int)ImGuiKey.C] = (int)Keys.C);
_keys.Add(io.KeyMap[(int)ImGuiKey.V] = (int)Keys.V);
_keys.Add(io.KeyMap[(int)ImGuiKey.X] = (int)Keys.X);
_keys.Add(io.KeyMap[(int)ImGuiKey.Y] = (int)Keys.Y);
_keys.Add(io.KeyMap[(int)ImGuiKey.Z] = (int)Keys.Z);
// MonoGame-specific //////////////////////
_game.Window.TextInput += (s, a) =>
{
if (a.Character == '\t') return;
ImGui.AddInputCharacter(a.Character);
io.AddInputCharacter(a.Character);
};
///////////////////////////////////////////
@ -180,7 +183,7 @@ namespace ImGuiNET.SampleProgram.XNA
//};
///////////////////////////////////////////
ImGui.GetIO().FontAtlas.AddDefaultFont();
ImGui.GetIO().Fonts.AddFontDefault();
}
/// <summary>
@ -225,15 +228,15 @@ namespace ImGuiNET.SampleProgram.XNA
io.KeysDown[_keys[i]] = keyboard.IsKeyDown((Keys)_keys[i]);
}
io.ShiftPressed = keyboard.IsKeyDown(Keys.LeftShift) || keyboard.IsKeyDown(Keys.RightShift);
io.CtrlPressed = keyboard.IsKeyDown(Keys.LeftControl) || keyboard.IsKeyDown(Keys.RightControl);
io.AltPressed = keyboard.IsKeyDown(Keys.LeftAlt) || keyboard.IsKeyDown(Keys.RightAlt);
io.SuperPressed = keyboard.IsKeyDown(Keys.LeftWindows) || keyboard.IsKeyDown(Keys.RightWindows);
io.KeyShift = keyboard.IsKeyDown(Keys.LeftShift) || keyboard.IsKeyDown(Keys.RightShift);
io.KeyCtrl = keyboard.IsKeyDown(Keys.LeftControl) || keyboard.IsKeyDown(Keys.RightControl);
io.KeyAlt = keyboard.IsKeyDown(Keys.LeftAlt) || keyboard.IsKeyDown(Keys.RightAlt);
io.KeySuper = keyboard.IsKeyDown(Keys.LeftWindows) || keyboard.IsKeyDown(Keys.RightWindows);
io.DisplaySize = new System.Numerics.Vector2(_graphicsDevice.PresentationParameters.BackBufferWidth, _graphicsDevice.PresentationParameters.BackBufferHeight);
io.DisplayFramebufferScale = new System.Numerics.Vector2(1f, 1f);
io.MousePosition = new System.Numerics.Vector2(mouse.X, mouse.Y);
io.MousePos = new System.Numerics.Vector2(mouse.X, mouse.Y);
io.MouseDown[0] = mouse.LeftButton == ButtonState.Pressed;
io.MouseDown[1] = mouse.RightButton == ButtonState.Pressed;
@ -251,7 +254,7 @@ namespace ImGuiNET.SampleProgram.XNA
/// <summary>
/// Gets the geometry as set up by ImGui and sends it to the graphics device
/// </summary>
private unsafe void RenderDrawData(DrawData* drawData)
private void RenderDrawData(ImDrawDataPtr drawData)
{
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers
var lastViewport = _graphicsDevice.Viewport;
@ -263,7 +266,7 @@ namespace ImGuiNET.SampleProgram.XNA
_graphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
ImGui.ScaleClipRects(drawData, ImGui.GetIO().DisplayFramebufferScale);
drawData.ScaleClipRects(ImGui.GetIO().DisplayFramebufferScale);
// Setup projection
_graphicsDevice.Viewport = new Viewport(0, 0, _graphicsDevice.PresentationParameters.BackBufferWidth, _graphicsDevice.PresentationParameters.BackBufferHeight);
@ -277,23 +280,28 @@ namespace ImGuiNET.SampleProgram.XNA
_graphicsDevice.ScissorRectangle = lastScissorBox;
}
private unsafe void UpdateBuffers(DrawData* drawData)
private unsafe void UpdateBuffers(ImDrawDataPtr drawData)
{
if (drawData.TotalVtxCount == 0)
{
return;
}
// Expand buffers if we need more room
if (drawData->TotalVtxCount > _vertexBufferSize)
if (drawData.TotalVtxCount > _vertexBufferSize)
{
_vertexBuffer?.Dispose();
_vertexBufferSize = (int)(drawData->TotalVtxCount * 1.5f);
_vertexBufferSize = (int)(drawData.TotalVtxCount * 1.5f);
_vertexBuffer = new VertexBuffer(_graphicsDevice, DrawVertDeclaration.Declaration, _vertexBufferSize, BufferUsage.None);
_vertexData = new byte[_vertexBufferSize * DrawVertDeclaration.Size];
}
if (drawData->TotalIdxCount > _indexBufferSize)
if (drawData.TotalIdxCount > _indexBufferSize)
{
_indexBuffer?.Dispose();
_indexBufferSize = (int)(drawData->TotalIdxCount * 1.5f);
_indexBufferSize = (int)(drawData.TotalIdxCount * 1.5f);
_indexBuffer = new IndexBuffer(_graphicsDevice, IndexElementSize.SixteenBits, _indexBufferSize, BufferUsage.None);
_indexData = new byte[_indexBufferSize * sizeof(ushort)];
}
@ -302,27 +310,27 @@ namespace ImGuiNET.SampleProgram.XNA
int vtxOffset = 0;
int idxOffset = 0;
for (int n = 0; n < drawData->CmdListsCount; n++)
for (int n = 0; n < drawData.CmdListsCount; n++)
{
var cmdList = drawData->CmdLists[n];
ImDrawListPtr cmdList = drawData.CmdListsRange[n];
fixed (void* vtxDstPtr = &_vertexData[vtxOffset * DrawVertDeclaration.Size])
fixed (void* idxDstPtr = &_indexData[idxOffset * sizeof(ushort)])
{
Buffer.MemoryCopy(cmdList->VtxBuffer.Data, vtxDstPtr, _vertexData.Length, cmdList->VtxBuffer.Size * DrawVertDeclaration.Size);
Buffer.MemoryCopy(cmdList->IdxBuffer.Data, idxDstPtr, _indexData.Length, cmdList->IdxBuffer.Size * sizeof(ushort));
Buffer.MemoryCopy((void*)cmdList.VtxBuffer.Data, vtxDstPtr, _vertexData.Length, cmdList.VtxBuffer.Size * DrawVertDeclaration.Size);
Buffer.MemoryCopy((void*)cmdList.IdxBuffer.Data, idxDstPtr, _indexData.Length, cmdList.IdxBuffer.Size * sizeof(ushort));
}
vtxOffset += cmdList->VtxBuffer.Size;
idxOffset += cmdList->IdxBuffer.Size;
vtxOffset += cmdList.VtxBuffer.Size;
idxOffset += cmdList.IdxBuffer.Size;
}
// Copy the managed byte arrays to the gpu vertex- and index buffers
_vertexBuffer.SetData(_vertexData, 0, drawData->TotalVtxCount * DrawVertDeclaration.Size);
_indexBuffer.SetData(_indexData, 0, drawData->TotalIdxCount * sizeof(ushort));
_vertexBuffer.SetData(_vertexData, 0, drawData.TotalVtxCount * DrawVertDeclaration.Size);
_indexBuffer.SetData(_indexData, 0, drawData.TotalIdxCount * sizeof(ushort));
}
private unsafe void RenderCommandLists(DrawData* drawData)
private unsafe void RenderCommandLists(ImDrawDataPtr drawData)
{
_graphicsDevice.SetVertexBuffer(_vertexBuffer);
_graphicsDevice.Indices = _indexBuffer;
@ -330,24 +338,27 @@ namespace ImGuiNET.SampleProgram.XNA
int vtxOffset = 0;
int idxOffset = 0;
for (int n = 0; n < drawData->CmdListsCount; n++)
for (int n = 0; n < drawData.CmdListsCount; n++)
{
var cmdList = drawData->CmdLists[n];
ImDrawListPtr cmdList = drawData.CmdListsRange[n];
for (int cmdi = 0; cmdi < cmdList->CmdBuffer.Size; cmdi++)
for (int cmdi = 0; cmdi < cmdList.CmdBuffer.Size; cmdi++)
{
var drawCmd = &(((DrawCmd*)cmdList->CmdBuffer.Data)[cmdi]);
ImDrawCmdPtr drawCmd = cmdList.CmdBuffer[cmdi];
if (!_loadedTextures.ContainsKey(drawCmd->TextureId)) throw new InvalidOperationException($"Could not find a texture with id '{drawCmd->TextureId}', please check your bindings");
if (!_loadedTextures.ContainsKey(drawCmd.TextureId))
{
throw new InvalidOperationException($"Could not find a texture with id '{drawCmd.TextureId}', please check your bindings");
}
_graphicsDevice.ScissorRectangle = new Rectangle(
(int)drawCmd->ClipRect.X,
(int)drawCmd->ClipRect.Y,
(int)(drawCmd->ClipRect.Z - drawCmd->ClipRect.X),
(int)(drawCmd->ClipRect.W - drawCmd->ClipRect.Y)
(int)drawCmd.ClipRect.X,
(int)drawCmd.ClipRect.Y,
(int)(drawCmd.ClipRect.Z - drawCmd.ClipRect.X),
(int)(drawCmd.ClipRect.W - drawCmd.ClipRect.Y)
);
var effect = UpdateEffect(_loadedTextures[drawCmd->TextureId]);
var effect = UpdateEffect(_loadedTextures[drawCmd.TextureId]);
foreach (var pass in effect.CurrentTechnique.Passes)
{
@ -358,17 +369,17 @@ namespace ImGuiNET.SampleProgram.XNA
primitiveType: PrimitiveType.TriangleList,
baseVertex: vtxOffset,
minVertexIndex: 0,
numVertices: cmdList->VtxBuffer.Size,
numVertices: cmdList.VtxBuffer.Size,
startIndex: idxOffset,
primitiveCount: (int)drawCmd->ElemCount / 3
primitiveCount: (int)drawCmd.ElemCount / 3
);
#pragma warning restore CS0618
}
idxOffset += (int)drawCmd->ElemCount;
idxOffset += (int)drawCmd.ElemCount;
}
vtxOffset += cmdList->VtxBuffer.Size;
vtxOffset += cmdList.VtxBuffer.Size;
}
}

@ -78,13 +78,13 @@ namespace ImGuiNET.SampleProgram.XNA
// Tip: if we don't call ImGui.Begin()/ImGui.End() the widgets appears in a window automatically called "Debug"
{
ImGui.Text("Hello, world!");
ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, null, 1f);
ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, string.Empty, 1f);
ImGui.ColorEdit3("clear color", ref clear_color);
if (ImGui.Button("Test Window")) show_test_window = !show_test_window;
if (ImGui.Button("Another Window")) show_another_window = !show_another_window;
ImGui.Text(string.Format("Application average {0:F3} ms/frame ({1:F1} FPS)", 1000f / ImGui.GetIO().Framerate, ImGui.GetIO().Framerate));
ImGui.InputText("Text input", _textBuffer, 100, InputTextFlags.Default, null);
ImGui.InputText("Text input", _textBuffer, 100);
ImGui.Text("Texture sample");
ImGui.Image(_imGuiTexture, new Num.Vector2(300, 150), Num.Vector2.Zero, Num.Vector2.One, Num.Vector4.One, Num.Vector4.One); // Here, the previously loaded texture is used
@ -93,17 +93,17 @@ namespace ImGuiNET.SampleProgram.XNA
// 2. Show another simple window, this time using an explicit Begin/End pair
if (show_another_window)
{
ImGui.SetNextWindowSize(new Num.Vector2(200, 100), Condition.FirstUseEver);
ImGui.BeginWindow("Another Window", ref show_another_window, WindowFlags.Default);
ImGui.SetNextWindowSize(new Num.Vector2(200, 100), ImGuiCond.FirstUseEver);
ImGui.Begin("Another Window", ref show_another_window);
ImGui.Text("Hello");
ImGui.EndWindow();
ImGui.End();
}
// 3. Show the ImGui test window. Most of the sample code is in ImGui.ShowTestWindow()
if (show_test_window)
{
ImGui.SetNextWindowPos(new Num.Vector2(650, 20), Condition.FirstUseEver);
ImGuiNative.igShowDemoWindow(ref show_test_window);
ImGui.SetNextWindowPos(new Num.Vector2(650, 20), ImGuiCond.FirstUseEver);
ImGui.ShowDemoWindow(ref show_test_window);
}
}

@ -4,6 +4,7 @@ using System.Numerics;
using System.Reflection;
using System.IO;
using Veldrid;
using System.Runtime.CompilerServices;
namespace ImGuiNET
{
@ -34,6 +35,7 @@ namespace ImGuiNET
private bool _controlDown;
private bool _shiftDown;
private bool _altDown;
private bool _winKeyDown;
private int _windowWidth;
private int _windowHeight;
@ -49,7 +51,7 @@ namespace ImGuiNET
private int _lastAssignedID = 100;
/// <summary>
/// Constructs a new ImGuiRenderer.
/// Constructs a new ImGuiController.
/// </summary>
public ImGuiController(GraphicsDevice gd, OutputDescription outputDescription, int width, int height)
{
@ -57,10 +59,13 @@ namespace ImGuiNET
_windowWidth = width;
_windowHeight = height;
ImGui.GetIO().FontAtlas.AddDefaultFont();
IntPtr context = ImGui.CreateContext();
ImGui.SetCurrentContext(context);
ImGui.GetIO().Fonts.AddFontDefault();
CreateDeviceResources(gd, outputDescription);
SetOpenTKKeyMappings();
SetKeyMappings();
SetPerFrameImGuiData(1f / 60f);
@ -241,16 +246,17 @@ namespace ImGuiNET
/// </summary>
public unsafe void RecreateFontDeviceTexture(GraphicsDevice gd)
{
IO io = ImGui.GetIO();
ImGuiIOPtr io = ImGui.GetIO();
// Build
FontTextureData textureData = io.FontAtlas.GetTexDataAsRGBA32();
byte* pixels;
int width, height, bytesPerPixel;
io.Fonts.GetTexDataAsRGBA32(out pixels, out width, out height, out bytesPerPixel);
// Store our identifier
io.FontAtlas.SetTexID(_fontAtlasID);
io.Fonts.SetTexID(_fontAtlasID);
_fontTexture = gd.ResourceFactory.CreateTexture(TextureDescription.Texture2D(
(uint)textureData.Width,
(uint)textureData.Height,
(uint)width,
(uint)height,
1,
1,
PixelFormat.R8_G8_B8_A8_UNorm,
@ -258,19 +264,19 @@ namespace ImGuiNET
_fontTexture.Name = "ImGui.NET Font Texture";
gd.UpdateTexture(
_fontTexture,
(IntPtr)textureData.Pixels,
(uint)(textureData.BytesPerPixel * textureData.Width * textureData.Height),
(IntPtr)pixels,
(uint)(bytesPerPixel * width * height),
0,
0,
0,
(uint)textureData.Width,
(uint)textureData.Height,
(uint)width,
(uint)height,
1,
0,
0);
_fontTextureView = gd.ResourceFactory.CreateTextureView(_fontTexture);
io.FontAtlas.ClearTexData();
io.Fonts.ClearTexData();
}
/// <summary>
@ -279,7 +285,7 @@ namespace ImGuiNET
/// or index data has increased beyond the capacity of the existing buffers.
/// A <see cref="CommandList"/> is needed to submit drawing and resource update commands.
/// </summary>
public unsafe void Render(GraphicsDevice gd, CommandList cl)
public void Render(GraphicsDevice gd, CommandList cl)
{
if (_frameBegun)
{
@ -310,9 +316,9 @@ namespace ImGuiNET
/// Sets per-frame data based on the associated window.
/// This is called by Update(float).
/// </summary>
private unsafe void SetPerFrameImGuiData(float deltaSeconds)
private void SetPerFrameImGuiData(float deltaSeconds)
{
IO io = ImGui.GetIO();
ImGuiIOPtr io = ImGui.GetIO();
io.DisplaySize = new Vector2(
_windowWidth / _scaleFactor.X,
_windowHeight / _scaleFactor.Y);
@ -320,13 +326,13 @@ namespace ImGuiNET
io.DeltaTime = deltaSeconds; // DeltaTime is in seconds.
}
private unsafe void UpdateImGuiInput(InputSnapshot snapshot)
private void UpdateImGuiInput(InputSnapshot snapshot)
{
IO io = ImGui.GetIO();
var io = ImGui.GetIO();
Vector2 mousePosition = snapshot.MousePosition;
io.MousePosition = mousePosition;
io.MousePos = mousePosition;
io.MouseDown[0] = snapshot.IsMouseDown(MouseButton.Left);
io.MouseDown[1] = snapshot.IsMouseDown(MouseButton.Right);
io.MouseDown[2] = snapshot.IsMouseDown(MouseButton.Middle);
@ -334,13 +340,13 @@ namespace ImGuiNET
float delta = snapshot.WheelDelta;
io.MouseWheel = delta;
ImGui.GetIO().MouseWheel = delta;
io.MouseWheel = delta;
IReadOnlyList<char> keyCharPresses = snapshot.KeyCharPresses;
for (int i = 0; i < keyCharPresses.Count; i++)
{
char c = keyCharPresses[i];
ImGui.AddInputCharacter(c);
io.AddInputCharacter(c);
}
IReadOnlyList<KeyEvent> keyEvents = snapshot.KeyEvents;
@ -360,143 +366,145 @@ namespace ImGuiNET
{
_altDown = keyEvent.Down;
}
if (keyEvent.Key == Key.WinLeft)
{
_winKeyDown = keyEvent.Down;
}
}
io.CtrlPressed = _controlDown;
io.AltPressed = _altDown;
io.ShiftPressed = _shiftDown;
io.KeyCtrl = _controlDown;
io.KeyAlt = _altDown;
io.KeyShift = _shiftDown;
io.KeySuper = _winKeyDown;
}
private static unsafe void SetOpenTKKeyMappings()
private static void SetKeyMappings()
{
IO io = ImGui.GetIO();
io.KeyMap[GuiKey.Tab] = (int)Key.Tab;
io.KeyMap[GuiKey.LeftArrow] = (int)Key.Left;
io.KeyMap[GuiKey.RightArrow] = (int)Key.Right;
io.KeyMap[GuiKey.UpArrow] = (int)Key.Up;
io.KeyMap[GuiKey.DownArrow] = (int)Key.Down;
io.KeyMap[GuiKey.PageUp] = (int)Key.PageUp;
io.KeyMap[GuiKey.PageDown] = (int)Key.PageDown;
io.KeyMap[GuiKey.Home] = (int)Key.Home;
io.KeyMap[GuiKey.End] = (int)Key.End;
io.KeyMap[GuiKey.Delete] = (int)Key.Delete;
io.KeyMap[GuiKey.Backspace] = (int)Key.BackSpace;
io.KeyMap[GuiKey.Enter] = (int)Key.Enter;
io.KeyMap[GuiKey.Escape] = (int)Key.Escape;
io.KeyMap[GuiKey.A] = (int)Key.A;
io.KeyMap[GuiKey.C] = (int)Key.C;
io.KeyMap[GuiKey.V] = (int)Key.V;
io.KeyMap[GuiKey.X] = (int)Key.X;
io.KeyMap[GuiKey.Y] = (int)Key.Y;
io.KeyMap[GuiKey.Z] = (int)Key.Z;
ImGuiIOPtr io = ImGui.GetIO();
io.KeyMap[(int)ImGuiKey.Tab] = (int)Key.Tab;
io.KeyMap[(int)ImGuiKey.LeftArrow] = (int)Key.Left;
io.KeyMap[(int)ImGuiKey.RightArrow] = (int)Key.Right;
io.KeyMap[(int)ImGuiKey.UpArrow] = (int)Key.Up;
io.KeyMap[(int)ImGuiKey.DownArrow] = (int)Key.Down;
io.KeyMap[(int)ImGuiKey.PageUp] = (int)Key.PageUp;
io.KeyMap[(int)ImGuiKey.PageDown] = (int)Key.PageDown;
io.KeyMap[(int)ImGuiKey.Home] = (int)Key.Home;
io.KeyMap[(int)ImGuiKey.End] = (int)Key.End;
io.KeyMap[(int)ImGuiKey.Delete] = (int)Key.Delete;
io.KeyMap[(int)ImGuiKey.Backspace] = (int)Key.BackSpace;
io.KeyMap[(int)ImGuiKey.Enter] = (int)Key.Enter;
io.KeyMap[(int)ImGuiKey.Escape] = (int)Key.Escape;
io.KeyMap[(int)ImGuiKey.A] = (int)Key.A;
io.KeyMap[(int)ImGuiKey.C] = (int)Key.C;
io.KeyMap[(int)ImGuiKey.V] = (int)Key.V;
io.KeyMap[(int)ImGuiKey.X] = (int)Key.X;
io.KeyMap[(int)ImGuiKey.Y] = (int)Key.Y;
io.KeyMap[(int)ImGuiKey.Z] = (int)Key.Z;
}
private unsafe void RenderImDrawData(DrawData* draw_data, GraphicsDevice gd, CommandList cl)
private void RenderImDrawData(ImDrawDataPtr draw_data, GraphicsDevice gd, CommandList cl)
{
uint vertexOffsetInVertices = 0;
uint indexOffsetInElements = 0;
if (draw_data->CmdListsCount == 0)
if (draw_data.CmdListsCount == 0)
{
return;
}
uint totalVBSize = (uint)(draw_data->TotalVtxCount * sizeof(DrawVert));
uint totalVBSize = (uint)(draw_data.TotalVtxCount * Unsafe.SizeOf<ImDrawVert>());
if (totalVBSize > _vertexBuffer.SizeInBytes)
{
gd.DisposeWhenIdle(_vertexBuffer);
_vertexBuffer = gd.ResourceFactory.CreateBuffer(new BufferDescription((uint)(totalVBSize * 1.5f), BufferUsage.VertexBuffer | BufferUsage.Dynamic));
}
uint totalIBSize = (uint)(draw_data->TotalIdxCount * sizeof(ushort));
uint totalIBSize = (uint)(draw_data.TotalIdxCount * sizeof(ushort));
if (totalIBSize > _indexBuffer.SizeInBytes)
{
gd.DisposeWhenIdle(_indexBuffer);
_indexBuffer = gd.ResourceFactory.CreateBuffer(new BufferDescription((uint)(totalIBSize * 1.5f), BufferUsage.IndexBuffer | BufferUsage.Dynamic));
}
for (int i = 0; i < draw_data->CmdListsCount; i++)
for (int i = 0; i < draw_data.CmdListsCount; i++)
{
NativeDrawList* cmd_list = draw_data->CmdLists[i];
ImDrawListPtr cmd_list = draw_data.CmdListsRange[i];
cl.UpdateBuffer(
_vertexBuffer,
vertexOffsetInVertices * (uint)sizeof(DrawVert),
(IntPtr)cmd_list->VtxBuffer.Data,
(uint)(cmd_list->VtxBuffer.Size * sizeof(DrawVert)));
vertexOffsetInVertices * (uint)Unsafe.SizeOf<ImDrawVert>(),
cmd_list.VtxBuffer.Data,
(uint)(cmd_list.VtxBuffer.Size * Unsafe.SizeOf<ImDrawVert>()));
cl.UpdateBuffer(
_indexBuffer,
indexOffsetInElements * (uint)sizeof(ushort),
(IntPtr)cmd_list->IdxBuffer.Data,
(uint)(cmd_list->IdxBuffer.Size * sizeof(ushort)));
indexOffsetInElements * sizeof(ushort),
cmd_list.IdxBuffer.Data,
(uint)(cmd_list.IdxBuffer.Size * sizeof(ushort)));
vertexOffsetInVertices += (uint)cmd_list->VtxBuffer.Size;
indexOffsetInElements += (uint)cmd_list->IdxBuffer.Size;
vertexOffsetInVertices += (uint)cmd_list.VtxBuffer.Size;
indexOffsetInElements += (uint)cmd_list.IdxBuffer.Size;
}
// Setup orthographic projection matrix into our constant buffer
{
IO io = ImGui.GetIO();
ImGuiIOPtr io = ImGui.GetIO();
Matrix4x4 mvp = Matrix4x4.CreateOrthographicOffCenter(
0f,
io.DisplaySize.X,
io.DisplaySize.Y,
0.0f,
-1.0f,
1.0f);
Matrix4x4 mvp = Matrix4x4.CreateOrthographicOffCenter(
0f,
io.DisplaySize.X,
io.DisplaySize.Y,
0.0f,
-1.0f,
1.0f);
_gd.UpdateBuffer(_projMatrixBuffer, 0, ref mvp);
}
_gd.UpdateBuffer(_projMatrixBuffer, 0, ref mvp);
cl.SetVertexBuffer(0, _vertexBuffer);
cl.SetIndexBuffer(_indexBuffer, IndexFormat.UInt16);
cl.SetPipeline(_pipeline);
cl.SetGraphicsResourceSet(0, _mainResourceSet);
ImGui.ScaleClipRects(draw_data, ImGui.GetIO().DisplayFramebufferScale);
draw_data.ScaleClipRects(io.DisplayFramebufferScale);
// Render command lists
int vtx_offset = 0;
int idx_offset = 0;
for (int n = 0; n < draw_data->CmdListsCount; n++)
for (int n = 0; n < draw_data.CmdListsCount; n++)
{
NativeDrawList* cmd_list = draw_data->CmdLists[n];
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
ImDrawListPtr cmd_list = draw_data.CmdListsRange[n];
for (int cmd_i = 0; cmd_i < cmd_list.CmdBuffer.Size; cmd_i++)
{
DrawCmd* pcmd = &(((DrawCmd*)cmd_list->CmdBuffer.Data)[cmd_i]);
if (pcmd->UserCallback != IntPtr.Zero)
ImDrawCmdPtr pcmd = cmd_list.CmdBuffer[cmd_i];
if (pcmd.UserCallback != IntPtr.Zero)
{
throw new NotImplementedException();
}
else
{
if (pcmd->TextureId != IntPtr.Zero)
if (pcmd.TextureId != IntPtr.Zero)
{
if (pcmd->TextureId == _fontAtlasID)
if (pcmd.TextureId == _fontAtlasID)
{
cl.SetGraphicsResourceSet(1, _fontTextureResourceSet);
}
else
{
cl.SetGraphicsResourceSet(1, GetImageResourceSet(pcmd->TextureId));
cl.SetGraphicsResourceSet(1, GetImageResourceSet(pcmd.TextureId));
}
}
cl.SetScissorRect(
0,
(uint)pcmd->ClipRect.X,
(uint)pcmd->ClipRect.Y,
(uint)(pcmd->ClipRect.Z - pcmd->ClipRect.X),
(uint)(pcmd->ClipRect.W - pcmd->ClipRect.Y));
(uint)pcmd.ClipRect.X,
(uint)pcmd.ClipRect.Y,
(uint)(pcmd.ClipRect.Z - pcmd.ClipRect.X),
(uint)(pcmd.ClipRect.W - pcmd.ClipRect.Y));
cl.DrawIndexed(pcmd->ElemCount, 1, (uint)idx_offset, vtx_offset, 0);
cl.DrawIndexed(pcmd.ElemCount, 1, (uint)idx_offset, vtx_offset, 0);
}
idx_offset += (int)pcmd->ElemCount;
idx_offset += (int)pcmd.ElemCount;
}
vtx_offset += cmd_list->VtxBuffer.Size;
vtx_offset += cmd_list.VtxBuffer.Size;
}
}

@ -57,10 +57,10 @@ namespace ImGuiNET
public unsafe void Draw(string title, byte[] mem_data, int mem_size, int base_display_addr = 0)
{
ImGui.SetNextWindowSize(new Vector2(500, 350), Condition.FirstUseEver);
if (!ImGui.BeginWindow(title))
ImGui.SetNextWindowSize(new Vector2(500, 350), ImGuiCond.FirstUseEver);
if (!ImGui.Begin(title))
{
ImGui.EndWindow();
ImGui.End();
return;
}
@ -70,17 +70,17 @@ namespace ImGuiNET
ImGuiNative.igSetNextWindowContentSize(new Vector2(0.0f, line_total_count * line_height));
ImGui.BeginChild("##scrolling", new Vector2(0, -ImGuiNative.igGetFrameHeightWithSpacing()), false, 0);
ImGui.PushStyleVar(StyleVar.FramePadding, new Vector2(0, 0));
ImGui.PushStyleVar(StyleVar.ItemSpacing, new Vector2(0, 0));
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(0, 0));
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
int addr_digits_count = 0;
for (int n = base_display_addr + mem_size - 1; n > 0; n >>= 4)
addr_digits_count++;
float glyph_width = ImGui.GetTextSize("F").X;
float glyph_width = ImGui.CalcTextSize("F").X;
float cell_width = glyph_width * 3; // "FF " we include trailing space in the width to easily catch clicks everywhere
var clipper = new ImGuiListClipper(line_total_count, line_height);
var clipper = new ImGuiListClipper2(line_total_count, line_height);
int visible_start_addr = clipper.DisplayStart * Rows;
int visible_end_addr = clipper.DisplayEnd * Rows;
@ -93,10 +93,10 @@ namespace ImGuiNET
if (DataEditingAddr != -1)
{
if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(GuiKey.UpArrow)) && DataEditingAddr >= Rows) { DataEditingAddr -= Rows; DataEditingTakeFocus = true; }
else if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(GuiKey.DownArrow)) && DataEditingAddr < mem_size - Rows) { DataEditingAddr += Rows; DataEditingTakeFocus = true; }
else if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(GuiKey.LeftArrow)) && DataEditingAddr > 0) { DataEditingAddr -= 1; DataEditingTakeFocus = true; }
else if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(GuiKey.RightArrow)) && DataEditingAddr < mem_size - 1) { DataEditingAddr += 1; DataEditingTakeFocus = true; }
if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(ImGuiKey.UpArrow)) && DataEditingAddr >= Rows) { DataEditingAddr -= Rows; DataEditingTakeFocus = true; }
else if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(ImGuiKey.DownArrow)) && DataEditingAddr < mem_size - Rows) { DataEditingAddr += Rows; DataEditingTakeFocus = true; }
else if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(ImGuiKey.LeftArrow)) && DataEditingAddr > 0) { DataEditingAddr -= 1; DataEditingTakeFocus = true; }
else if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(ImGuiKey.RightArrow)) && DataEditingAddr < mem_size - 1) { DataEditingAddr += 1; DataEditingTakeFocus = true; }
}
if ((DataEditingAddr / Rows) != (data_editing_addr_backup / Rows))
{
@ -125,10 +125,11 @@ namespace ImGuiNET
ImGui.PushID(addr);
// FIXME: We should have a way to retrieve the text edit cursor position more easily in the API, this is rather tedious.
TextEditCallback callback = (data) =>
ImGuiInputTextCallback callback = (data) =>
{
int* p_cursor_pos = (int*)data->UserData;
if (!data->HasSelection())
if (ImGuiNative.ImGuiInputTextCallbackData_HasSelection(data) == 0)
*p_cursor_pos = data->CursorPos;
return 0;
};
@ -140,12 +141,13 @@ namespace ImGuiNET
ReplaceChars(DataInput, FixedHex(mem_data[addr], 2));
ReplaceChars(AddrInput, FixedHex(base_display_addr + addr, addr_digits_count));
}
ImGui.PushItemWidth(ImGui.GetTextSize("FF").X);
ImGui.PushItemWidth(ImGui.CalcTextSize("FF").X);
var flags = ImGuiInputTextFlags.CharsHexadecimal | ImGuiInputTextFlags.EnterReturnsTrue | ImGuiInputTextFlags.AutoSelectAll | ImGuiInputTextFlags.NoHorizontalScroll | ImGuiInputTextFlags.AlwaysInsertMode | ImGuiInputTextFlags.CallbackAlways;
var flags = InputTextFlags.CharsHexadecimal | InputTextFlags.EnterReturnsTrue | InputTextFlags.AutoSelectAll | InputTextFlags.NoHorizontalScroll | InputTextFlags.AlwaysInsertMode | InputTextFlags.CallbackAlways;
if (ImGui.InputText("##data", DataInput, 32, flags, callback, new IntPtr(&cursor_pos)))
if (ImGui.InputText("##data", DataInput, 32, flags, callback, &cursor_pos))
data_write = data_next = true;
else if (!DataEditingTakeFocus && !ImGui.IsLastItemActive())
else if (!DataEditingTakeFocus && !ImGui.IsItemActive())
DataEditingAddr = -1;
DataEditingTakeFocus = false;
@ -163,7 +165,7 @@ namespace ImGuiNET
else
{
ImGui.Text(FixedHex(mem_data[addr], 2));
if (AllowEdits && ImGui.IsItemHovered(HoveredFlags.Default) && ImGui.IsMouseClicked(0))
if (AllowEdits && ImGui.IsItemHovered() && ImGui.IsMouseClicked(0))
{
DataEditingTakeFocus = true;
DataEditingAddr = addr;
@ -200,7 +202,7 @@ namespace ImGuiNET
ImGuiNative.igAlignTextToFramePadding();
ImGui.PushItemWidth(50);
ImGuiNative.igPushAllowKeyboardFocus(false);
ImGui.PushAllowKeyboardFocus(true);
int rows_backup = Rows;
if (ImGui.DragInt("##rows", ref Rows, 0.2f, 4, 32, "%.0f rows"))
{
@ -209,14 +211,14 @@ namespace ImGuiNET
new_window_size.X += (Rows - rows_backup) * (cell_width + glyph_width);
ImGui.SetWindowSize(new_window_size);
}
ImGuiNative.igPopAllowKeyboardFocus();
ImGui.PopAllowKeyboardFocus();
ImGui.PopItemWidth();
ImGui.SameLine();
ImGui.Text(string.Format(" Range {0}..{1} ", FixedHex(base_display_addr, addr_digits_count),
FixedHex(base_display_addr + mem_size - 1, addr_digits_count)));
ImGui.SameLine();
ImGui.PushItemWidth(70);
if (ImGui.InputText("##addr", AddrInput, 32, InputTextFlags.CharsHexadecimal | InputTextFlags.EnterReturnsTrue, null))
if (ImGui.InputText("##addr", AddrInput, 32, ImGuiInputTextFlags.CharsHexadecimal | ImGuiInputTextFlags.EnterReturnsTrue, null))
{
int goto_addr;
if (TryHexParse(AddrInput, out goto_addr))
@ -225,7 +227,7 @@ namespace ImGuiNET
if (goto_addr >= 0 && goto_addr < mem_size)
{
ImGui.BeginChild("##scrolling");
ImGuiNative.igSetScrollFromPosY(ImGui.GetCursorStartPos().Y + (goto_addr / Rows) * ImGuiNative.igGetTextLineHeight());
ImGui.SetScrollFromPosY(ImGui.GetCursorStartPos().Y + (goto_addr / Rows) * ImGuiNative.igGetTextLineHeight());
ImGui.EndChild();
DataEditingAddr = goto_addr;
DataEditingTakeFocus = true;
@ -234,25 +236,25 @@ namespace ImGuiNET
}
ImGui.PopItemWidth();
ImGui.EndWindow();
ImGui.End();
}
}
//Not a proper translation, because ImGuiListClipper uses imgui's internal api.
//Thus SetCursorPosYAndSetupDummyPrevLine isn't reimplemented, but SetCursorPosY + SetNextWindowContentSize seems to be working well instead.
//TODO expose clipper through newer cimgui version
internal class ImGuiListClipper
internal class ImGuiListClipper2
{
public float StartPosY;
public float ItemsHeight;
public int ItemsCount, StepNo, DisplayStart, DisplayEnd;
public ImGuiListClipper(int items_count = -1, float items_height = -1.0f)
public ImGuiListClipper2(int items_count = -1, float items_height = -1.0f)
{
Begin(items_count, items_height);
}
public void Begin(int count, float items_height = -1.0f)
public unsafe void Begin(int count, float items_height = -1.0f)
{
StartPosY = ImGuiNative.igGetCursorPosY();
ItemsHeight = items_height;
@ -261,7 +263,10 @@ namespace ImGuiNET
DisplayEnd = DisplayStart = -1;
if (ItemsHeight > 0.0f)
{
ImGui.CalcListClipping(ItemsCount, ItemsHeight, ref DisplayStart, ref DisplayEnd); // calculate how many to clip/display
int dispStart, dispEnd;
ImGuiNative.igCalcListClipping(ItemsCount, ItemsHeight, &dispStart, &dispEnd);
DisplayStart = dispStart;
DisplayEnd = dispEnd;
if (DisplayStart > 0)
//SetCursorPosYAndSetupDummyPrevLine(StartPosY + DisplayStart * ItemsHeight, ItemsHeight); // advance cursor
ImGuiNative.igSetCursorPosY(StartPosY + DisplayStart * ItemsHeight);

@ -5,6 +5,8 @@ using Veldrid;
using Veldrid.Sdl2;
using Veldrid.StartupUtilities;
using static ImGuiNET.ImGuiNative;
namespace ImGuiNET
{
class Program
@ -18,12 +20,15 @@ namespace ImGuiNET
// UI state
private static float _f = 0.0f;
private static int _counter = 0;
private static int _dragInt = 0;
private static Vector3 _clearColor = new Vector3(0.45f, 0.55f, 0.6f);
private static bool _showDemoWindow = true;
private static bool _showAnotherWindow = false;
private static bool _showMemoryEditor = false;
private static byte[] _memoryEditorData;
static void SetThing(out float i, float val) { i = val; }
static void Main(string[] args)
{
// Create window, GraphicsDevice, and all resources necessary for the demo.
@ -69,7 +74,7 @@ namespace ImGuiNET
_gd.Dispose();
}
private static void SubmitUI()
private static unsafe void SubmitUI()
{
// Demo code adapted from the official Dear ImGui demo program:
// https://github.com/ocornut/imgui/blob/master/examples/example_win32_directx11/main.cpp#L172
@ -79,28 +84,32 @@ namespace ImGuiNET
{
ImGui.Text("Hello, world!"); // Display some text (you can use a format string too)
ImGui.SliderFloat("float", ref _f, 0, 1, _f.ToString("0.000"), 1); // Edit 1 float using a slider from 0.0f to 1.0f
ImGui.ColorEdit3("clear color", ref _clearColor); // Edit 3 floats representing a color
//ImGui.ColorEdit3("clear color", ref _clearColor); // Edit 3 floats representing a color
ImGui.Text($"Mouse position: {ImGui.GetMousePos()}");
ImGui.Checkbox("Demo Window", ref _showDemoWindow); // Edit bools storing our windows open/close state
ImGui.Checkbox("Another Window", ref _showAnotherWindow);
ImGui.Checkbox("Memory Editor", ref _showMemoryEditor);
if (ImGui.Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated)
_counter++;
ImGui.SameLine();
ImGui.SameLine(0, -1);
ImGui.Text($"counter = {_counter}");
ImGui.Text($"Application average {1000.0f / ImGui.GetIO().Framerate:0.##} ms/frame ({ImGui.GetIO().Framerate:0.#} FPS)");
ImGui.DragInt("Draggable Int", ref _dragInt);
float framerate = ImGui.GetIO().Framerate;
ImGui.Text($"Application average {1000.0f / framerate:0.##} ms/frame ({framerate:0.#} FPS)");
}
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
if (_showAnotherWindow)
{
ImGui.BeginWindow("Another Window", ref _showAnotherWindow, WindowFlags.Default);
ImGui.Begin("Another Window", ref _showAnotherWindow);
ImGui.Text("Hello from another window!");
if (ImGui.Button("Close Me"))
_showAnotherWindow = false;
ImGui.EndWindow();
ImGui.End();
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui.ShowDemoWindow(). Read its code to learn more about Dear ImGui!
@ -108,10 +117,13 @@ namespace ImGuiNET
{
// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway.
// Here we just want to make the demo initial state a bit more friendly!
ImGui.SetNextWindowPos(new Vector2(650, 20), Condition.FirstUseEver);
ImGuiNative.igShowDemoWindow(ref _showDemoWindow);
ImGui.SetNextWindowPos(new Vector2(650, 20), ImGuiCond.FirstUseEver);
ImGui.ShowDemoWindow(ref _showDemoWindow);
}
ImGuiIOPtr io = ImGui.GetIO();
SetThing(out io.DeltaTime, 2f);
if (_showMemoryEditor)
{
_memoryEditor.Draw("Memory Editor", _memoryEditorData, _memoryEditorData.Length);

@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
@ -8,6 +8,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImGui.NET.SampleProgram", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImGui.NET.SampleProgram.XNA", "ImGui.NET.SampleProgram.XNA\ImGui.NET.SampleProgram.XNA.csproj", "{3024336E-9A19-475F-A95D-60A60C0B1C0D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerator", "CodeGenerator\CodeGenerator.csproj", "{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -54,6 +56,18 @@ Global
{3024336E-9A19-475F-A95D-60A60C0B1C0D}.Release|x64.Build.0 = Release|Any CPU
{3024336E-9A19-475F-A95D-60A60C0B1C0D}.Release|x86.ActiveCfg = Release|Any CPU
{3024336E-9A19-475F-A95D-60A60C0B1C0D}.Release|x86.Build.0 = Release|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Debug|x64.ActiveCfg = Debug|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Debug|x64.Build.0 = Debug|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Debug|x86.ActiveCfg = Debug|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Debug|x86.Build.0 = Debug|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Release|Any CPU.Build.0 = Release|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Release|x64.ActiveCfg = Release|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Release|x64.Build.0 = Release|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Release|x86.ActiveCfg = Release|Any CPU
{62A4CFE3-C5F5-45F5-AD18-3F7E6739BD09}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,21 @@
namespace ImGuiNET
{
public struct Bool8
{
public readonly byte Value;
public static implicit operator bool(Bool8 b8) => b8.Value != 0;
public static implicit operator Bool8(bool b) => new Bool8(b);
public Bool8(bool value)
{
Value = value ? (byte)1 : (byte)0;
}
public Bool8(byte value)
{
Value = value;
}
public override string ToString() => string.Format("{0} [{1}]", (bool)this, Value);
}
}

@ -1,29 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// Enumeration for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
/// </summary>
public enum ColorEditFlags : int
{
Default = 0,
NoAlpha = 1 << 1,
NoPicker = 1 << 2,
NoOptions = 1 << 3,
NoSmallPreview = 1 << 4,
NoInputs = 1 << 5,
NoTooltip = 1 << 6,
NoLabel = 1 << 7,
NoSidePreview = 1 << 8,
AlphaBar = 1 << 9,
AlphaPreview = 1 << 10,
AlphaPreviewHalf = 1 << 11,
HDR = 1 << 12,
RGB = 1 << 13,
HSV = 1 << 14,
HEX = 1 << 15,
Uint8 = 1 << 16,
Float = 1 << 17,
PickerHueBar = 1 << 18,
PickerHueWheel = 1 << 19,
}
}

@ -1,59 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// Enumeration for PushStyleColor() / PopStyleColor()
/// </summary>
public enum ColorTarget
{
Text,
TextDisabled,
WindowBg,
ChildBg,
PopupBg,
Border,
BorderShadow,
/// <summary>
/// Background of checkbox, radio button, plot, slider, text input
/// </summary>
FrameBg,
FrameBgHovered,
FrameBgActive,
TitleBg,
TitleBgCollapsed,
TitleBgActive,
MenuBarBg,
ScrollbarBg,
ScrollbarGrab,
ScrollbarGrabHovered,
ScrollbarGrabActive,
CheckMark,
SliderGrab,
SliderGrabActive,
Button,
ButtonHovered,
ButtonActive,
Header,
HeaderHovered,
HeaderActive,
Separator,
SeparatorHovered,
SeparatorActive,
ResizeGrip,
ResizeGripHovered,
ResizeGripActive,
CloseButton,
CloseButtonHovered,
CloseButtonActive,
PlotLines,
PlotLinesHovered,
PlotHistogram,
PlotHistogramHovered,
TextSelectedBg,
/// <summary>
/// darken entire screen when a modal window is active
/// </summary>
ModalWindowDarkening,
DragDropTarget,
Count,
};
}

@ -1,27 +0,0 @@
namespace ImGuiNET
{
public enum ComboFlags
{
/// <summary>
/// Align the popup toward the left by default
/// </summary>
PopupAlignLeft = 1 << 0,
/// <summary>
/// Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo()
/// </summary>
HeightSmall = 1 << 1,
/// <summary>
/// Max ~8 items visible (default)
/// </summary>
HeightRegular = 1 << 2,
/// <summary>
/// Max ~20 items visible
/// </summary>
HeightLarge = 1 << 3,
/// <summary>
/// As many fitting items as possible
/// </summary>
HeightLargest = 1 << 4,
HeightMask_ = HeightSmall | HeightRegular | HeightLarge | HeightLargest
}
}

@ -1,26 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions.
/// All those functions treat 0 as a shortcut to Always.
/// </summary>
public enum Condition
{
/// <summary>
/// Set the variable.
/// </summary>
Always = 1 << 0,
/// <summary>
/// Only set the variable on the first call per runtime session
/// </summary>
Once = 1 << 1,
/// <summary>
/// Only set the variable if the window doesn't exist in the .ini file
/// </summary>
FirstUseEver = 1 << 2,
/// <summary>
/// Only set the variable if the window is appearing after being inactive (or the first time)
/// </summary>
Appearing = 1 << 3
}
}

@ -1,43 +0,0 @@
namespace ImGuiNET
{
public enum DragDropFlags
{
// BeginDragDropSource() flags
/// <summary>
/// By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior.
/// </summary>
SourceNoPreviewTooltip = 1 << 0,
/// <summary>
/// By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item.
/// </summary>
SourceNoDisableHover = 1 << 1,
/// <summary>
/// Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
/// </summary>
SourceNoHoldToOpenOthers = 1 << 2,
/// <summary>
/// Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
/// </summary>
SourceAllowNullID = 1 << 3,
/// <summary>
/// External source (from outside of imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
/// </summary>
SourceExtern = 1 << 4,
// AcceptDragDropPayload() flags
/// <summary>
/// AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
/// </summary>
AcceptBeforeDelivery = 1 << 10,
/// <summary>
/// Do not draw the default highlight rectangle when hovering over target.
/// </summary>
AcceptNoDrawDefaultRect = 1 << 11,
/// <summary>
/// For peeking ahead and inspecting the payload before delivery.
/// </summary>
AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect
}
}

@ -1,36 +0,0 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
/// <summary>
/// Typically, 1 command = 1 gpu draw call (unless command is a callback)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct DrawCmd
{
/// <summary>
/// Number of indices (multiple of 3) to be rendered as triangles.
/// Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].
/// </summary>
public uint ElemCount;
/// <summary>
/// Clipping rectangle (x1, y1, x2, y2)
/// </summary>
public Vector4 ClipRect;
/// <summary>
/// User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions.
/// Ignore if never using images or multiple fonts atlas.
/// </summary>
public IntPtr TextureId;
/// <summary>
/// If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.
/// </summary>
public IntPtr UserCallback;
/// <summary>
/// The draw callback code can access this.
/// </summary>
public IntPtr UserCallbackData;
};
}

@ -1,26 +0,0 @@
using System.Runtime.InteropServices;
namespace ImGuiNET
{
/// <summary>
/// All draw data to render an ImGui frame
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct DrawData
{
/// <summary>
/// Only valid after Render() is called and before the next NewFrame() is called.
/// </summary>
public byte Valid;
public NativeDrawList** CmdLists;
public int CmdListsCount;
/// <summary>
/// For convenience, sum of all cmd_lists vtx_buffer.Size
/// </summary>
public int TotalVtxCount;
/// <summary>
/// For convenience, sum of all cmd_lists idx_buffer.Size
/// </summary>
public int TotalIdxCount;
};
}

@ -1,190 +0,0 @@
using System;
using System.Buffers;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
namespace ImGuiNET
{
public unsafe struct DrawList
{
private readonly NativeDrawList* _nativeDrawList;
public DrawList(NativeDrawList* nativeDrawList)
{
_nativeDrawList = nativeDrawList;
}
public static DrawList GetForCurrentWindow()
{
return new DrawList(ImGuiNative.igGetWindowDrawList());
}
public void AddLine(Vector2 a, Vector2 b, uint color, float thickness)
{
ImGuiNative.ImDrawList_AddLine(_nativeDrawList, a, b, color, thickness);
}
public void AddRect(Vector2 a, Vector2 b, uint color, float rounding, int rounding_corners, float thickness)
{
ImGuiNative.ImDrawList_AddRect(_nativeDrawList, a, b, color, rounding, rounding_corners, thickness);
}
public void AddRectFilled(Vector2 a, Vector2 b, uint color, float rounding, int rounding_corners = ~0)
{
ImGuiNative.ImDrawList_AddRectFilled(_nativeDrawList, a, b, color, rounding, rounding_corners);
}
public void AddRectFilledMultiColor(
Vector2 a,
Vector2 b,
uint colorUpperLeft,
uint colorUpperRight,
uint colorBottomRight,
uint colorBottomLeft)
{
ImGuiNative.ImDrawList_AddRectFilledMultiColor(
_nativeDrawList,
a,
b,
colorUpperLeft,
colorUpperRight,
colorBottomRight,
colorBottomLeft);
}
public void AddCircle(Vector2 center, float radius, uint color, int numSegments, float thickness)
{
ImGuiNative.ImDrawList_AddCircle(_nativeDrawList, center, radius, color, numSegments, thickness);
}
public unsafe void AddText(Vector2 position, string text, uint color)
{
// Consider using stack allocation if a newer version of Encoding is used (with byte* overloads).
int bytes = Encoding.UTF8.GetByteCount(text);
byte[] tempBytes = ArrayPool<byte>.Shared.Rent(bytes);
Encoding.UTF8.GetBytes(text, 0, text.Length, tempBytes, 0);
fixed (byte* bytePtr = &tempBytes[0])
{
ImGuiNative.ImDrawList_AddText(_nativeDrawList, position, color, bytePtr, bytePtr + bytes);
}
ArrayPool<byte>.Shared.Return(tempBytes);
}
public unsafe void AddImageRounded(
IntPtr userTextureID,
Vector2 a,
Vector2 b,
Vector2 uvA,
Vector2 uvB,
uint color,
float rounding,
int roundingCorners)
{
ImGuiNative.ImDrawList_AddImageRounded(
_nativeDrawList,
userTextureID.ToPointer(),
a,
b,
uvA,
uvB,
color,
rounding,
roundingCorners);
}
public void PushClipRect(Vector2 min, Vector2 max, bool intersectWithCurrentClipRect)
{
ImGuiNative.ImDrawList_PushClipRect(_nativeDrawList, min, max, intersectWithCurrentClipRect ? (byte)1 : (byte)0);
}
public void PushClipRectFullScreen()
{
ImGuiNative.ImDrawList_PushClipRectFullScreen(_nativeDrawList);
}
public void PopClipRect()
{
ImGuiNative.ImDrawList_PopClipRect(_nativeDrawList);
}
public void AddDrawCmd()
{
ImGuiNative.ImDrawList_AddDrawCmd(_nativeDrawList);
}
}
/// <summary>
/// Draw command list
/// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
/// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future.
/// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
/// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
/// All positions are in screen coordinates (0,0=top-left, 1 pixel per unit). Primitives are always added to the list and not culled (culling is done at render time and at a higher-level by ImGui:: functions).
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct NativeDrawList
{
// This is what you have to render
/// <summary>
/// ImVector(ImDrawCmd).
/// Commands. Typically 1 command = 1 gpu draw call.
/// </summary>
public ImVector CmdBuffer;
/// <summary>
/// ImVector(ImDrawIdx).
/// Index buffer. Each command consume ImDrawCmd::ElemCount of those
/// </summary>
public ImVector IdxBuffer;
/// <summary>
/// ImVector(ImDrawVert)
/// </summary>
public ImVector VtxBuffer;
// [Internal, used while building lists]
/// <summary>
/// Pointer to owner window's name (if any) for debugging
/// </summary>
public IntPtr _OwnerName;
/// <summary>
/// [Internal] == VtxBuffer.Size
/// </summary>
public uint _VtxCurrentIdx;
/// <summary>
/// [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector operators too much)
/// </summary>
public IntPtr _VtxWritePtr;
/// <summary>
/// [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector operators too much)
/// </summary>
public IntPtr _IdxWritePtr;
/// <summary>
/// [Internal]
/// </summary>
public ImVector _ClipRectStack;
/// <summary>
/// [Internal]
/// </summary>
public ImVector _TextureIdStack;
/// <summary>
/// [Internal] current path building
/// </summary>
public ImVector _Path;
/// <summary>
/// [Internal] current channel number (0)
/// </summary>
public int _ChannelsCurrent;
/// <summary>
/// [Internal] number of active channels (1+)
/// </summary>
public int _ChannelsCount;
/// <summary>
/// [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size)
/// </summary>
public ImVector _Channels;
}
}

@ -1,17 +0,0 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct DrawVert
{
public Vector2 pos;
public Vector2 uv;
public uint col;
public const int PosOffset = 0;
public const int UVOffset = 8;
public const int ColOffset = 16;
};
}

@ -1,10 +0,0 @@
namespace ImGuiNET
{
// Flags for ImGui::IsWindowFocused()
public enum FocusedFlags
{
ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
RootAndChildWindows = RootWindow | ChildWindows
}
}

@ -1,95 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Numerics;
namespace ImGuiNET
{
public unsafe class Font
{
public Font(NativeFont* nativePtr)
{
NativeFont = nativePtr;
}
public NativeFont* NativeFont { get; }
}
/// <summary>
/// Font runtime data and rendering.
/// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct NativeFont
{
[StructLayout(LayoutKind.Sequential)]
public struct Glyph
{
public ushort Codepoint;
public float XAdvance;
public float X0, Y0, X1, Y1;
public float U0, V0, U1, V1; // Texture coordinates
};
// Members: Hot ~62/78 bytes
/// <summary>
/// Height of characters, set during loading (don't change after loading).
/// Default value: [user-set]
/// </summary>
public float FontSize;
/// <summary>
/// Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
/// Default value: 1.0f.
/// </summary>
public float Scale;
/// <summary>
/// Offset font rendering by xx pixels.
/// Default value: (0.0f, 1.0f)
/// </summary>
public Vector2 DisplayOffset;
/// <summary>
/// ImVector(Glyph)
/// </summary>
public ImVector Glyphs;
/// <summary>
/// Sparse. Glyphs->XAdvance directly indexable (more cache-friendly that reading from Glyphs,
/// for CalcTextSize functions which are often bottleneck in large UI).
/// </summary>
public ImVector IndexXAdvance;
/// <summary>
/// Sparse. Index glyphs by Unicode code-point.
/// </summary>
public ImVector IndexLookup;
/// <summary>
/// Equivalent to FindGlyph(FontFallbackChar)
/// </summary>
public Glyph* FallbackGlyph;
public float FallbackXAdvance;
/// <summary>
/// Replacement glyph if one isn't found. Only set via SetFallbackChar()
/// Default value: '?'
/// </summary>
public ushort FallbackChar;
// Members: Cold ~18/26 bytes
public int ConfigDataCount;
/// <summary>
/// ImFontConfig*. Pointer within ImFontAtlas->ConfigData
/// </summary>
public IntPtr ConfigData;
/// <summary>
/// ImFontAtlas*
/// </summary>
public IntPtr ContainerAtlas; // What we has been loaded into
/// <summary>
/// Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
/// </summary>
public float Ascent, Descent;
};
}

@ -1,63 +0,0 @@
using System.Runtime.InteropServices;
using System;
using System.Numerics;
namespace ImGuiNET
{
// Load and rasterize multiple TTF fonts into a same texture.
// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering.
// We also add custom graphic data into the texture that serves for ImGui.
// 1. (Optional) Call AddFont*** functions. If you don't call any, the default font will be loaded for you.
// 2. Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data.
// 3. Upload the pixels data into a texture within your graphics system.
// 4. Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture. This value will be passed back to you during rendering to identify the texture.
// 5. Call ClearTexData() to free textures memory on the heap.
[StructLayout(LayoutKind.Sequential)]
public unsafe struct NativeFontAtlas
{
// Members
// (Access texture data via GetTexData*() calls which will setup a default font for you.)
/// <summary>
/// User data to refer to the texture once it has been uploaded to user's graphic systems.
/// It ia passed back to you during rendering.
/// </summary>
public void* TexID;
/// <summary>
/// 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight
/// </summary>
public byte* TexPixelsAlpha8;
/// <summary>
/// 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4
/// </summary>
public UIntPtr TexPixelsRGBA32;
/// <summary>
/// Texture width calculated during Build().
/// </summary>
public IntPtr TexWidth;
/// <summary>
/// Texture height calculated during Build().
/// </summary>
public IntPtr TexHeight;
/// <summary>
/// Texture width desired by user before Build(). Must be a power-of-two.
/// If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.
/// </summary>
public IntPtr TexDesiredWidth;
/// <summary>
/// Texture coordinates to a white pixel (part of the TexExtraData block)
/// </summary>
public Vector2 TexUvWhitePixel;
/// <summary>
/// (ImVector(ImFont*)
/// </summary>
public ImVector Fonts;
// Private
/// <summary>
/// ImVector(ImFontConfig). Internal data
/// </summary>
public ImVector ConfigData;
}
}

@ -1,87 +0,0 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct FontConfig
{
/// <summary>
/// TTF data
/// </summary>
public IntPtr FontData;
/// <summary>
/// TTF data size
/// </summary>
public int FontDataSize;
/// <summary>
/// TTF data ownership taken by the container ImFontAtlas (will delete memory itself).
/// Set to true.
/// </summary>
public byte FontDataOwnedByAtlas;
/// <summary>
/// 0.
/// Index of font within TTF file
/// </summary>
public int FontNo;
/// <summary>
/// Size in pixels for rasterizer.
/// </summary>
public float SizePixels;
/// <summary>
/// Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
/// Set to 3.
/// </summary>
public int OversampleH;
/// <summary>
/// Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.
/// Set to 1.
/// </summary>
public int OversampleV;
/// <summary>
/// Align every character to pixel boundary (if enabled, set OversampleH/V to 1).
/// Set to false.
/// </summary>
public byte PixelSnapH;
/// <summary>
/// Extra spacing (in pixels) between glyphs.
/// Set to (0, 0).
/// </summary>
public Vector2 GlyphExtraSpacing;
/// <summary>
/// Offset all glyphs from this font input.
/// Set to (0, 0).
/// </summary>
public Vector2 GlyphOffset;
/// <summary>
/// List of Unicode range (2 value per range, values are inclusive, zero-terminated list).
/// </summary>
public char* GlyphRanges;
/// <summary>
/// Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs).
/// Set to false.
/// </summary>
public byte MergeMode;
/// <summary>
/// Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one.
/// Defaults to 0.
/// </summary>
public uint RasterizerFlags;
/// <summary>
/// Brighten (&gt;1.0f) or darken (&lt;1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
/// Defaults to 1.0.
/// </summary>
public float RasterizerMultiply;
// [Internal]
/// <summary>
/// [Internal Use Only] Name (strictly for debugging)
/// </summary>
public fixed char Name[32];
/// <summary>
/// [Internal Use Only]
/// </summary>
public IntPtr DstFont;
};
}

@ -0,0 +1,41 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct CustomRect
{
public uint ID;
public ushort Width;
public ushort Height;
public ushort X;
public ushort Y;
public float GlyphAdvanceX;
public Vector2 GlyphOffset;
public ImFont* Font;
}
public unsafe partial struct CustomRectPtr
{
public CustomRect* NativePtr { get; }
public CustomRectPtr(CustomRect* nativePtr) => NativePtr = nativePtr;
public CustomRectPtr(IntPtr nativePtr) => NativePtr = (CustomRect*)nativePtr;
public static implicit operator CustomRectPtr(CustomRect* nativePtr) => new CustomRectPtr(nativePtr);
public static implicit operator CustomRect* (CustomRectPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator CustomRectPtr(IntPtr nativePtr) => new CustomRectPtr(nativePtr);
public ref uint ID => ref Unsafe.AsRef<uint>(&NativePtr->ID);
public ref ushort Width => ref Unsafe.AsRef<ushort>(&NativePtr->Width);
public ref ushort Height => ref Unsafe.AsRef<ushort>(&NativePtr->Height);
public ref ushort X => ref Unsafe.AsRef<ushort>(&NativePtr->X);
public ref ushort Y => ref Unsafe.AsRef<ushort>(&NativePtr->Y);
public ref float GlyphAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphAdvanceX);
public ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);
public ImFontPtr Font => new ImFontPtr(NativePtr->Font);
public bool IsPacked()
{
byte ret = ImGuiNative.CustomRect_IsPacked(NativePtr);
return ret != 0;
}
}
}

@ -0,0 +1,61 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct GlyphRangesBuilder
{
public ImVector/*<unsigned char>*/ UsedChars;
}
public unsafe partial struct GlyphRangesBuilderPtr
{
public GlyphRangesBuilder* NativePtr { get; }
public GlyphRangesBuilderPtr(GlyphRangesBuilder* nativePtr) => NativePtr = nativePtr;
public GlyphRangesBuilderPtr(IntPtr nativePtr) => NativePtr = (GlyphRangesBuilder*)nativePtr;
public static implicit operator GlyphRangesBuilderPtr(GlyphRangesBuilder* nativePtr) => new GlyphRangesBuilderPtr(nativePtr);
public static implicit operator GlyphRangesBuilder* (GlyphRangesBuilderPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator GlyphRangesBuilderPtr(IntPtr nativePtr) => new GlyphRangesBuilderPtr(nativePtr);
public ImVector<byte> UsedChars => new ImVector<byte>(NativePtr->UsedChars);
public void SetBit(int n)
{
ImGuiNative.GlyphRangesBuilder_SetBit(NativePtr, n);
}
public void AddText(string text)
{
int text_byteCount = Encoding.UTF8.GetByteCount(text);
byte* native_text = stackalloc byte[text_byteCount + 1];
fixed (char* text_ptr = text)
{
int native_text_offset = Encoding.UTF8.GetBytes(text_ptr, text.Length, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
byte* native_text_end = null;
ImGuiNative.GlyphRangesBuilder_AddText(NativePtr, native_text, native_text_end);
}
public void AddRanges(ref ushort ranges)
{
fixed (ushort* native_ranges = &ranges)
{
ImGuiNative.GlyphRangesBuilder_AddRanges(NativePtr, native_ranges);
}
}
public void BuildRanges(out ImVector out_ranges)
{
fixed (ImVector* native_out_ranges = &out_ranges)
{
ImGuiNative.GlyphRangesBuilder_BuildRanges(NativePtr, native_out_ranges);
}
}
public bool GetBit(int n)
{
byte ret = ImGuiNative.GlyphRangesBuilder_GetBit(NativePtr, n);
return ret != 0;
}
public void AddChar(ushort c)
{
ImGuiNative.GlyphRangesBuilder_AddChar(NativePtr, c);
}
}
}

@ -0,0 +1,42 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImColor
{
public Vector4 Value;
}
public unsafe partial struct ImColorPtr
{
public ImColor* NativePtr { get; }
public ImColorPtr(ImColor* nativePtr) => NativePtr = nativePtr;
public ImColorPtr(IntPtr nativePtr) => NativePtr = (ImColor*)nativePtr;
public static implicit operator ImColorPtr(ImColor* nativePtr) => new ImColorPtr(nativePtr);
public static implicit operator ImColor* (ImColorPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImColorPtr(IntPtr nativePtr) => new ImColorPtr(nativePtr);
public ref Vector4 Value => ref Unsafe.AsRef<Vector4>(&NativePtr->Value);
public void SetHSV(float h, float s, float v)
{
float a = 1.0f;
ImGuiNative.ImColor_SetHSV(NativePtr, h, s, v, a);
}
public void SetHSV(float h, float s, float v, float a)
{
ImGuiNative.ImColor_SetHSV(NativePtr, h, s, v, a);
}
public ImColor HSV(float h, float s, float v)
{
float a = 1.0f;
ImColor ret = ImGuiNative.ImColor_HSV(NativePtr, h, s, v, a);
return ret;
}
public ImColor HSV(float h, float s, float v, float a)
{
ImColor ret = ImGuiNative.ImColor_HSV(NativePtr, h, s, v, a);
return ret;
}
}
}

@ -0,0 +1,24 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawChannel
{
public ImVector/*<ImDrawCmd>*/ CmdBuffer;
public ImVector/*<ImDrawIdx>*/ IdxBuffer;
}
public unsafe partial struct ImDrawChannelPtr
{
public ImDrawChannel* NativePtr { get; }
public ImDrawChannelPtr(ImDrawChannel* nativePtr) => NativePtr = nativePtr;
public ImDrawChannelPtr(IntPtr nativePtr) => NativePtr = (ImDrawChannel*)nativePtr;
public static implicit operator ImDrawChannelPtr(ImDrawChannel* nativePtr) => new ImDrawChannelPtr(nativePtr);
public static implicit operator ImDrawChannel* (ImDrawChannelPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawChannelPtr(IntPtr nativePtr) => new ImDrawChannelPtr(nativePtr);
public ImPtrVector<ImDrawCmdPtr> CmdBuffer => new ImPtrVector<ImDrawCmdPtr>(NativePtr->CmdBuffer, Unsafe.SizeOf<ImDrawCmd>());
public ImVector<ushort> IdxBuffer => new ImVector<ushort>(NativePtr->IdxBuffer);
}
}

@ -0,0 +1,30 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawCmd
{
public uint ElemCount;
public Vector4 ClipRect;
public IntPtr TextureId;
public IntPtr UserCallback;
public void* UserCallbackData;
}
public unsafe partial struct ImDrawCmdPtr
{
public ImDrawCmd* NativePtr { get; }
public ImDrawCmdPtr(ImDrawCmd* nativePtr) => NativePtr = nativePtr;
public ImDrawCmdPtr(IntPtr nativePtr) => NativePtr = (ImDrawCmd*)nativePtr;
public static implicit operator ImDrawCmdPtr(ImDrawCmd* nativePtr) => new ImDrawCmdPtr(nativePtr);
public static implicit operator ImDrawCmd* (ImDrawCmdPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawCmdPtr(IntPtr nativePtr) => new ImDrawCmdPtr(nativePtr);
public ref uint ElemCount => ref Unsafe.AsRef<uint>(&NativePtr->ElemCount);
public ref Vector4 ClipRect => ref Unsafe.AsRef<Vector4>(&NativePtr->ClipRect);
public ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);
public ref IntPtr UserCallback => ref Unsafe.AsRef<IntPtr>(&NativePtr->UserCallback);
public IntPtr UserCallbackData { get => (IntPtr)NativePtr->UserCallbackData; set => NativePtr->UserCallbackData = (void*)value; }
}
}

@ -0,0 +1,16 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImDrawCornerFlags
{
TopLeft = 1 << 0,
TopRight = 1 << 1,
BotLeft = 1 << 2,
BotRight = 1 << 3,
Top = TopLeft | TopRight,
Bot = BotLeft | BotRight,
Left = TopLeft | BotLeft,
Right = TopRight | BotRight,
All = 0xF,
}
}

@ -0,0 +1,46 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawData
{
public byte Valid;
public ImDrawList** CmdLists;
public int CmdListsCount;
public int TotalIdxCount;
public int TotalVtxCount;
public Vector2 DisplayPos;
public Vector2 DisplaySize;
}
public unsafe partial struct ImDrawDataPtr
{
public ImDrawData* NativePtr { get; }
public ImDrawDataPtr(ImDrawData* nativePtr) => NativePtr = nativePtr;
public ImDrawDataPtr(IntPtr nativePtr) => NativePtr = (ImDrawData*)nativePtr;
public static implicit operator ImDrawDataPtr(ImDrawData* nativePtr) => new ImDrawDataPtr(nativePtr);
public static implicit operator ImDrawData* (ImDrawDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawDataPtr(IntPtr nativePtr) => new ImDrawDataPtr(nativePtr);
public ref Bool8 Valid => ref Unsafe.AsRef<Bool8>(&NativePtr->Valid);
public IntPtr CmdLists { get => (IntPtr)NativePtr->CmdLists; set => NativePtr->CmdLists = (ImDrawList**)value; }
public ref int CmdListsCount => ref Unsafe.AsRef<int>(&NativePtr->CmdListsCount);
public ref int TotalIdxCount => ref Unsafe.AsRef<int>(&NativePtr->TotalIdxCount);
public ref int TotalVtxCount => ref Unsafe.AsRef<int>(&NativePtr->TotalVtxCount);
public ref Vector2 DisplayPos => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayPos);
public ref Vector2 DisplaySize => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySize);
public void ScaleClipRects(Vector2 sc)
{
ImGuiNative.ImDrawData_ScaleClipRects(NativePtr, sc);
}
public void DeIndexAllBuffers()
{
ImGuiNative.ImDrawData_DeIndexAllBuffers(NativePtr);
}
public void Clear()
{
ImGuiNative.ImDrawData_Clear(NativePtr);
}
}
}

@ -0,0 +1,414 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawList
{
public ImVector/*<ImDrawCmd>*/ CmdBuffer;
public ImVector/*<ImDrawIdx>*/ IdxBuffer;
public ImVector/*<ImDrawVert>*/ 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 int _ChannelsCurrent;
public int _ChannelsCount;
public ImVector/*<ImDrawChannel>*/ _Channels;
}
public unsafe partial struct ImDrawListPtr
{
public ImDrawList* NativePtr { get; }
public ImDrawListPtr(ImDrawList* nativePtr) => NativePtr = nativePtr;
public ImDrawListPtr(IntPtr nativePtr) => NativePtr = (ImDrawList*)nativePtr;
public static implicit operator ImDrawListPtr(ImDrawList* nativePtr) => new ImDrawListPtr(nativePtr);
public static implicit operator ImDrawList* (ImDrawListPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawListPtr(IntPtr nativePtr) => new ImDrawListPtr(nativePtr);
public ImPtrVector<ImDrawCmdPtr> CmdBuffer => new ImPtrVector<ImDrawCmdPtr>(NativePtr->CmdBuffer, Unsafe.SizeOf<ImDrawCmd>());
public ImVector<ushort> IdxBuffer => new ImVector<ushort>(NativePtr->IdxBuffer);
public ImPtrVector<ImDrawVertPtr> VtxBuffer => new ImPtrVector<ImDrawVertPtr>(NativePtr->VtxBuffer, Unsafe.SizeOf<ImDrawVert>());
public ref ImDrawListFlags Flags => ref Unsafe.AsRef<ImDrawListFlags>(&NativePtr->Flags);
public ref IntPtr _Data => ref Unsafe.AsRef<IntPtr>(&NativePtr->_Data);
public NullTerminatedString _OwnerName => new NullTerminatedString(NativePtr->_OwnerName);
public ref uint _VtxCurrentIdx => ref Unsafe.AsRef<uint>(&NativePtr->_VtxCurrentIdx);
public ImDrawVertPtr _VtxWritePtr => new ImDrawVertPtr(NativePtr->_VtxWritePtr);
public IntPtr _IdxWritePtr { get => (IntPtr)NativePtr->_IdxWritePtr; set => NativePtr->_IdxWritePtr = (ushort*)value; }
public ImVector<Vector4> _ClipRectStack => new ImVector<Vector4>(NativePtr->_ClipRectStack);
public ImVector<IntPtr> _TextureIdStack => new ImVector<IntPtr>(NativePtr->_TextureIdStack);
public ImVector<Vector2> _Path => new ImVector<Vector2>(NativePtr->_Path);
public ref int _ChannelsCurrent => ref Unsafe.AsRef<int>(&NativePtr->_ChannelsCurrent);
public ref int _ChannelsCount => ref Unsafe.AsRef<int>(&NativePtr->_ChannelsCount);
public ImPtrVector<ImDrawChannelPtr> _Channels => new ImPtrVector<ImDrawChannelPtr>(NativePtr->_Channels, Unsafe.SizeOf<ImDrawChannel>());
public void ChannelsSetCurrent(int channel_index)
{
ImGuiNative.ImDrawList_ChannelsSetCurrent(NativePtr, channel_index);
}
public void ChannelsSplit(int channels_count)
{
ImGuiNative.ImDrawList_ChannelsSplit(NativePtr, channels_count);
}
public void AddPolyline(ref Vector2 points, int num_points, uint col, bool closed, float thickness)
{
byte native_closed = closed ? (byte)1 : (byte)0;
fixed (Vector2* native_points = &points)
{
ImGuiNative.ImDrawList_AddPolyline(NativePtr, native_points, num_points, col, native_closed, thickness);
}
}
public void PopClipRect()
{
ImGuiNative.ImDrawList_PopClipRect(NativePtr);
}
public void PushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max)
{
byte intersect_with_current_clip_rect = 0;
ImGuiNative.ImDrawList_PushClipRect(NativePtr, clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
}
public void PushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max, bool intersect_with_current_clip_rect)
{
byte native_intersect_with_current_clip_rect = intersect_with_current_clip_rect ? (byte)1 : (byte)0;
ImGuiNative.ImDrawList_PushClipRect(NativePtr, clip_rect_min, clip_rect_max, native_intersect_with_current_clip_rect);
}
public void PathBezierCurveTo(Vector2 p1, Vector2 p2, Vector2 p3)
{
int num_segments = 0;
ImGuiNative.ImDrawList_PathBezierCurveTo(NativePtr, p1, p2, p3, num_segments);
}
public void PathBezierCurveTo(Vector2 p1, Vector2 p2, Vector2 p3, int num_segments)
{
ImGuiNative.ImDrawList_PathBezierCurveTo(NativePtr, p1, p2, p3, num_segments);
}
public void UpdateTextureID()
{
ImGuiNative.ImDrawList_UpdateTextureID(NativePtr);
}
public void Clear()
{
ImGuiNative.ImDrawList_Clear(NativePtr);
}
public void AddBezierCurve(Vector2 pos0, Vector2 cp0, Vector2 cp1, Vector2 pos1, uint col, float thickness)
{
int num_segments = 0;
ImGuiNative.ImDrawList_AddBezierCurve(NativePtr, pos0, cp0, cp1, pos1, col, thickness, num_segments);
}
public void AddBezierCurve(Vector2 pos0, Vector2 cp0, Vector2 cp1, Vector2 pos1, uint col, float thickness, int num_segments)
{
ImGuiNative.ImDrawList_AddBezierCurve(NativePtr, pos0, cp0, cp1, pos1, col, thickness, num_segments);
}
public void PushTextureID(IntPtr texture_id)
{
ImGuiNative.ImDrawList_PushTextureID(NativePtr, texture_id);
}
public void AddRectFilled(Vector2 a, Vector2 b, uint col)
{
float rounding = 0.0f;
int rounding_corners_flags = (int)ImDrawCornerFlags.All;
ImGuiNative.ImDrawList_AddRectFilled(NativePtr, a, b, col, rounding, rounding_corners_flags);
}
public void AddRectFilled(Vector2 a, Vector2 b, uint col, float rounding)
{
int rounding_corners_flags = (int)ImDrawCornerFlags.All;
ImGuiNative.ImDrawList_AddRectFilled(NativePtr, a, b, col, rounding, rounding_corners_flags);
}
public void AddRectFilled(Vector2 a, Vector2 b, uint col, float rounding, int rounding_corners_flags)
{
ImGuiNative.ImDrawList_AddRectFilled(NativePtr, a, b, col, rounding, rounding_corners_flags);
}
public void AddDrawCmd()
{
ImGuiNative.ImDrawList_AddDrawCmd(NativePtr);
}
public void UpdateClipRect()
{
ImGuiNative.ImDrawList_UpdateClipRect(NativePtr);
}
public void PrimVtx(Vector2 pos, Vector2 uv, uint col)
{
ImGuiNative.ImDrawList_PrimVtx(NativePtr, pos, uv, col);
}
public void PrimRect(Vector2 a, Vector2 b, uint col)
{
ImGuiNative.ImDrawList_PrimRect(NativePtr, a, b, col);
}
public void AddQuad(Vector2 a, Vector2 b, Vector2 c, Vector2 d, uint col)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddQuad(NativePtr, a, b, c, d, col, thickness);
}
public void AddQuad(Vector2 a, Vector2 b, Vector2 c, Vector2 d, uint col, float thickness)
{
ImGuiNative.ImDrawList_AddQuad(NativePtr, a, b, c, d, col, thickness);
}
public void ClearFreeMemory()
{
ImGuiNative.ImDrawList_ClearFreeMemory(NativePtr);
}
public ImDrawListPtr CloneOutput()
{
ImDrawList* ret = ImGuiNative.ImDrawList_CloneOutput(NativePtr);
return new ImDrawListPtr(ret);
}
public void AddRect(Vector2 a, Vector2 b, uint col)
{
float rounding = 0.0f;
int rounding_corners_flags = (int)ImDrawCornerFlags.All;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddRect(NativePtr, a, b, col, rounding, rounding_corners_flags, thickness);
}
public void AddRect(Vector2 a, Vector2 b, uint col, float rounding)
{
int rounding_corners_flags = (int)ImDrawCornerFlags.All;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddRect(NativePtr, a, b, col, rounding, rounding_corners_flags, thickness);
}
public void AddRect(Vector2 a, Vector2 b, uint col, float rounding, int rounding_corners_flags)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddRect(NativePtr, a, b, col, rounding, rounding_corners_flags, thickness);
}
public void AddRect(Vector2 a, Vector2 b, uint col, float rounding, int rounding_corners_flags, float thickness)
{
ImGuiNative.ImDrawList_AddRect(NativePtr, a, b, col, rounding, rounding_corners_flags, thickness);
}
public void AddCallback(IntPtr callback, IntPtr callback_data)
{
void* native_callback_data = callback_data.ToPointer();
ImGuiNative.ImDrawList_AddCallback(NativePtr, callback, native_callback_data);
}
public void PathRect(Vector2 rect_min, Vector2 rect_max)
{
float rounding = 0.0f;
int rounding_corners_flags = (int)ImDrawCornerFlags.All;
ImGuiNative.ImDrawList_PathRect(NativePtr, rect_min, rect_max, rounding, rounding_corners_flags);
}
public void PathRect(Vector2 rect_min, Vector2 rect_max, float rounding)
{
int rounding_corners_flags = (int)ImDrawCornerFlags.All;
ImGuiNative.ImDrawList_PathRect(NativePtr, rect_min, rect_max, rounding, rounding_corners_flags);
}
public void PathRect(Vector2 rect_min, Vector2 rect_max, float rounding, int rounding_corners_flags)
{
ImGuiNative.ImDrawList_PathRect(NativePtr, rect_min, rect_max, rounding, rounding_corners_flags);
}
public void PathArcToFast(Vector2 centre, float radius, int a_min_of_12, int a_max_of_12)
{
ImGuiNative.ImDrawList_PathArcToFast(NativePtr, centre, radius, a_min_of_12, a_max_of_12);
}
public void PathStroke(uint col, bool closed)
{
byte native_closed = closed ? (byte)1 : (byte)0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_PathStroke(NativePtr, col, native_closed, thickness);
}
public void PathStroke(uint col, bool closed, float thickness)
{
byte native_closed = closed ? (byte)1 : (byte)0;
ImGuiNative.ImDrawList_PathStroke(NativePtr, col, native_closed, thickness);
}
public void PathFillConvex(uint col)
{
ImGuiNative.ImDrawList_PathFillConvex(NativePtr, col);
}
public void PathLineToMergeDuplicate(Vector2 pos)
{
ImGuiNative.ImDrawList_PathLineToMergeDuplicate(NativePtr, pos);
}
public void PathArcTo(Vector2 centre, float radius, float a_min, float a_max)
{
int num_segments = 10;
ImGuiNative.ImDrawList_PathArcTo(NativePtr, centre, radius, a_min, a_max, num_segments);
}
public void PathArcTo(Vector2 centre, float radius, float a_min, float a_max, int num_segments)
{
ImGuiNative.ImDrawList_PathArcTo(NativePtr, centre, radius, a_min, a_max, num_segments);
}
public void AddConvexPolyFilled(ref Vector2 points, int num_points, uint col)
{
fixed (Vector2* native_points = &points)
{
ImGuiNative.ImDrawList_AddConvexPolyFilled(NativePtr, native_points, num_points, col);
}
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d)
{
Vector2 uv_a = new Vector2();
Vector2 uv_b = new Vector2(1, 0);
Vector2 uv_c = new Vector2(1, 1);
Vector2 uv_d = new Vector2(0, 1);
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a)
{
Vector2 uv_b = new Vector2(1, 0);
Vector2 uv_c = new Vector2(1, 1);
Vector2 uv_d = new Vector2(0, 1);
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b)
{
Vector2 uv_c = new Vector2(1, 1);
Vector2 uv_d = new Vector2(0, 1);
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c)
{
Vector2 uv_d = new Vector2(0, 1);
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d)
{
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d, uint col)
{
ImGuiNative.ImDrawList_AddImageQuad(NativePtr, user_texture_id, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 a, Vector2 b)
{
Vector2 uv_a = new Vector2();
Vector2 uv_b = new Vector2(1, 1);
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, a, b, uv_a, uv_b, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 uv_a)
{
Vector2 uv_b = new Vector2(1, 1);
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, a, b, uv_a, uv_b, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b)
{
uint col = 0xFFFFFFFF;
ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, a, b, uv_a, uv_b, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col)
{
ImGuiNative.ImDrawList_AddImage(NativePtr, user_texture_id, a, b, uv_a, uv_b, col);
}
public void AddCircleFilled(Vector2 centre, float radius, uint col)
{
int num_segments = 12;
ImGuiNative.ImDrawList_AddCircleFilled(NativePtr, centre, radius, col, num_segments);
}
public void AddCircleFilled(Vector2 centre, float radius, uint col, int num_segments)
{
ImGuiNative.ImDrawList_AddCircleFilled(NativePtr, centre, radius, col, num_segments);
}
public void AddCircle(Vector2 centre, float radius, uint col)
{
int num_segments = 12;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddCircle(NativePtr, centre, radius, col, num_segments, thickness);
}
public void AddCircle(Vector2 centre, float radius, uint col, int num_segments)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddCircle(NativePtr, centre, radius, col, num_segments, thickness);
}
public void AddCircle(Vector2 centre, float radius, uint col, int num_segments, float thickness)
{
ImGuiNative.ImDrawList_AddCircle(NativePtr, centre, radius, col, num_segments, thickness);
}
public void AddTriangleFilled(Vector2 a, Vector2 b, Vector2 c, uint col)
{
ImGuiNative.ImDrawList_AddTriangleFilled(NativePtr, a, b, c, col);
}
public void AddTriangle(Vector2 a, Vector2 b, Vector2 c, uint col)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddTriangle(NativePtr, a, b, c, col, thickness);
}
public void AddTriangle(Vector2 a, Vector2 b, Vector2 c, uint col, float thickness)
{
ImGuiNative.ImDrawList_AddTriangle(NativePtr, a, b, c, col, thickness);
}
public void AddQuadFilled(Vector2 a, Vector2 b, Vector2 c, Vector2 d, uint col)
{
ImGuiNative.ImDrawList_AddQuadFilled(NativePtr, a, b, c, d, col);
}
public void PrimReserve(int idx_count, int vtx_count)
{
ImGuiNative.ImDrawList_PrimReserve(NativePtr, idx_count, vtx_count);
}
public void AddRectFilledMultiColor(Vector2 a, Vector2 b, uint col_upr_left, uint col_upr_right, uint col_bot_right, uint col_bot_left)
{
ImGuiNative.ImDrawList_AddRectFilledMultiColor(NativePtr, a, b, col_upr_left, col_upr_right, col_bot_right, col_bot_left);
}
public void AddLine(Vector2 a, Vector2 b, uint col)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddLine(NativePtr, a, b, col, thickness);
}
public void AddLine(Vector2 a, Vector2 b, uint col, float thickness)
{
ImGuiNative.ImDrawList_AddLine(NativePtr, a, b, col, thickness);
}
public Vector2 GetClipRectMin()
{
Vector2 ret = ImGuiNative.ImDrawList_GetClipRectMin(NativePtr);
return ret;
}
public void PopTextureID()
{
ImGuiNative.ImDrawList_PopTextureID(NativePtr);
}
public void PrimWriteVtx(Vector2 pos, Vector2 uv, uint col)
{
ImGuiNative.ImDrawList_PrimWriteVtx(NativePtr, pos, uv, col);
}
public Vector2 GetClipRectMax()
{
Vector2 ret = ImGuiNative.ImDrawList_GetClipRectMax(NativePtr);
return ret;
}
public void AddImageRounded(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col, float rounding)
{
int rounding_corners = (int)ImDrawCornerFlags.All;
ImGuiNative.ImDrawList_AddImageRounded(NativePtr, user_texture_id, a, b, uv_a, uv_b, col, rounding, rounding_corners);
}
public void AddImageRounded(IntPtr user_texture_id, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col, float rounding, int rounding_corners)
{
ImGuiNative.ImDrawList_AddImageRounded(NativePtr, user_texture_id, a, b, uv_a, uv_b, col, rounding, rounding_corners);
}
public void PrimQuadUV(Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d, uint col)
{
ImGuiNative.ImDrawList_PrimQuadUV(NativePtr, a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void PathClear()
{
ImGuiNative.ImDrawList_PathClear(NativePtr);
}
public void PrimWriteIdx(ushort idx)
{
ImGuiNative.ImDrawList_PrimWriteIdx(NativePtr, idx);
}
public void PushClipRectFullScreen()
{
ImGuiNative.ImDrawList_PushClipRectFullScreen(NativePtr);
}
public void ChannelsMerge()
{
ImGuiNative.ImDrawList_ChannelsMerge(NativePtr);
}
public void PathLineTo(Vector2 pos)
{
ImGuiNative.ImDrawList_PathLineTo(NativePtr, pos);
}
public void PrimRectUV(Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col)
{
ImGuiNative.ImDrawList_PrimRectUV(NativePtr, a, b, uv_a, uv_b, col);
}
}
}

@ -0,0 +1,9 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImDrawListFlags
{
AntiAliasedLines = 1 << 0,
AntiAliasedFill = 1 << 1,
}
}

@ -0,0 +1,26 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawVert
{
public Vector2 pos;
public Vector2 uv;
public uint col;
}
public unsafe partial struct ImDrawVertPtr
{
public ImDrawVert* NativePtr { get; }
public ImDrawVertPtr(ImDrawVert* nativePtr) => NativePtr = nativePtr;
public ImDrawVertPtr(IntPtr nativePtr) => NativePtr = (ImDrawVert*)nativePtr;
public static implicit operator ImDrawVertPtr(ImDrawVert* nativePtr) => new ImDrawVertPtr(nativePtr);
public static implicit operator ImDrawVert* (ImDrawVertPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawVertPtr(IntPtr nativePtr) => new ImDrawVertPtr(nativePtr);
public ref Vector2 pos => ref Unsafe.AsRef<Vector2>(&NativePtr->pos);
public ref Vector2 uv => ref Unsafe.AsRef<Vector2>(&NativePtr->uv);
public ref uint col => ref Unsafe.AsRef<uint>(&NativePtr->col);
}
}

@ -0,0 +1,112 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFont
{
public float FontSize;
public float Scale;
public Vector2 DisplayOffset;
public ImVector/*<ImFontGlyph>*/ Glyphs;
public ImVector/*<float>*/ IndexAdvanceX;
public ImVector/*<unsigned short>*/ IndexLookup;
public ImFontGlyph* FallbackGlyph;
public float FallbackAdvanceX;
public ushort FallbackChar;
public short ConfigDataCount;
public ImFontConfig* ConfigData;
public ImFontAtlas* ContainerAtlas;
public float Ascent;
public float Descent;
public byte DirtyLookupTables;
public int MetricsTotalSurface;
}
public unsafe partial struct ImFontPtr
{
public ImFont* NativePtr { get; }
public ImFontPtr(ImFont* nativePtr) => NativePtr = nativePtr;
public ImFontPtr(IntPtr nativePtr) => NativePtr = (ImFont*)nativePtr;
public static implicit operator ImFontPtr(ImFont* nativePtr) => new ImFontPtr(nativePtr);
public static implicit operator ImFont* (ImFontPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontPtr(IntPtr nativePtr) => new ImFontPtr(nativePtr);
public ref float FontSize => ref Unsafe.AsRef<float>(&NativePtr->FontSize);
public ref float Scale => ref Unsafe.AsRef<float>(&NativePtr->Scale);
public ref Vector2 DisplayOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayOffset);
public ImPtrVector<ImFontGlyphPtr> Glyphs => new ImPtrVector<ImFontGlyphPtr>(NativePtr->Glyphs, Unsafe.SizeOf<ImFontGlyph>());
public ImVector<float> IndexAdvanceX => new ImVector<float>(NativePtr->IndexAdvanceX);
public ImVector<ushort> IndexLookup => new ImVector<ushort>(NativePtr->IndexLookup);
public ImFontGlyphPtr FallbackGlyph => new ImFontGlyphPtr(NativePtr->FallbackGlyph);
public ref float FallbackAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->FallbackAdvanceX);
public ref ushort FallbackChar => ref Unsafe.AsRef<ushort>(&NativePtr->FallbackChar);
public ref short ConfigDataCount => ref Unsafe.AsRef<short>(&NativePtr->ConfigDataCount);
public ImFontConfigPtr ConfigData => new ImFontConfigPtr(NativePtr->ConfigData);
public ImFontAtlasPtr ContainerAtlas => new ImFontAtlasPtr(NativePtr->ContainerAtlas);
public ref float Ascent => ref Unsafe.AsRef<float>(&NativePtr->Ascent);
public ref float Descent => ref Unsafe.AsRef<float>(&NativePtr->Descent);
public ref Bool8 DirtyLookupTables => ref Unsafe.AsRef<Bool8>(&NativePtr->DirtyLookupTables);
public ref int MetricsTotalSurface => ref Unsafe.AsRef<int>(&NativePtr->MetricsTotalSurface);
public void AddRemapChar(ushort dst, ushort src)
{
byte overwrite_dst = 1;
ImGuiNative.ImFont_AddRemapChar(NativePtr, dst, src, overwrite_dst);
}
public void AddRemapChar(ushort dst, ushort src, bool overwrite_dst)
{
byte native_overwrite_dst = overwrite_dst ? (byte)1 : (byte)0;
ImGuiNative.ImFont_AddRemapChar(NativePtr, dst, src, native_overwrite_dst);
}
public void AddGlyph(ushort c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x)
{
ImGuiNative.ImFont_AddGlyph(NativePtr, c, x0, y0, x1, y1, u0, v0, u1, v1, advance_x);
}
public void GrowIndex(int new_size)
{
ImGuiNative.ImFont_GrowIndex(NativePtr, new_size);
}
public ImFontGlyphPtr FindGlyphNoFallback(ushort c)
{
ImFontGlyph* ret = ImGuiNative.ImFont_FindGlyphNoFallback(NativePtr, c);
return new ImFontGlyphPtr(ret);
}
public bool IsLoaded()
{
byte ret = ImGuiNative.ImFont_IsLoaded(NativePtr);
return ret != 0;
}
public float GetCharAdvance(ushort c)
{
float ret = ImGuiNative.ImFont_GetCharAdvance(NativePtr, c);
return ret;
}
public void SetFallbackChar(ushort c)
{
ImGuiNative.ImFont_SetFallbackChar(NativePtr, c);
}
public void RenderChar(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, ushort c)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
ImGuiNative.ImFont_RenderChar(NativePtr, native_draw_list, size, pos, col, c);
}
public ImFontGlyphPtr FindGlyph(ushort c)
{
ImFontGlyph* ret = ImGuiNative.ImFont_FindGlyph(NativePtr, c);
return new ImFontGlyphPtr(ret);
}
public string GetDebugName()
{
byte* ret = ImGuiNative.ImFont_GetDebugName(NativePtr);
return Util.StringFromPtr(ret);
}
public void BuildLookupTable()
{
ImGuiNative.ImFont_BuildLookupTable(NativePtr);
}
public void ClearOutputData()
{
ImGuiNative.ImFont_ClearOutputData(NativePtr);
}
}
}

@ -0,0 +1,386 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontAtlas
{
public byte Locked;
public ImFontAtlasFlags Flags;
public IntPtr TexID;
public int TexDesiredWidth;
public int TexGlyphPadding;
public byte* TexPixelsAlpha8;
public uint* TexPixelsRGBA32;
public int TexWidth;
public int TexHeight;
public Vector2 TexUvScale;
public Vector2 TexUvWhitePixel;
public ImVector/*<ImFont*>*/ Fonts;
public ImVector/*<CustomRect>*/ CustomRects;
public ImVector/*<ImFontConfig>*/ ConfigData;
public fixed int CustomRectIds[1];
}
public unsafe partial struct ImFontAtlasPtr
{
public ImFontAtlas* NativePtr { get; }
public ImFontAtlasPtr(ImFontAtlas* nativePtr) => NativePtr = nativePtr;
public ImFontAtlasPtr(IntPtr nativePtr) => NativePtr = (ImFontAtlas*)nativePtr;
public static implicit operator ImFontAtlasPtr(ImFontAtlas* nativePtr) => new ImFontAtlasPtr(nativePtr);
public static implicit operator ImFontAtlas* (ImFontAtlasPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontAtlasPtr(IntPtr nativePtr) => new ImFontAtlasPtr(nativePtr);
public ref Bool8 Locked => ref Unsafe.AsRef<Bool8>(&NativePtr->Locked);
public ref ImFontAtlasFlags Flags => ref Unsafe.AsRef<ImFontAtlasFlags>(&NativePtr->Flags);
public ref IntPtr TexID => ref Unsafe.AsRef<IntPtr>(&NativePtr->TexID);
public ref int TexDesiredWidth => ref Unsafe.AsRef<int>(&NativePtr->TexDesiredWidth);
public ref int TexGlyphPadding => ref Unsafe.AsRef<int>(&NativePtr->TexGlyphPadding);
public IntPtr TexPixelsAlpha8 { get => (IntPtr)NativePtr->TexPixelsAlpha8; set => NativePtr->TexPixelsAlpha8 = (byte*)value; }
public IntPtr TexPixelsRGBA32 { get => (IntPtr)NativePtr->TexPixelsRGBA32; set => NativePtr->TexPixelsRGBA32 = (uint*)value; }
public ref int TexWidth => ref Unsafe.AsRef<int>(&NativePtr->TexWidth);
public ref int TexHeight => ref Unsafe.AsRef<int>(&NativePtr->TexHeight);
public ref Vector2 TexUvScale => ref Unsafe.AsRef<Vector2>(&NativePtr->TexUvScale);
public ref Vector2 TexUvWhitePixel => ref Unsafe.AsRef<Vector2>(&NativePtr->TexUvWhitePixel);
public ImVector<ImFontPtr> Fonts => new ImVector<ImFontPtr>(NativePtr->Fonts);
public ImVector<CustomRect> CustomRects => new ImVector<CustomRect>(NativePtr->CustomRects);
public ImPtrVector<ImFontConfigPtr> ConfigData => new ImPtrVector<ImFontConfigPtr>(NativePtr->ConfigData, Unsafe.SizeOf<ImFontConfig>());
public RangeAccessor<int> CustomRectIds => new RangeAccessor<int>(NativePtr->CustomRectIds, 1);
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels)
{
int compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
byte* native_compressed_font_data_base85 = stackalloc byte[compressed_font_data_base85_byteCount + 1];
fixed (char* compressed_font_data_base85_ptr = compressed_font_data_base85)
{
int native_compressed_font_data_base85_offset = Encoding.UTF8.GetBytes(compressed_font_data_base85_ptr, compressed_font_data_base85.Length, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg)
{
int compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
byte* native_compressed_font_data_base85 = stackalloc byte[compressed_font_data_base85_byteCount + 1];
fixed (char* compressed_font_data_base85_ptr = compressed_font_data_base85)
{
int native_compressed_font_data_base85_offset = Encoding.UTF8.GetBytes(compressed_font_data_base85_ptr, compressed_font_data_base85.Length, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, native_font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges)
{
int compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
byte* native_compressed_font_data_base85 = stackalloc byte[compressed_font_data_base85_byteCount + 1];
fixed (char* compressed_font_data_base85_ptr = compressed_font_data_base85)
{
int native_compressed_font_data_base85_offset = Encoding.UTF8.GetBytes(compressed_font_data_base85_ptr, compressed_font_data_base85.Length, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
fixed (ushort* native_glyph_ranges = &glyph_ranges)
{
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(NativePtr, native_compressed_font_data_base85, size_pixels, native_font_cfg, native_glyph_ranges);
return new ImFontPtr(ret);
}
}
public bool Build()
{
byte ret = ImGuiNative.ImFontAtlas_Build(NativePtr);
return ret != 0;
}
public ImFontPtr AddFont(ImFontConfigPtr font_cfg)
{
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFont(NativePtr, native_font_cfg);
return new ImFontPtr(ret);
}
public void CalcCustomRectUV(ref CustomRect rect, out Vector2 out_uv_min, out Vector2 out_uv_max)
{
fixed (CustomRect* native_rect = &rect)
{
fixed (Vector2* native_out_uv_min = &out_uv_min)
{
fixed (Vector2* native_out_uv_max = &out_uv_max)
{
ImGuiNative.ImFontAtlas_CalcCustomRectUV(NativePtr, native_rect, native_out_uv_min, native_out_uv_max);
}
}
}
}
public CustomRect* GetCustomRectByIndex(int index)
{
CustomRect* ret = ImGuiNative.ImFontAtlas_GetCustomRectByIndex(NativePtr, index);
return ret;
}
public int AddCustomRectRegular(uint id, int width, int height)
{
int ret = ImGuiNative.ImFontAtlas_AddCustomRectRegular(NativePtr, id, width, height);
return ret;
}
public bool IsBuilt()
{
byte ret = ImGuiNative.ImFontAtlas_IsBuilt(NativePtr);
return ret != 0;
}
public ushort* GetGlyphRangesThai()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesThai(NativePtr);
return ret;
}
public ushort* GetGlyphRangesCyrillic()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesCyrillic(NativePtr);
return ret;
}
public ushort* GetGlyphRangesChineseSimplifiedCommon()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(NativePtr);
return ret;
}
public ushort* GetGlyphRangesChineseFull()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesChineseFull(NativePtr);
return ret;
}
public ushort* GetGlyphRangesDefault()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesDefault(NativePtr);
return ret;
}
public void SetTexID(IntPtr id)
{
ImGuiNative.ImFontAtlas_SetTexID(NativePtr, id);
}
public void ClearTexData()
{
ImGuiNative.ImFontAtlas_ClearTexData(NativePtr);
}
public void ClearFonts()
{
ImGuiNative.ImFontAtlas_ClearFonts(NativePtr);
}
public void Clear()
{
ImGuiNative.ImFontAtlas_Clear(NativePtr);
}
public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels)
{
void* native_compressed_font_data = compressed_font_data.ToPointer();
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg)
{
void* native_compressed_font_data = compressed_font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_size, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges)
{
void* native_compressed_font_data = compressed_font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
fixed (ushort* native_glyph_ranges = &glyph_ranges)
{
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF(NativePtr, native_compressed_font_data, compressed_font_size, size_pixels, native_font_cfg, native_glyph_ranges);
return new ImFontPtr(ret);
}
}
public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels)
{
void* native_font_data = font_data.ToPointer();
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg)
{
void* native_font_data = font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_size, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges)
{
void* native_font_data = font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
fixed (ushort* native_glyph_ranges = &glyph_ranges)
{
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(NativePtr, native_font_data, font_size, size_pixels, native_font_cfg, native_glyph_ranges);
return new ImFontPtr(ret);
}
}
public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels)
{
int filename_byteCount = Encoding.UTF8.GetByteCount(filename);
byte* native_filename = stackalloc byte[filename_byteCount + 1];
fixed (char* filename_ptr = filename)
{
int native_filename_offset = Encoding.UTF8.GetBytes(filename_ptr, filename.Length, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg)
{
int filename_byteCount = Encoding.UTF8.GetByteCount(filename);
byte* native_filename = stackalloc byte[filename_byteCount + 1];
fixed (char* filename_ptr = filename)
{
int native_filename_offset = Encoding.UTF8.GetBytes(filename_ptr, filename.Length, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, native_font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg, ref ushort glyph_ranges)
{
int filename_byteCount = Encoding.UTF8.GetByteCount(filename);
byte* native_filename = stackalloc byte[filename_byteCount + 1];
fixed (char* filename_ptr = filename)
{
int native_filename_offset = Encoding.UTF8.GetBytes(filename_ptr, filename.Length, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
fixed (ushort* native_glyph_ranges = &glyph_ranges)
{
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(NativePtr, native_filename, size_pixels, native_font_cfg, native_glyph_ranges);
return new ImFontPtr(ret);
}
}
public ImFontPtr AddFontDefault()
{
ImFontConfig* font_cfg = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, font_cfg);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontDefault(ImFontConfigPtr font_cfg)
{
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontDefault(NativePtr, native_font_cfg);
return new ImFontPtr(ret);
}
public ushort* GetGlyphRangesJapanese()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesJapanese(NativePtr);
return ret;
}
public void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height)
{
int* out_bytes_per_pixel = null;
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(NativePtr, native_out_pixels, native_out_width, native_out_height, out_bytes_per_pixel);
}
}
}
}
public void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
{
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
fixed (int* native_out_bytes_per_pixel = &out_bytes_per_pixel)
{
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(NativePtr, native_out_pixels, native_out_width, native_out_height, native_out_bytes_per_pixel);
}
}
}
}
}
public void ClearInputData()
{
ImGuiNative.ImFontAtlas_ClearInputData(NativePtr);
}
public bool GetMouseCursorTexData(ImGuiMouseCursor cursor, out Vector2 out_offset, out Vector2 out_size, out Vector2 out_uv_border, out Vector2 out_uv_fill)
{
fixed (Vector2* native_out_offset = &out_offset)
{
fixed (Vector2* native_out_size = &out_size)
{
fixed (Vector2* native_out_uv_border = &out_uv_border)
{
fixed (Vector2* native_out_uv_fill = &out_uv_fill)
{
byte ret = ImGuiNative.ImFontAtlas_GetMouseCursorTexData(NativePtr, cursor, native_out_offset, native_out_size, native_out_uv_border, native_out_uv_fill);
return ret != 0;
}
}
}
}
}
public ushort* GetGlyphRangesKorean()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesKorean(NativePtr);
return ret;
}
public void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height)
{
int* out_bytes_per_pixel = null;
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(NativePtr, native_out_pixels, native_out_width, native_out_height, out_bytes_per_pixel);
}
}
}
}
public void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
{
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
fixed (int* native_out_bytes_per_pixel = &out_bytes_per_pixel)
{
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(NativePtr, native_out_pixels, native_out_width, native_out_height, native_out_bytes_per_pixel);
}
}
}
}
}
public int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x)
{
ImFont* native_font = font.NativePtr;
Vector2 offset = new Vector2();
int ret = ImGuiNative.ImFontAtlas_AddCustomRectFontGlyph(NativePtr, native_font, id, width, height, advance_x, offset);
return ret;
}
public int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x, Vector2 offset)
{
ImFont* native_font = font.NativePtr;
int ret = ImGuiNative.ImFontAtlas_AddCustomRectFontGlyph(NativePtr, native_font, id, width, height, advance_x, offset);
return ret;
}
}
}

@ -0,0 +1,10 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImFontAtlasFlags
{
None = 0,
NoPowerOfTwoHeight = 1 << 0,
NoMouseCursors = 1 << 1,
}
}

@ -0,0 +1,56 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontConfig
{
public void* FontData;
public int FontDataSize;
public byte FontDataOwnedByAtlas;
public int FontNo;
public float SizePixels;
public int OversampleH;
public int OversampleV;
public byte PixelSnapH;
public Vector2 GlyphExtraSpacing;
public Vector2 GlyphOffset;
public ushort* GlyphRanges;
public float GlyphMinAdvanceX;
public float GlyphMaxAdvanceX;
public byte MergeMode;
public uint RasterizerFlags;
public float RasterizerMultiply;
public fixed byte Name[40];
public ImFont* DstFont;
}
public unsafe partial struct ImFontConfigPtr
{
public ImFontConfig* NativePtr { get; }
public ImFontConfigPtr(ImFontConfig* nativePtr) => NativePtr = nativePtr;
public ImFontConfigPtr(IntPtr nativePtr) => NativePtr = (ImFontConfig*)nativePtr;
public static implicit operator ImFontConfigPtr(ImFontConfig* nativePtr) => new ImFontConfigPtr(nativePtr);
public static implicit operator ImFontConfig* (ImFontConfigPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontConfigPtr(IntPtr nativePtr) => new ImFontConfigPtr(nativePtr);
public IntPtr FontData { get => (IntPtr)NativePtr->FontData; set => NativePtr->FontData = (void*)value; }
public ref int FontDataSize => ref Unsafe.AsRef<int>(&NativePtr->FontDataSize);
public ref Bool8 FontDataOwnedByAtlas => ref Unsafe.AsRef<Bool8>(&NativePtr->FontDataOwnedByAtlas);
public ref int FontNo => ref Unsafe.AsRef<int>(&NativePtr->FontNo);
public ref float SizePixels => ref Unsafe.AsRef<float>(&NativePtr->SizePixels);
public ref int OversampleH => ref Unsafe.AsRef<int>(&NativePtr->OversampleH);
public ref int OversampleV => ref Unsafe.AsRef<int>(&NativePtr->OversampleV);
public ref Bool8 PixelSnapH => ref Unsafe.AsRef<Bool8>(&NativePtr->PixelSnapH);
public ref Vector2 GlyphExtraSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphExtraSpacing);
public ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);
public IntPtr GlyphRanges { get => (IntPtr)NativePtr->GlyphRanges; set => NativePtr->GlyphRanges = (ushort*)value; }
public ref float GlyphMinAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphMinAdvanceX);
public ref float GlyphMaxAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphMaxAdvanceX);
public ref Bool8 MergeMode => ref Unsafe.AsRef<Bool8>(&NativePtr->MergeMode);
public ref uint RasterizerFlags => ref Unsafe.AsRef<uint>(&NativePtr->RasterizerFlags);
public ref float RasterizerMultiply => ref Unsafe.AsRef<float>(&NativePtr->RasterizerMultiply);
public RangeAccessor<byte> Name => new RangeAccessor<byte>(NativePtr->Name, 40);
public ImFontPtr DstFont => new ImFontPtr(NativePtr->DstFont);
}
}

@ -0,0 +1,40 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontGlyph
{
public ushort Codepoint;
public float AdvanceX;
public float X0;
public float Y0;
public float X1;
public float Y1;
public float U0;
public float V0;
public float U1;
public float V1;
}
public unsafe partial struct ImFontGlyphPtr
{
public ImFontGlyph* NativePtr { get; }
public ImFontGlyphPtr(ImFontGlyph* nativePtr) => NativePtr = nativePtr;
public ImFontGlyphPtr(IntPtr nativePtr) => NativePtr = (ImFontGlyph*)nativePtr;
public static implicit operator ImFontGlyphPtr(ImFontGlyph* nativePtr) => new ImFontGlyphPtr(nativePtr);
public static implicit operator ImFontGlyph* (ImFontGlyphPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontGlyphPtr(IntPtr nativePtr) => new ImFontGlyphPtr(nativePtr);
public ref ushort Codepoint => ref Unsafe.AsRef<ushort>(&NativePtr->Codepoint);
public ref float AdvanceX => ref Unsafe.AsRef<float>(&NativePtr->AdvanceX);
public ref float X0 => ref Unsafe.AsRef<float>(&NativePtr->X0);
public ref float Y0 => ref Unsafe.AsRef<float>(&NativePtr->Y0);
public ref float X1 => ref Unsafe.AsRef<float>(&NativePtr->X1);
public ref float Y1 => ref Unsafe.AsRef<float>(&NativePtr->Y1);
public ref float U0 => ref Unsafe.AsRef<float>(&NativePtr->U0);
public ref float V0 => ref Unsafe.AsRef<float>(&NativePtr->V0);
public ref float U1 => ref Unsafe.AsRef<float>(&NativePtr->U1);
public ref float V1 => ref Unsafe.AsRef<float>(&NativePtr->V1);
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,10 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiBackendFlags
{
HasGamepad = 1 << 0,
HasMouseCursors = 1 << 1,
HasSetMousePos = 1 << 2,
}
}

@ -0,0 +1,50 @@
namespace ImGuiNET
{
public enum ImGuiCol
{
Text = 0,
TextDisabled = 1,
WindowBg = 2,
ChildBg = 3,
PopupBg = 4,
Border = 5,
BorderShadow = 6,
FrameBg = 7,
FrameBgHovered = 8,
FrameBgActive = 9,
TitleBg = 10,
TitleBgActive = 11,
TitleBgCollapsed = 12,
MenuBarBg = 13,
ScrollbarBg = 14,
ScrollbarGrab = 15,
ScrollbarGrabHovered = 16,
ScrollbarGrabActive = 17,
CheckMark = 18,
SliderGrab = 19,
SliderGrabActive = 20,
Button = 21,
ButtonHovered = 22,
ButtonActive = 23,
Header = 24,
HeaderHovered = 25,
HeaderActive = 26,
Separator = 27,
SeparatorHovered = 28,
SeparatorActive = 29,
ResizeGrip = 30,
ResizeGripHovered = 31,
ResizeGripActive = 32,
PlotLines = 33,
PlotLinesHovered = 34,
PlotHistogram = 35,
PlotHistogramHovered = 36,
TextSelectedBg = 37,
DragDropTarget = 38,
NavHighlight = 39,
NavWindowingHighlight = 40,
NavWindowingDimBg = 41,
ModalWindowDimBg = 42,
COUNT = 43,
}
}

@ -0,0 +1,32 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiColorEditFlags
{
None = 0,
NoAlpha = 1 << 1,
NoPicker = 1 << 2,
NoOptions = 1 << 3,
NoSmallPreview = 1 << 4,
NoInputs = 1 << 5,
NoTooltip = 1 << 6,
NoLabel = 1 << 7,
NoSidePreview = 1 << 8,
NoDragDrop = 1 << 9,
AlphaBar = 1 << 16,
AlphaPreview = 1 << 17,
AlphaPreviewHalf = 1 << 18,
HDR = 1 << 19,
RGB = 1 << 20,
HSV = 1 << 21,
HEX = 1 << 22,
Uint8 = 1 << 23,
Float = 1 << 24,
PickerHueBar = 1 << 25,
PickerHueWheel = 1 << 26,
_InputsMask = RGB|HSV|HEX,
_DataTypeMask = Uint8|Float,
_PickerMask = PickerHueWheel|PickerHueBar,
_OptionsDefault = Uint8|RGB|PickerHueBar,
}
}

@ -0,0 +1,16 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiComboFlags
{
None = 0,
PopupAlignLeft = 1 << 0,
HeightSmall = 1 << 1,
HeightRegular = 1 << 2,
HeightLarge = 1 << 3,
HeightLargest = 1 << 4,
NoArrowButton = 1 << 5,
NoPreview = 1 << 6,
HeightMask = HeightSmall | HeightRegular | HeightLarge | HeightLargest,
}
}

@ -0,0 +1,10 @@
namespace ImGuiNET
{
public enum ImGuiCond
{
Always = 1 << 0,
Once = 1 << 1,
FirstUseEver = 1 << 2,
Appearing = 1 << 3,
}
}

@ -0,0 +1,15 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiConfigFlags
{
NavEnableKeyboard = 1 << 0,
NavEnableGamepad = 1 << 1,
NavEnableSetMousePos = 1 << 2,
NavNoCaptureKeyboard = 1 << 3,
NoMouse = 1 << 4,
NoMouseCursorChange = 1 << 5,
IsSRGB = 1 << 20,
IsTouchScreen = 1 << 21,
}
}

@ -0,0 +1,13 @@
namespace ImGuiNET
{
public enum ImGuiDataType
{
S32 = 0,
U32 = 1,
S64 = 2,
U64 = 3,
Float = 4,
Double = 5,
COUNT = 6,
}
}

@ -0,0 +1,12 @@
namespace ImGuiNET
{
public enum ImGuiDir
{
None = -1,
Left = 0,
Right = 1,
Up = 2,
Down = 3,
COUNT = 4,
}
}

@ -0,0 +1,18 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiDragDropFlags
{
None = 0,
SourceNoPreviewTooltip = 1 << 0,
SourceNoDisableHover = 1 << 1,
SourceNoHoldToOpenOthers = 1 << 2,
SourceAllowNullID = 1 << 3,
SourceExtern = 1 << 4,
SourceAutoExpirePayload = 1 << 5,
AcceptBeforeDelivery = 1 << 10,
AcceptNoDrawDefaultRect = 1 << 11,
AcceptNoPreviewTooltip = 1 << 12,
AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect,
}
}

@ -0,0 +1,12 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiFocusedFlags
{
None = 0,
ChildWindows = 1 << 0,
RootWindow = 1 << 1,
AnyWindow = 1 << 2,
RootAndChildWindows = RootWindow | ChildWindows,
}
}

@ -0,0 +1,17 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiHoveredFlags
{
None = 0,
ChildWindows = 1 << 0,
RootWindow = 1 << 1,
AnyWindow = 1 << 2,
AllowWhenBlockedByPopup = 1 << 3,
AllowWhenBlockedByActiveItem = 1 << 5,
AllowWhenOverlapped = 1 << 6,
AllowWhenDisabled = 1 << 7,
RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped,
RootAndChildWindows = RootWindow | ChildWindows,
}
}

@ -0,0 +1,189 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiIO
{
public ImGuiConfigFlags ConfigFlags;
public ImGuiBackendFlags BackendFlags;
public Vector2 DisplaySize;
public float DeltaTime;
public float IniSavingRate;
public byte* IniFilename;
public byte* LogFilename;
public float MouseDoubleClickTime;
public float MouseDoubleClickMaxDist;
public float MouseDragThreshold;
public fixed int KeyMap[21];
public float KeyRepeatDelay;
public float KeyRepeatRate;
public void* UserData;
public ImFontAtlas* Fonts;
public float FontGlobalScale;
public byte FontAllowUserScaling;
public ImFont* FontDefault;
public Vector2 DisplayFramebufferScale;
public Vector2 DisplayVisibleMin;
public Vector2 DisplayVisibleMax;
public byte MouseDrawCursor;
public byte ConfigMacOSXBehaviors;
public byte ConfigInputTextCursorBlink;
public byte ConfigResizeWindowsFromEdges;
public IntPtr GetClipboardTextFn;
public IntPtr SetClipboardTextFn;
public void* ClipboardUserData;
public IntPtr ImeSetInputScreenPosFn;
public void* ImeWindowHandle;
public void* RenderDrawListsFnUnused;
public Vector2 MousePos;
public fixed byte MouseDown[5];
public float MouseWheel;
public float MouseWheelH;
public byte KeyCtrl;
public byte KeyShift;
public byte KeyAlt;
public byte KeySuper;
public fixed byte KeysDown[512];
public fixed ushort InputCharacters[17];
public fixed float NavInputs[21];
public byte WantCaptureMouse;
public byte WantCaptureKeyboard;
public byte WantTextInput;
public byte WantSetMousePos;
public byte WantSaveIniSettings;
public byte NavActive;
public byte NavVisible;
public float Framerate;
public int MetricsRenderVertices;
public int MetricsRenderIndices;
public int MetricsRenderWindows;
public int MetricsActiveWindows;
public int MetricsActiveAllocations;
public Vector2 MouseDelta;
public Vector2 MousePosPrev;
public Vector2 MouseClickedPos_0;
public Vector2 MouseClickedPos_1;
public Vector2 MouseClickedPos_2;
public Vector2 MouseClickedPos_3;
public Vector2 MouseClickedPos_4;
public fixed double MouseClickedTime[5];
public fixed byte MouseClicked[5];
public fixed byte MouseDoubleClicked[5];
public fixed byte MouseReleased[5];
public fixed byte MouseDownOwned[5];
public fixed float MouseDownDuration[5];
public fixed float MouseDownDurationPrev[5];
public Vector2 MouseDragMaxDistanceAbs_0;
public Vector2 MouseDragMaxDistanceAbs_1;
public Vector2 MouseDragMaxDistanceAbs_2;
public Vector2 MouseDragMaxDistanceAbs_3;
public Vector2 MouseDragMaxDistanceAbs_4;
public fixed float MouseDragMaxDistanceSqr[5];
public fixed float KeysDownDuration[512];
public fixed float KeysDownDurationPrev[512];
public fixed float NavInputsDownDuration[21];
public fixed float NavInputsDownDurationPrev[21];
}
public unsafe partial struct ImGuiIOPtr
{
public ImGuiIO* NativePtr { get; }
public ImGuiIOPtr(ImGuiIO* nativePtr) => NativePtr = nativePtr;
public ImGuiIOPtr(IntPtr nativePtr) => NativePtr = (ImGuiIO*)nativePtr;
public static implicit operator ImGuiIOPtr(ImGuiIO* nativePtr) => new ImGuiIOPtr(nativePtr);
public static implicit operator ImGuiIO* (ImGuiIOPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiIOPtr(IntPtr nativePtr) => new ImGuiIOPtr(nativePtr);
public ref ImGuiConfigFlags ConfigFlags => ref Unsafe.AsRef<ImGuiConfigFlags>(&NativePtr->ConfigFlags);
public ref ImGuiBackendFlags BackendFlags => ref Unsafe.AsRef<ImGuiBackendFlags>(&NativePtr->BackendFlags);
public ref Vector2 DisplaySize => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySize);
public ref float DeltaTime => ref Unsafe.AsRef<float>(&NativePtr->DeltaTime);
public ref float IniSavingRate => ref Unsafe.AsRef<float>(&NativePtr->IniSavingRate);
public NullTerminatedString IniFilename => new NullTerminatedString(NativePtr->IniFilename);
public NullTerminatedString LogFilename => new NullTerminatedString(NativePtr->LogFilename);
public ref float MouseDoubleClickTime => ref Unsafe.AsRef<float>(&NativePtr->MouseDoubleClickTime);
public ref float MouseDoubleClickMaxDist => ref Unsafe.AsRef<float>(&NativePtr->MouseDoubleClickMaxDist);
public ref float MouseDragThreshold => ref Unsafe.AsRef<float>(&NativePtr->MouseDragThreshold);
public RangeAccessor<int> KeyMap => new RangeAccessor<int>(NativePtr->KeyMap, 21);
public ref float KeyRepeatDelay => ref Unsafe.AsRef<float>(&NativePtr->KeyRepeatDelay);
public ref float KeyRepeatRate => ref Unsafe.AsRef<float>(&NativePtr->KeyRepeatRate);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ImFontAtlasPtr Fonts => new ImFontAtlasPtr(NativePtr->Fonts);
public ref float FontGlobalScale => ref Unsafe.AsRef<float>(&NativePtr->FontGlobalScale);
public ref Bool8 FontAllowUserScaling => ref Unsafe.AsRef<Bool8>(&NativePtr->FontAllowUserScaling);
public ImFontPtr FontDefault => new ImFontPtr(NativePtr->FontDefault);
public ref Vector2 DisplayFramebufferScale => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayFramebufferScale);
public ref Vector2 DisplayVisibleMin => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayVisibleMin);
public ref Vector2 DisplayVisibleMax => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayVisibleMax);
public ref Bool8 MouseDrawCursor => ref Unsafe.AsRef<Bool8>(&NativePtr->MouseDrawCursor);
public ref Bool8 ConfigMacOSXBehaviors => ref Unsafe.AsRef<Bool8>(&NativePtr->ConfigMacOSXBehaviors);
public ref Bool8 ConfigInputTextCursorBlink => ref Unsafe.AsRef<Bool8>(&NativePtr->ConfigInputTextCursorBlink);
public ref Bool8 ConfigResizeWindowsFromEdges => ref Unsafe.AsRef<Bool8>(&NativePtr->ConfigResizeWindowsFromEdges);
public ref IntPtr GetClipboardTextFn => ref Unsafe.AsRef<IntPtr>(&NativePtr->GetClipboardTextFn);
public ref IntPtr SetClipboardTextFn => ref Unsafe.AsRef<IntPtr>(&NativePtr->SetClipboardTextFn);
public IntPtr ClipboardUserData { get => (IntPtr)NativePtr->ClipboardUserData; set => NativePtr->ClipboardUserData = (void*)value; }
public ref IntPtr ImeSetInputScreenPosFn => ref Unsafe.AsRef<IntPtr>(&NativePtr->ImeSetInputScreenPosFn);
public IntPtr ImeWindowHandle { get => (IntPtr)NativePtr->ImeWindowHandle; set => NativePtr->ImeWindowHandle = (void*)value; }
public IntPtr RenderDrawListsFnUnused { get => (IntPtr)NativePtr->RenderDrawListsFnUnused; set => NativePtr->RenderDrawListsFnUnused = (void*)value; }
public ref Vector2 MousePos => ref Unsafe.AsRef<Vector2>(&NativePtr->MousePos);
public RangeAccessor<Bool8> MouseDown => new RangeAccessor<Bool8>(NativePtr->MouseDown, 5);
public ref float MouseWheel => ref Unsafe.AsRef<float>(&NativePtr->MouseWheel);
public ref float MouseWheelH => ref Unsafe.AsRef<float>(&NativePtr->MouseWheelH);
public ref Bool8 KeyCtrl => ref Unsafe.AsRef<Bool8>(&NativePtr->KeyCtrl);
public ref Bool8 KeyShift => ref Unsafe.AsRef<Bool8>(&NativePtr->KeyShift);
public ref Bool8 KeyAlt => ref Unsafe.AsRef<Bool8>(&NativePtr->KeyAlt);
public ref Bool8 KeySuper => ref Unsafe.AsRef<Bool8>(&NativePtr->KeySuper);
public RangeAccessor<Bool8> KeysDown => new RangeAccessor<Bool8>(NativePtr->KeysDown, 512);
public RangeAccessor<ushort> InputCharacters => new RangeAccessor<ushort>(NativePtr->InputCharacters, 17);
public RangeAccessor<float> NavInputs => new RangeAccessor<float>(NativePtr->NavInputs, 21);
public ref Bool8 WantCaptureMouse => ref Unsafe.AsRef<Bool8>(&NativePtr->WantCaptureMouse);
public ref Bool8 WantCaptureKeyboard => ref Unsafe.AsRef<Bool8>(&NativePtr->WantCaptureKeyboard);
public ref Bool8 WantTextInput => ref Unsafe.AsRef<Bool8>(&NativePtr->WantTextInput);
public ref Bool8 WantSetMousePos => ref Unsafe.AsRef<Bool8>(&NativePtr->WantSetMousePos);
public ref Bool8 WantSaveIniSettings => ref Unsafe.AsRef<Bool8>(&NativePtr->WantSaveIniSettings);
public ref Bool8 NavActive => ref Unsafe.AsRef<Bool8>(&NativePtr->NavActive);
public ref Bool8 NavVisible => ref Unsafe.AsRef<Bool8>(&NativePtr->NavVisible);
public ref float Framerate => ref Unsafe.AsRef<float>(&NativePtr->Framerate);
public ref int MetricsRenderVertices => ref Unsafe.AsRef<int>(&NativePtr->MetricsRenderVertices);
public ref int MetricsRenderIndices => ref Unsafe.AsRef<int>(&NativePtr->MetricsRenderIndices);
public ref int MetricsRenderWindows => ref Unsafe.AsRef<int>(&NativePtr->MetricsRenderWindows);
public ref int MetricsActiveWindows => ref Unsafe.AsRef<int>(&NativePtr->MetricsActiveWindows);
public ref int MetricsActiveAllocations => ref Unsafe.AsRef<int>(&NativePtr->MetricsActiveAllocations);
public ref Vector2 MouseDelta => ref Unsafe.AsRef<Vector2>(&NativePtr->MouseDelta);
public ref Vector2 MousePosPrev => ref Unsafe.AsRef<Vector2>(&NativePtr->MousePosPrev);
public RangeAccessor<Vector2> MouseClickedPos => new RangeAccessor<Vector2>(&NativePtr->MouseClickedPos_0, 5);
public RangeAccessor<double> MouseClickedTime => new RangeAccessor<double>(NativePtr->MouseClickedTime, 5);
public RangeAccessor<Bool8> MouseClicked => new RangeAccessor<Bool8>(NativePtr->MouseClicked, 5);
public RangeAccessor<Bool8> MouseDoubleClicked => new RangeAccessor<Bool8>(NativePtr->MouseDoubleClicked, 5);
public RangeAccessor<Bool8> MouseReleased => new RangeAccessor<Bool8>(NativePtr->MouseReleased, 5);
public RangeAccessor<Bool8> MouseDownOwned => new RangeAccessor<Bool8>(NativePtr->MouseDownOwned, 5);
public RangeAccessor<float> MouseDownDuration => new RangeAccessor<float>(NativePtr->MouseDownDuration, 5);
public RangeAccessor<float> MouseDownDurationPrev => new RangeAccessor<float>(NativePtr->MouseDownDurationPrev, 5);
public RangeAccessor<Vector2> MouseDragMaxDistanceAbs => new RangeAccessor<Vector2>(&NativePtr->MouseDragMaxDistanceAbs_0, 5);
public RangeAccessor<float> MouseDragMaxDistanceSqr => new RangeAccessor<float>(NativePtr->MouseDragMaxDistanceSqr, 5);
public RangeAccessor<float> KeysDownDuration => new RangeAccessor<float>(NativePtr->KeysDownDuration, 512);
public RangeAccessor<float> KeysDownDurationPrev => new RangeAccessor<float>(NativePtr->KeysDownDurationPrev, 512);
public RangeAccessor<float> NavInputsDownDuration => new RangeAccessor<float>(NativePtr->NavInputsDownDuration, 21);
public RangeAccessor<float> NavInputsDownDurationPrev => new RangeAccessor<float>(NativePtr->NavInputsDownDurationPrev, 21);
public void AddInputCharactersUTF8(string utf8_chars)
{
int utf8_chars_byteCount = Encoding.UTF8.GetByteCount(utf8_chars);
byte* native_utf8_chars = stackalloc byte[utf8_chars_byteCount + 1];
fixed (char* utf8_chars_ptr = utf8_chars)
{
int native_utf8_chars_offset = Encoding.UTF8.GetBytes(utf8_chars_ptr, utf8_chars.Length, native_utf8_chars, utf8_chars_byteCount);
native_utf8_chars[native_utf8_chars_offset] = 0;
}
ImGuiNative.ImGuiIO_AddInputCharactersUTF8(NativePtr, native_utf8_chars);
}
public void ClearInputCharacters()
{
ImGuiNative.ImGuiIO_ClearInputCharacters(NativePtr);
}
public void AddInputCharacter(ushort c)
{
ImGuiNative.ImGuiIO_AddInputCharacter(NativePtr, c);
}
}
}

@ -0,0 +1,65 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiInputTextCallbackData
{
public ImGuiInputTextFlags EventFlag;
public ImGuiInputTextFlags Flags;
public void* UserData;
public ushort EventChar;
public ImGuiKey EventKey;
public byte* Buf;
public int BufTextLen;
public int BufSize;
public byte BufDirty;
public int CursorPos;
public int SelectionStart;
public int SelectionEnd;
}
public unsafe partial struct ImGuiInputTextCallbackDataPtr
{
public ImGuiInputTextCallbackData* NativePtr { get; }
public ImGuiInputTextCallbackDataPtr(ImGuiInputTextCallbackData* nativePtr) => NativePtr = nativePtr;
public ImGuiInputTextCallbackDataPtr(IntPtr nativePtr) => NativePtr = (ImGuiInputTextCallbackData*)nativePtr;
public static implicit operator ImGuiInputTextCallbackDataPtr(ImGuiInputTextCallbackData* nativePtr) => new ImGuiInputTextCallbackDataPtr(nativePtr);
public static implicit operator ImGuiInputTextCallbackData* (ImGuiInputTextCallbackDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiInputTextCallbackDataPtr(IntPtr nativePtr) => new ImGuiInputTextCallbackDataPtr(nativePtr);
public ref ImGuiInputTextFlags EventFlag => ref Unsafe.AsRef<ImGuiInputTextFlags>(&NativePtr->EventFlag);
public ref ImGuiInputTextFlags Flags => ref Unsafe.AsRef<ImGuiInputTextFlags>(&NativePtr->Flags);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ref ushort EventChar => ref Unsafe.AsRef<ushort>(&NativePtr->EventChar);
public ref ImGuiKey EventKey => ref Unsafe.AsRef<ImGuiKey>(&NativePtr->EventKey);
public IntPtr Buf { get => (IntPtr)NativePtr->Buf; set => NativePtr->Buf = (byte*)value; }
public ref int BufTextLen => ref Unsafe.AsRef<int>(&NativePtr->BufTextLen);
public ref int BufSize => ref Unsafe.AsRef<int>(&NativePtr->BufSize);
public ref Bool8 BufDirty => ref Unsafe.AsRef<Bool8>(&NativePtr->BufDirty);
public ref int CursorPos => ref Unsafe.AsRef<int>(&NativePtr->CursorPos);
public ref int SelectionStart => ref Unsafe.AsRef<int>(&NativePtr->SelectionStart);
public ref int SelectionEnd => ref Unsafe.AsRef<int>(&NativePtr->SelectionEnd);
public void DeleteChars(int pos, int bytes_count)
{
ImGuiNative.ImGuiInputTextCallbackData_DeleteChars(NativePtr, pos, bytes_count);
}
public bool HasSelection()
{
byte ret = ImGuiNative.ImGuiInputTextCallbackData_HasSelection(NativePtr);
return ret != 0;
}
public void InsertChars(int pos, string text)
{
int text_byteCount = Encoding.UTF8.GetByteCount(text);
byte* native_text = stackalloc byte[text_byteCount + 1];
fixed (char* text_ptr = text)
{
int native_text_offset = Encoding.UTF8.GetBytes(text_ptr, text.Length, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
byte* native_text_end = null;
ImGuiNative.ImGuiInputTextCallbackData_InsertChars(NativePtr, pos, native_text, native_text_end);
}
}
}

@ -0,0 +1,28 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiInputTextFlags
{
None = 0,
CharsDecimal = 1 << 0,
CharsHexadecimal = 1 << 1,
CharsUppercase = 1 << 2,
CharsNoBlank = 1 << 3,
AutoSelectAll = 1 << 4,
EnterReturnsTrue = 1 << 5,
CallbackCompletion = 1 << 6,
CallbackHistory = 1 << 7,
CallbackAlways = 1 << 8,
CallbackCharFilter = 1 << 9,
AllowTabInput = 1 << 10,
CtrlEnterForNewLine = 1 << 11,
NoHorizontalScroll = 1 << 12,
AlwaysInsertMode = 1 << 13,
ReadOnly = 1 << 14,
Password = 1 << 15,
NoUndoRedo = 1 << 16,
CharsScientific = 1 << 17,
CallbackResize = 1 << 18,
Multiline = 1 << 20,
}
}

@ -0,0 +1,28 @@
namespace ImGuiNET
{
public enum ImGuiKey
{
Tab = 0,
LeftArrow = 1,
RightArrow = 2,
UpArrow = 3,
DownArrow = 4,
PageUp = 5,
PageDown = 6,
Home = 7,
End = 8,
Insert = 9,
Delete = 10,
Backspace = 11,
Space = 12,
Enter = 13,
Escape = 14,
A = 15,
C = 16,
V = 17,
X = 18,
Y = 19,
Z = 20,
COUNT = 21,
}
}

@ -0,0 +1,50 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiListClipper
{
public float StartPosY;
public float ItemsHeight;
public int ItemsCount;
public int StepNo;
public int DisplayStart;
public int DisplayEnd;
}
public unsafe partial struct ImGuiListClipperPtr
{
public ImGuiListClipper* NativePtr { get; }
public ImGuiListClipperPtr(ImGuiListClipper* nativePtr) => NativePtr = nativePtr;
public ImGuiListClipperPtr(IntPtr nativePtr) => NativePtr = (ImGuiListClipper*)nativePtr;
public static implicit operator ImGuiListClipperPtr(ImGuiListClipper* nativePtr) => new ImGuiListClipperPtr(nativePtr);
public static implicit operator ImGuiListClipper* (ImGuiListClipperPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiListClipperPtr(IntPtr nativePtr) => new ImGuiListClipperPtr(nativePtr);
public ref float StartPosY => ref Unsafe.AsRef<float>(&NativePtr->StartPosY);
public ref float ItemsHeight => ref Unsafe.AsRef<float>(&NativePtr->ItemsHeight);
public ref int ItemsCount => ref Unsafe.AsRef<int>(&NativePtr->ItemsCount);
public ref int StepNo => ref Unsafe.AsRef<int>(&NativePtr->StepNo);
public ref int DisplayStart => ref Unsafe.AsRef<int>(&NativePtr->DisplayStart);
public ref int DisplayEnd => ref Unsafe.AsRef<int>(&NativePtr->DisplayEnd);
public void End()
{
ImGuiNative.ImGuiListClipper_End(NativePtr);
}
public void Begin(int items_count)
{
float items_height = -1.0f;
ImGuiNative.ImGuiListClipper_Begin(NativePtr, items_count, items_height);
}
public void Begin(int items_count, float items_height)
{
ImGuiNative.ImGuiListClipper_Begin(NativePtr, items_count, items_height);
}
public bool Step()
{
byte ret = ImGuiNative.ImGuiListClipper_Step(NativePtr);
return ret != 0;
}
}
}

@ -0,0 +1,16 @@
namespace ImGuiNET
{
public enum ImGuiMouseCursor
{
None = -1,
Arrow = 0,
TextInput = 1,
ResizeAll = 2,
ResizeNS = 3,
ResizeEW = 4,
ResizeNESW = 5,
ResizeNWSE = 6,
Hand = 7,
COUNT = 8,
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,29 @@
namespace ImGuiNET
{
public enum ImGuiNavInput
{
Activate = 0,
Cancel = 1,
Input = 2,
Menu = 3,
DpadLeft = 4,
DpadRight = 5,
DpadUp = 6,
DpadDown = 7,
LStickLeft = 8,
LStickRight = 9,
LStickUp = 10,
LStickDown = 11,
FocusPrev = 12,
FocusNext = 13,
TweakSlow = 14,
TweakFast = 15,
KeyMenu = 16,
KeyLeft = 17,
KeyRight = 18,
KeyUp = 19,
KeyDown = 20,
COUNT = 21,
InternalStart = KeyMenu,
}
}

@ -0,0 +1,22 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiOnceUponAFrame
{
public int RefFrame;
}
public unsafe partial struct ImGuiOnceUponAFramePtr
{
public ImGuiOnceUponAFrame* NativePtr { get; }
public ImGuiOnceUponAFramePtr(ImGuiOnceUponAFrame* nativePtr) => NativePtr = nativePtr;
public ImGuiOnceUponAFramePtr(IntPtr nativePtr) => NativePtr = (ImGuiOnceUponAFrame*)nativePtr;
public static implicit operator ImGuiOnceUponAFramePtr(ImGuiOnceUponAFrame* nativePtr) => new ImGuiOnceUponAFramePtr(nativePtr);
public static implicit operator ImGuiOnceUponAFrame* (ImGuiOnceUponAFramePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiOnceUponAFramePtr(IntPtr nativePtr) => new ImGuiOnceUponAFramePtr(nativePtr);
public ref int RefFrame => ref Unsafe.AsRef<int>(&NativePtr->RefFrame);
}
}

@ -0,0 +1,62 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiPayload
{
public void* Data;
public int DataSize;
public uint SourceId;
public uint SourceParentId;
public int DataFrameCount;
public fixed byte DataType[33];
public byte Preview;
public byte Delivery;
}
public unsafe partial struct ImGuiPayloadPtr
{
public ImGuiPayload* NativePtr { get; }
public ImGuiPayloadPtr(ImGuiPayload* nativePtr) => NativePtr = nativePtr;
public ImGuiPayloadPtr(IntPtr nativePtr) => NativePtr = (ImGuiPayload*)nativePtr;
public static implicit operator ImGuiPayloadPtr(ImGuiPayload* nativePtr) => new ImGuiPayloadPtr(nativePtr);
public static implicit operator ImGuiPayload* (ImGuiPayloadPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiPayloadPtr(IntPtr nativePtr) => new ImGuiPayloadPtr(nativePtr);
public IntPtr Data { get => (IntPtr)NativePtr->Data; set => NativePtr->Data = (void*)value; }
public ref int DataSize => ref Unsafe.AsRef<int>(&NativePtr->DataSize);
public ref uint SourceId => ref Unsafe.AsRef<uint>(&NativePtr->SourceId);
public ref uint SourceParentId => ref Unsafe.AsRef<uint>(&NativePtr->SourceParentId);
public ref int DataFrameCount => ref Unsafe.AsRef<int>(&NativePtr->DataFrameCount);
public RangeAccessor<byte> DataType => new RangeAccessor<byte>(NativePtr->DataType, 33);
public ref Bool8 Preview => ref Unsafe.AsRef<Bool8>(&NativePtr->Preview);
public ref Bool8 Delivery => ref Unsafe.AsRef<Bool8>(&NativePtr->Delivery);
public void Clear()
{
ImGuiNative.ImGuiPayload_Clear(NativePtr);
}
public bool IsPreview()
{
byte ret = ImGuiNative.ImGuiPayload_IsPreview(NativePtr);
return ret != 0;
}
public bool IsDataType(string type)
{
int type_byteCount = Encoding.UTF8.GetByteCount(type);
byte* native_type = stackalloc byte[type_byteCount + 1];
fixed (char* type_ptr = type)
{
int native_type_offset = Encoding.UTF8.GetBytes(type_ptr, type.Length, native_type, type_byteCount);
native_type[native_type_offset] = 0;
}
byte ret = ImGuiNative.ImGuiPayload_IsDataType(NativePtr, native_type);
return ret != 0;
}
public bool IsDelivery()
{
byte ret = ImGuiNative.ImGuiPayload_IsDelivery(NativePtr);
return ret != 0;
}
}
}

@ -0,0 +1,12 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiSelectableFlags
{
None = 0,
DontClosePopups = 1 << 0,
SpanAllColumns = 1 << 1,
AllowDoubleClick = 1 << 2,
Disabled = 1 << 3,
}
}

@ -0,0 +1,28 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiSizeCallbackData
{
public void* UserData;
public Vector2 Pos;
public Vector2 CurrentSize;
public Vector2 DesiredSize;
}
public unsafe partial struct ImGuiSizeCallbackDataPtr
{
public ImGuiSizeCallbackData* NativePtr { get; }
public ImGuiSizeCallbackDataPtr(ImGuiSizeCallbackData* nativePtr) => NativePtr = nativePtr;
public ImGuiSizeCallbackDataPtr(IntPtr nativePtr) => NativePtr = (ImGuiSizeCallbackData*)nativePtr;
public static implicit operator ImGuiSizeCallbackDataPtr(ImGuiSizeCallbackData* nativePtr) => new ImGuiSizeCallbackDataPtr(nativePtr);
public static implicit operator ImGuiSizeCallbackData* (ImGuiSizeCallbackDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiSizeCallbackDataPtr(IntPtr nativePtr) => new ImGuiSizeCallbackDataPtr(nativePtr);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ref Vector2 Pos => ref Unsafe.AsRef<Vector2>(&NativePtr->Pos);
public ref Vector2 CurrentSize => ref Unsafe.AsRef<Vector2>(&NativePtr->CurrentSize);
public ref Vector2 DesiredSize => ref Unsafe.AsRef<Vector2>(&NativePtr->DesiredSize);
}
}

@ -0,0 +1,137 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiStorage
{
public ImVector/*<Pair>*/ Data;
}
public unsafe partial struct ImGuiStoragePtr
{
public ImGuiStorage* NativePtr { get; }
public ImGuiStoragePtr(ImGuiStorage* nativePtr) => NativePtr = nativePtr;
public ImGuiStoragePtr(IntPtr nativePtr) => NativePtr = (ImGuiStorage*)nativePtr;
public static implicit operator ImGuiStoragePtr(ImGuiStorage* nativePtr) => new ImGuiStoragePtr(nativePtr);
public static implicit operator ImGuiStorage* (ImGuiStoragePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiStoragePtr(IntPtr nativePtr) => new ImGuiStoragePtr(nativePtr);
public ImVector<Pair> Data => new ImVector<Pair>(NativePtr->Data);
public void SetFloat(uint key, float val)
{
ImGuiNative.ImGuiStorage_SetFloat(NativePtr, key, val);
}
public IntPtr GetVoidPtr(uint key)
{
void* ret = ImGuiNative.ImGuiStorage_GetVoidPtr(NativePtr, key);
return (IntPtr)ret;
}
public float* GetFloatRef(uint key)
{
float default_val = 0.0f;
float* ret = ImGuiNative.ImGuiStorage_GetFloatRef(NativePtr, key, default_val);
return ret;
}
public float* GetFloatRef(uint key, float default_val)
{
float* ret = ImGuiNative.ImGuiStorage_GetFloatRef(NativePtr, key, default_val);
return ret;
}
public void SetAllInt(int val)
{
ImGuiNative.ImGuiStorage_SetAllInt(NativePtr, val);
}
public void** GetVoidPtrRef(uint key)
{
void* default_val = null;
void** ret = ImGuiNative.ImGuiStorage_GetVoidPtrRef(NativePtr, key, default_val);
return ret;
}
public void** GetVoidPtrRef(uint key, IntPtr default_val)
{
void* native_default_val = default_val.ToPointer();
void** ret = ImGuiNative.ImGuiStorage_GetVoidPtrRef(NativePtr, key, native_default_val);
return ret;
}
public byte* GetBoolRef(uint key)
{
byte default_val = 0;
byte* ret = ImGuiNative.ImGuiStorage_GetBoolRef(NativePtr, key, default_val);
return ret;
}
public byte* GetBoolRef(uint key, bool default_val)
{
byte native_default_val = default_val ? (byte)1 : (byte)0;
byte* ret = ImGuiNative.ImGuiStorage_GetBoolRef(NativePtr, key, native_default_val);
return ret;
}
public int* GetIntRef(uint key)
{
int default_val = 0;
int* ret = ImGuiNative.ImGuiStorage_GetIntRef(NativePtr, key, default_val);
return ret;
}
public int* GetIntRef(uint key, int default_val)
{
int* ret = ImGuiNative.ImGuiStorage_GetIntRef(NativePtr, key, default_val);
return ret;
}
public void SetVoidPtr(uint key, IntPtr val)
{
void* native_val = val.ToPointer();
ImGuiNative.ImGuiStorage_SetVoidPtr(NativePtr, key, native_val);
}
public void BuildSortByKey()
{
ImGuiNative.ImGuiStorage_BuildSortByKey(NativePtr);
}
public float GetFloat(uint key)
{
float default_val = 0.0f;
float ret = ImGuiNative.ImGuiStorage_GetFloat(NativePtr, key, default_val);
return ret;
}
public float GetFloat(uint key, float default_val)
{
float ret = ImGuiNative.ImGuiStorage_GetFloat(NativePtr, key, default_val);
return ret;
}
public void SetBool(uint key, bool val)
{
byte native_val = val ? (byte)1 : (byte)0;
ImGuiNative.ImGuiStorage_SetBool(NativePtr, key, native_val);
}
public bool GetBool(uint key)
{
byte default_val = 0;
byte ret = ImGuiNative.ImGuiStorage_GetBool(NativePtr, key, default_val);
return ret != 0;
}
public bool GetBool(uint key, bool default_val)
{
byte native_default_val = default_val ? (byte)1 : (byte)0;
byte ret = ImGuiNative.ImGuiStorage_GetBool(NativePtr, key, native_default_val);
return ret != 0;
}
public void SetInt(uint key, int val)
{
ImGuiNative.ImGuiStorage_SetInt(NativePtr, key, val);
}
public void Clear()
{
ImGuiNative.ImGuiStorage_Clear(NativePtr);
}
public int GetInt(uint key)
{
int default_val = 0;
int ret = ImGuiNative.ImGuiStorage_GetInt(NativePtr, key, default_val);
return ret;
}
public int GetInt(uint key, int default_val)
{
int ret = ImGuiNative.ImGuiStorage_GetInt(NativePtr, key, default_val);
return ret;
}
}
}

@ -0,0 +1,126 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiStyle
{
public float Alpha;
public Vector2 WindowPadding;
public float WindowRounding;
public float WindowBorderSize;
public Vector2 WindowMinSize;
public Vector2 WindowTitleAlign;
public float ChildRounding;
public float ChildBorderSize;
public float PopupRounding;
public float PopupBorderSize;
public Vector2 FramePadding;
public float FrameRounding;
public float FrameBorderSize;
public Vector2 ItemSpacing;
public Vector2 ItemInnerSpacing;
public Vector2 TouchExtraPadding;
public float IndentSpacing;
public float ColumnsMinSpacing;
public float ScrollbarSize;
public float ScrollbarRounding;
public float GrabMinSize;
public float GrabRounding;
public Vector2 ButtonTextAlign;
public Vector2 DisplayWindowPadding;
public Vector2 DisplaySafeAreaPadding;
public float MouseCursorScale;
public byte AntiAliasedLines;
public byte AntiAliasedFill;
public float CurveTessellationTol;
public Vector4 Colors_0;
public Vector4 Colors_1;
public Vector4 Colors_2;
public Vector4 Colors_3;
public Vector4 Colors_4;
public Vector4 Colors_5;
public Vector4 Colors_6;
public Vector4 Colors_7;
public Vector4 Colors_8;
public Vector4 Colors_9;
public Vector4 Colors_10;
public Vector4 Colors_11;
public Vector4 Colors_12;
public Vector4 Colors_13;
public Vector4 Colors_14;
public Vector4 Colors_15;
public Vector4 Colors_16;
public Vector4 Colors_17;
public Vector4 Colors_18;
public Vector4 Colors_19;
public Vector4 Colors_20;
public Vector4 Colors_21;
public Vector4 Colors_22;
public Vector4 Colors_23;
public Vector4 Colors_24;
public Vector4 Colors_25;
public Vector4 Colors_26;
public Vector4 Colors_27;
public Vector4 Colors_28;
public Vector4 Colors_29;
public Vector4 Colors_30;
public Vector4 Colors_31;
public Vector4 Colors_32;
public Vector4 Colors_33;
public Vector4 Colors_34;
public Vector4 Colors_35;
public Vector4 Colors_36;
public Vector4 Colors_37;
public Vector4 Colors_38;
public Vector4 Colors_39;
public Vector4 Colors_40;
public Vector4 Colors_41;
public Vector4 Colors_42;
}
public unsafe partial struct ImGuiStylePtr
{
public ImGuiStyle* NativePtr { get; }
public ImGuiStylePtr(ImGuiStyle* nativePtr) => NativePtr = nativePtr;
public ImGuiStylePtr(IntPtr nativePtr) => NativePtr = (ImGuiStyle*)nativePtr;
public static implicit operator ImGuiStylePtr(ImGuiStyle* nativePtr) => new ImGuiStylePtr(nativePtr);
public static implicit operator ImGuiStyle* (ImGuiStylePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiStylePtr(IntPtr nativePtr) => new ImGuiStylePtr(nativePtr);
public ref float Alpha => ref Unsafe.AsRef<float>(&NativePtr->Alpha);
public ref Vector2 WindowPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->WindowPadding);
public ref float WindowRounding => ref Unsafe.AsRef<float>(&NativePtr->WindowRounding);
public ref float WindowBorderSize => ref Unsafe.AsRef<float>(&NativePtr->WindowBorderSize);
public ref Vector2 WindowMinSize => ref Unsafe.AsRef<Vector2>(&NativePtr->WindowMinSize);
public ref Vector2 WindowTitleAlign => ref Unsafe.AsRef<Vector2>(&NativePtr->WindowTitleAlign);
public ref float ChildRounding => ref Unsafe.AsRef<float>(&NativePtr->ChildRounding);
public ref float ChildBorderSize => ref Unsafe.AsRef<float>(&NativePtr->ChildBorderSize);
public ref float PopupRounding => ref Unsafe.AsRef<float>(&NativePtr->PopupRounding);
public ref float PopupBorderSize => ref Unsafe.AsRef<float>(&NativePtr->PopupBorderSize);
public ref Vector2 FramePadding => ref Unsafe.AsRef<Vector2>(&NativePtr->FramePadding);
public ref float FrameRounding => ref Unsafe.AsRef<float>(&NativePtr->FrameRounding);
public ref float FrameBorderSize => ref Unsafe.AsRef<float>(&NativePtr->FrameBorderSize);
public ref Vector2 ItemSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->ItemSpacing);
public ref Vector2 ItemInnerSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->ItemInnerSpacing);
public ref Vector2 TouchExtraPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->TouchExtraPadding);
public ref float IndentSpacing => ref Unsafe.AsRef<float>(&NativePtr->IndentSpacing);
public ref float ColumnsMinSpacing => ref Unsafe.AsRef<float>(&NativePtr->ColumnsMinSpacing);
public ref float ScrollbarSize => ref Unsafe.AsRef<float>(&NativePtr->ScrollbarSize);
public ref float ScrollbarRounding => ref Unsafe.AsRef<float>(&NativePtr->ScrollbarRounding);
public ref float GrabMinSize => ref Unsafe.AsRef<float>(&NativePtr->GrabMinSize);
public ref float GrabRounding => ref Unsafe.AsRef<float>(&NativePtr->GrabRounding);
public ref Vector2 ButtonTextAlign => ref Unsafe.AsRef<Vector2>(&NativePtr->ButtonTextAlign);
public ref Vector2 DisplayWindowPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayWindowPadding);
public ref Vector2 DisplaySafeAreaPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySafeAreaPadding);
public ref float MouseCursorScale => ref Unsafe.AsRef<float>(&NativePtr->MouseCursorScale);
public ref Bool8 AntiAliasedLines => ref Unsafe.AsRef<Bool8>(&NativePtr->AntiAliasedLines);
public ref Bool8 AntiAliasedFill => ref Unsafe.AsRef<Bool8>(&NativePtr->AntiAliasedFill);
public ref float CurveTessellationTol => ref Unsafe.AsRef<float>(&NativePtr->CurveTessellationTol);
public RangeAccessor<Vector4> Colors => new RangeAccessor<Vector4>(&NativePtr->Colors_0, 43);
public void ScaleAllSizes(float scale_factor)
{
ImGuiNative.ImGuiStyle_ScaleAllSizes(NativePtr, scale_factor);
}
}
}

@ -0,0 +1,28 @@
namespace ImGuiNET
{
public enum ImGuiStyleVar
{
Alpha = 0,
WindowPadding = 1,
WindowRounding = 2,
WindowBorderSize = 3,
WindowMinSize = 4,
WindowTitleAlign = 5,
ChildRounding = 6,
ChildBorderSize = 7,
PopupRounding = 8,
PopupBorderSize = 9,
FramePadding = 10,
FrameRounding = 11,
FrameBorderSize = 12,
ItemSpacing = 13,
ItemInnerSpacing = 14,
IndentSpacing = 15,
ScrollbarSize = 16,
ScrollbarRounding = 17,
GrabMinSize = 18,
GrabRounding = 19,
ButtonTextAlign = 20,
COUNT = 21,
}
}

@ -0,0 +1,66 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTextBuffer
{
public ImVector/*<char>*/ Buf;
}
public unsafe partial struct ImGuiTextBufferPtr
{
public ImGuiTextBuffer* NativePtr { get; }
public ImGuiTextBufferPtr(ImGuiTextBuffer* nativePtr) => NativePtr = nativePtr;
public ImGuiTextBufferPtr(IntPtr nativePtr) => NativePtr = (ImGuiTextBuffer*)nativePtr;
public static implicit operator ImGuiTextBufferPtr(ImGuiTextBuffer* nativePtr) => new ImGuiTextBufferPtr(nativePtr);
public static implicit operator ImGuiTextBuffer* (ImGuiTextBufferPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTextBufferPtr(IntPtr nativePtr) => new ImGuiTextBufferPtr(nativePtr);
public ImVector<byte> Buf => new ImVector<byte>(NativePtr->Buf);
public void clear()
{
ImGuiNative.ImGuiTextBuffer_clear(NativePtr);
}
public void appendf(string fmt)
{
int fmt_byteCount = Encoding.UTF8.GetByteCount(fmt);
byte* native_fmt = stackalloc byte[fmt_byteCount + 1];
fixed (char* fmt_ptr = fmt)
{
int native_fmt_offset = Encoding.UTF8.GetBytes(fmt_ptr, fmt.Length, native_fmt, fmt_byteCount);
native_fmt[native_fmt_offset] = 0;
}
ImGuiNative.ImGuiTextBuffer_appendf(NativePtr, native_fmt);
}
public string c_str()
{
byte* ret = ImGuiNative.ImGuiTextBuffer_c_str(NativePtr);
return Util.StringFromPtr(ret);
}
public void reserve(int capacity)
{
ImGuiNative.ImGuiTextBuffer_reserve(NativePtr, capacity);
}
public bool empty()
{
byte ret = ImGuiNative.ImGuiTextBuffer_empty(NativePtr);
return ret != 0;
}
public int size()
{
int ret = ImGuiNative.ImGuiTextBuffer_size(NativePtr);
return ret;
}
public string begin()
{
byte* ret = ImGuiNative.ImGuiTextBuffer_begin(NativePtr);
return Util.StringFromPtr(ret);
}
public string end()
{
byte* ret = ImGuiNative.ImGuiTextBuffer_end(NativePtr);
return Util.StringFromPtr(ret);
}
}
}

@ -0,0 +1,90 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTextFilter
{
public fixed byte InputBuf[256];
public ImVector/*<TextRange>*/ Filters;
public int CountGrep;
}
public unsafe partial struct ImGuiTextFilterPtr
{
public ImGuiTextFilter* NativePtr { get; }
public ImGuiTextFilterPtr(ImGuiTextFilter* nativePtr) => NativePtr = nativePtr;
public ImGuiTextFilterPtr(IntPtr nativePtr) => NativePtr = (ImGuiTextFilter*)nativePtr;
public static implicit operator ImGuiTextFilterPtr(ImGuiTextFilter* nativePtr) => new ImGuiTextFilterPtr(nativePtr);
public static implicit operator ImGuiTextFilter* (ImGuiTextFilterPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTextFilterPtr(IntPtr nativePtr) => new ImGuiTextFilterPtr(nativePtr);
public RangeAccessor<byte> InputBuf => new RangeAccessor<byte>(NativePtr->InputBuf, 256);
public ImVector<TextRange> Filters => new ImVector<TextRange>(NativePtr->Filters);
public ref int CountGrep => ref Unsafe.AsRef<int>(&NativePtr->CountGrep);
public void Build()
{
ImGuiNative.ImGuiTextFilter_Build(NativePtr);
}
public bool Draw()
{
int label_byteCount = Encoding.UTF8.GetByteCount("Filter(inc,-exc)");
byte* native_label = stackalloc byte[label_byteCount + 1];
fixed (char* label_ptr = "Filter(inc,-exc)")
{
int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, "Filter(inc,-exc)".Length, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
float width = 0.0f;
byte ret = ImGuiNative.ImGuiTextFilter_Draw(NativePtr, native_label, width);
return ret != 0;
}
public bool Draw(string label)
{
int label_byteCount = Encoding.UTF8.GetByteCount(label);
byte* native_label = stackalloc byte[label_byteCount + 1];
fixed (char* label_ptr = label)
{
int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
float width = 0.0f;
byte ret = ImGuiNative.ImGuiTextFilter_Draw(NativePtr, native_label, width);
return ret != 0;
}
public bool Draw(string label, float width)
{
int label_byteCount = Encoding.UTF8.GetByteCount(label);
byte* native_label = stackalloc byte[label_byteCount + 1];
fixed (char* label_ptr = label)
{
int native_label_offset = Encoding.UTF8.GetBytes(label_ptr, label.Length, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
byte ret = ImGuiNative.ImGuiTextFilter_Draw(NativePtr, native_label, width);
return ret != 0;
}
public bool IsActive()
{
byte ret = ImGuiNative.ImGuiTextFilter_IsActive(NativePtr);
return ret != 0;
}
public void Clear()
{
ImGuiNative.ImGuiTextFilter_Clear(NativePtr);
}
public bool PassFilter(string text)
{
int text_byteCount = Encoding.UTF8.GetByteCount(text);
byte* native_text = stackalloc byte[text_byteCount + 1];
fixed (char* text_ptr = text)
{
int native_text_offset = Encoding.UTF8.GetBytes(text_ptr, text.Length, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
byte* native_text_end = null;
byte ret = ImGuiNative.ImGuiTextFilter_PassFilter(NativePtr, native_text, native_text_end);
return ret != 0;
}
}
}

@ -0,0 +1,21 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTreeNodeFlags
{
None = 0,
Selected = 1 << 0,
Framed = 1 << 1,
AllowItemOverlap = 1 << 2,
NoTreePushOnOpen = 1 << 3,
NoAutoOpenOnLog = 1 << 4,
DefaultOpen = 1 << 5,
OpenOnDoubleClick = 1 << 6,
OpenOnArrow = 1 << 7,
Leaf = 1 << 8,
Bullet = 1 << 9,
FramePadding = 1 << 10,
NavLeftJumpsBackHere = 1 << 13,
CollapsingHeader = Framed | NoTreePushOnOpen | NoAutoOpenOnLog,
}
}

@ -0,0 +1,33 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiWindowFlags
{
None = 0,
NoTitleBar = 1 << 0,
NoResize = 1 << 1,
NoMove = 1 << 2,
NoScrollbar = 1 << 3,
NoScrollWithMouse = 1 << 4,
NoCollapse = 1 << 5,
AlwaysAutoResize = 1 << 6,
NoSavedSettings = 1 << 8,
NoInputs = 1 << 9,
MenuBar = 1 << 10,
HorizontalScrollbar = 1 << 11,
NoFocusOnAppearing = 1 << 12,
NoBringToFrontOnFocus = 1 << 13,
AlwaysVerticalScrollbar = 1 << 14,
AlwaysHorizontalScrollbar = 1<< 15,
AlwaysUseWindowPadding = 1 << 16,
NoNavInputs = 1 << 18,
NoNavFocus = 1 << 19,
NoNav = NoNavInputs | NoNavFocus,
NavFlattened = 1 << 23,
ChildWindow = 1 << 24,
Tooltip = 1 << 25,
Popup = 1 << 26,
Modal = 1 << 27,
ChildMenu = 1 << 28,
}
}

@ -0,0 +1,46 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct TextRange
{
public byte* b;
public byte* e;
}
public unsafe partial struct TextRangePtr
{
public TextRange* NativePtr { get; }
public TextRangePtr(TextRange* nativePtr) => NativePtr = nativePtr;
public TextRangePtr(IntPtr nativePtr) => NativePtr = (TextRange*)nativePtr;
public static implicit operator TextRangePtr(TextRange* nativePtr) => new TextRangePtr(nativePtr);
public static implicit operator TextRange* (TextRangePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator TextRangePtr(IntPtr nativePtr) => new TextRangePtr(nativePtr);
public IntPtr b { get => (IntPtr)NativePtr->b; set => NativePtr->b = (byte*)value; }
public IntPtr e { get => (IntPtr)NativePtr->e; set => NativePtr->e = (byte*)value; }
public void split(byte separator, ref ImVector @out)
{
fixed (ImVector* native_out = &@out)
{
ImGuiNative.TextRange_split(NativePtr, separator, native_out);
}
}
public string end()
{
byte* ret = ImGuiNative.TextRange_end(NativePtr);
return Util.StringFromPtr(ret);
}
public string begin()
{
byte* ret = ImGuiNative.TextRange_begin(NativePtr);
return Util.StringFromPtr(ret);
}
public bool empty()
{
byte ret = ImGuiNative.TextRange_empty(NativePtr);
return ret != 0;
}
}
}

@ -1,80 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array
/// </summary>
public enum GuiKey : int
{
/// <summary>
/// for tabbing through fields
/// </summary>
Tab,
/// <summary>
/// for text edit
/// </summary>
LeftArrow,
/// <summary>
/// for text edit
/// </summary>
RightArrow,
/// <summary>
/// for text edit
/// </summary>
UpArrow,
/// <summary>
/// for text edit
/// </summary>
DownArrow,
PageUp,
PageDown,
/// <summary>
/// for text edit
/// </summary>
Home,
/// <summary>
/// for text edit
/// </summary>
End,
/// <summary>
/// for text edit
/// </summary>
Delete,
/// <summary>
/// for text edit
/// </summary>
Backspace,
/// <summary>
/// for text edit
/// </summary>
Enter,
/// <summary>
/// for text edit
/// </summary>
Escape,
/// <summary>
/// for text edit CTRL+A: select all
/// </summary>
A,
/// <summary>
/// for text edit CTRL+C: copy
/// </summary>
C,
/// <summary>
/// for text edit CTRL+V: paste
/// </summary>
V,
/// <summary>
/// for text edit CTRL+X: cut
/// </summary>
X,
/// <summary>
/// for text edit CTRL+Y: redo
/// </summary>
Y,
/// <summary>
/// for text edit CTRL+Z: undo
/// </summary>
Z,
Count
}
}

@ -1,15 +0,0 @@
namespace ImGuiNET
{
// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
public enum HoveredFlags
{
Default = 0, // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
AllowWhenBlockedByPopup = 1 << 2, // Return true even if a popup window is normally blocking access to this item/window
AllowWhenBlockedByActiveItem = 1 << 4, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
AllowWhenOverlapped = 1 << 5, // Return true even if the position is overlapped by another window
RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped,
RootAndChildWindows = RootWindow | ChildWindows
}
}

@ -1,336 +0,0 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
public unsafe class IO
{
private NativeIO* _nativePtr;
internal IO(NativeIO* nativePtr)
{
_nativePtr = nativePtr;
MouseDown = new MouseDownStates(nativePtr);
KeyMap = new KeyMap(_nativePtr);
KeysDown = new KeyDownStates(_nativePtr);
FontAtlas = new FontAtlas(_nativePtr->FontAtlas);
}
public NativeIO* GetNativePointer() => _nativePtr;
/// <summary>
/// Display size, in pixels. For clamping windows positions.
/// Default value: [unset]
/// </summary>
public Vector2 DisplaySize
{
get { return _nativePtr->DisplaySize; }
set { _nativePtr->DisplaySize = value; }
}
/// <summary>
/// Time elapsed since last frame, in seconds.
/// Default value: 1.0f / 10.0f.
/// </summary>
public float DeltaTime
{
get { return _nativePtr->DeltaTime; }
set { _nativePtr->DeltaTime = value; }
}
/// <summary>
/// For retina display or other situations where window coordinates are different from framebuffer coordinates.
/// User storage only, presently not used by ImGui.
/// Default value: (1.0f, 1.0f).
/// </summary>
public Vector2 DisplayFramebufferScale
{
get { return _nativePtr->DisplayFramebufferScale; }
set { _nativePtr->DisplayFramebufferScale = value; }
}
/// <summary>
/// Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.).
/// </summary>
public Vector2 MousePosition
{
get { return _nativePtr->MousePos; }
set { _nativePtr->MousePos = value; }
}
/// <summary>
/// Mouse wheel: 1 unit scrolls about 5 lines text.
/// </summary>
public float MouseWheel
{
get { return _nativePtr->MouseWheel; }
set { _nativePtr->MouseWheel = value; }
}
/// <summary>
/// Mouse buttons: left, right, middle + extras.
/// ImGui itself mostly only uses left button (BeginPopupContext** are using right button).
/// Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
/// </summary>
public MouseDownStates MouseDown { get; }
/// <summary>
/// Map of indices into the KeysDown[512] entries array.
/// Default values: [unset]
/// </summary>
public KeyMap KeyMap { get; }
/// <summary>
/// Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
/// </summary>
public KeyDownStates KeysDown { get; }
public FontAtlas FontAtlas { get; }
public bool FontAllowUserScaling
{
get { return _nativePtr->FontAllowUserScaling != 0; }
set { _nativePtr->FontAllowUserScaling = value ? (byte)1 : (byte)0; }
}
/// <summary>
/// Keyboard modifier pressed: Control.
/// </summary>
public bool CtrlPressed
{
get { return _nativePtr->KeyCtrl == 1; }
set { _nativePtr->KeyCtrl = value ? (byte)1 : (byte)0; }
}
/// <summary>
/// Keyboard modifier pressed: Shift
/// </summary>
public bool ShiftPressed
{
get { return _nativePtr->KeyShift == 1; }
set { _nativePtr->KeyShift = value ? (byte)1 : (byte)0; }
}
/// <summary>
/// Keyboard modifier pressed: Alt
/// </summary>
public bool AltPressed
{
get { return _nativePtr->KeyAlt == 1; }
set { _nativePtr->KeyAlt = value ? (byte)1 : (byte)0; }
}
/// <summary>
/// Keyboard modifier pressed: Cmd/Super/Windows
/// </summary>
public bool SuperPressed
{
get { return _nativePtr->KeySuper == 1; }
set { _nativePtr->KeySuper = value ? (byte)1 : (byte)0; }
}
public bool WantCaptureMouse
{
get { return _nativePtr->WantCaptureMouse == 1; }
set { _nativePtr->WantCaptureMouse = value ? (byte)1 : (byte)0; }
}
public bool WantCaptureKeyboard
{
get { return _nativePtr->WantCaptureKeyboard == 1; }
set { _nativePtr->WantCaptureKeyboard = value ? (byte)1 : (byte)0; }
}
public bool WantTextInput
{
get { return _nativePtr->WantTextInput == 1; }
set { _nativePtr->WantTextInput = value ? (byte)1 : (byte)0; }
}
public float Framerate
{
get { return _nativePtr->Framerate; }
set { _nativePtr->Framerate = value; }
}
}
public unsafe class KeyMap
{
private readonly NativeIO* _nativePtr;
public KeyMap(NativeIO* nativePtr)
{
_nativePtr = nativePtr;
}
public int this[GuiKey key]
{
get
{
return _nativePtr->KeyMap[(int)key];
}
set
{
_nativePtr->KeyMap[(int)key] = value;
}
}
}
public unsafe class MouseDownStates
{
private readonly NativeIO* _nativePtr;
public MouseDownStates(NativeIO* nativePtr)
{
_nativePtr = nativePtr;
}
public bool this[int button]
{
get
{
if (button < 0 || button > 5)
{
throw new ArgumentOutOfRangeException(nameof(button));
}
return _nativePtr->MouseDown[button] == 1;
}
set
{
if (button < 0 || button > 5)
{
throw new ArgumentOutOfRangeException(nameof(button));
}
byte pressed = value ? (byte)1 : (byte)0;
_nativePtr->MouseDown[button] = pressed;
}
}
}
public unsafe class KeyDownStates
{
private readonly NativeIO* _nativePtr;
public KeyDownStates(NativeIO* nativePtr)
{
_nativePtr = nativePtr;
}
public bool this[int key]
{
get
{
if (key < 0 || key > 512)
{
throw new ArgumentOutOfRangeException(nameof(key));
}
return _nativePtr->KeysDown[key] == 1;
}
set
{
if (key < 0 || key > 512)
{
throw new ArgumentOutOfRangeException(nameof(key));
}
byte pressed = value ? (byte)1 : (byte)0;
_nativePtr->KeysDown[key] = pressed;
}
}
}
public unsafe class FontAtlas
{
private readonly NativeFontAtlas* _atlasPtr;
public FontAtlas(NativeFontAtlas* atlasPtr)
{
_atlasPtr = atlasPtr;
}
public FontTextureData GetTexDataAsAlpha8()
{
byte* pixels;
int width, height;
int bytesPerPixel;
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8(_atlasPtr, &pixels, &width, &height, &bytesPerPixel);
return new FontTextureData(pixels, width, height, bytesPerPixel);
}
public FontTextureData GetTexDataAsRGBA32()
{
byte* pixels;
int width, height;
int bytesPerPixel;
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32(_atlasPtr, &pixels, &width, &height, &bytesPerPixel);
return new FontTextureData(pixels, width, height, bytesPerPixel);
}
public void SetTexID(int textureID)
{
SetTexID(new IntPtr(textureID));
}
public void SetTexID(IntPtr textureID)
{
ImGuiNative.ImFontAtlas_SetTexID(_atlasPtr, textureID.ToPointer());
}
public void Clear()
{
ImGuiNative.ImFontAtlas_Clear(_atlasPtr);
}
public void ClearTexData()
{
ImGuiNative.ImFontAtlas_ClearTexData(_atlasPtr);
}
public Font AddDefaultFont()
{
NativeFont* nativeFontPtr = ImGuiNative.ImFontAtlas_AddFontDefault(_atlasPtr);
return new Font(nativeFontPtr);
}
public Font AddFontFromFileTTF(string fileName, float pixelSize)
{
NativeFont* nativeFontPtr = ImGuiNative.ImFontAtlas_AddFontFromFileTTF(_atlasPtr, fileName, pixelSize, IntPtr.Zero, null);
return new Font(nativeFontPtr);
}
public Font AddFontFromMemoryTTF(IntPtr ttfData, int ttfDataSize, float pixelSize)
{
NativeFont* nativeFontPtr = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(_atlasPtr, ttfData.ToPointer(), ttfDataSize, pixelSize, IntPtr.Zero, null);
return new Font(nativeFontPtr);
}
public Font AddFontFromMemoryTTF(IntPtr ttfData, int ttfDataSize, float pixelSize, IntPtr fontConfig)
{
NativeFont* nativeFontPtr = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF(_atlasPtr, ttfData.ToPointer(), ttfDataSize, pixelSize, fontConfig, null);
return new Font(nativeFontPtr);
}
}
public unsafe struct FontTextureData
{
public readonly byte* Pixels;
public readonly int Width;
public readonly int Height;
public readonly int BytesPerPixel;
public FontTextureData(byte* pixels, int width, int height, int bytesPerPixel)
{
Pixels = pixels;
Width = width;
Height = height;
BytesPerPixel = bytesPerPixel;
}
}
}

@ -0,0 +1,7 @@
namespace ImGuiNET
{
public unsafe partial struct ImDrawDataPtr
{
public RangePtrAccessor<ImDrawListPtr> CmdListsRange => new RangePtrAccessor<ImDrawListPtr>(CmdLists.ToPointer(), CmdListsCount);
}
}

@ -0,0 +1,37 @@
using System.Numerics;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawListPtr
{
public void AddText(Vector2 pos, uint col, string text_begin)
{
int text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
byte* native_text_begin = stackalloc byte[text_begin_byteCount + 1];
fixed (char* text_begin_ptr = text_begin)
{
int native_text_begin_offset = Encoding.UTF8.GetBytes(text_begin_ptr, text_begin.Length, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
}
byte* native_text_end = null;
ImGuiNative.ImDrawList_AddText(NativePtr, pos, col, native_text_begin, native_text_end);
}
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, string text_begin)
{
ImFont* native_font = font.NativePtr;
int text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
byte* native_text_begin = stackalloc byte[text_begin_byteCount + 1];
fixed (char* text_begin_ptr = text_begin)
{
int native_text_begin_offset = Encoding.UTF8.GetBytes(text_begin_ptr, text_begin.Length, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
}
byte* native_text_end = null;
float wrap_width = 0.0f;
Vector4* cpu_fine_clip_rect = null;
ImGuiNative.ImDrawList_AddTextFontPtr(NativePtr, native_font, font_size, pos, col, native_text_begin, native_text_end, wrap_width, cpu_fine_clip_rect);
}
}
}

@ -0,0 +1,122 @@
using System;
using System.Text;
namespace ImGuiNET
{
public static unsafe partial class ImGui
{
public static bool InputText(
string label,
byte[] buf,
uint buf_size)
{
return InputText(label, buf, buf_size, 0, null, IntPtr.Zero);
}
public static bool InputText(
string label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags)
{
return InputText(label, buf, buf_size, flags, null, IntPtr.Zero);
}
public static bool InputText(
string label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback)
{
return InputText(label, buf, buf_size, flags, callback, IntPtr.Zero);
}
public static bool InputText(
string label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int labelByteCount = Encoding.UTF8.GetByteCount(label);
byte* labelBytes = stackalloc byte[labelByteCount];
fixed (char* labelPtr = label)
{
Encoding.UTF8.GetBytes(labelPtr, label.Length, labelBytes, labelByteCount);
}
fixed (byte* bufPtr = buf)
{
return ImGuiNative.igInputText(labelBytes, bufPtr, buf_size, flags, callback, user_data.ToPointer()) != 0;
}
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size)
{
return InputText(label, buf, buf_size, 0, null, IntPtr.Zero);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags)
{
return InputText(label, buf, buf_size, flags, null, IntPtr.Zero);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback)
{
return InputText(label, buf, buf_size, flags, callback, IntPtr.Zero);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int labelByteCount = Encoding.UTF8.GetByteCount(label);
byte* labelBytes = stackalloc byte[labelByteCount];
fixed (char* labelPtr = label)
{
Encoding.UTF8.GetBytes(labelPtr, label.Length, labelBytes, labelByteCount);
}
return ImGuiNative.igInputText(labelBytes, (byte*)buf.ToPointer(), buf_size, flags, callback, user_data.ToPointer()) != 0;
}
public static bool Begin(string name, ImGuiWindowFlags flags)
{
int name_byteCount = Encoding.UTF8.GetByteCount(name);
byte* native_name = stackalloc byte[name_byteCount + 1];
fixed (char* name_ptr = name)
{
int native_name_offset = Encoding.UTF8.GetBytes(name_ptr, name.Length, native_name, name_byteCount);
native_name[native_name_offset] = 0;
}
byte* p_open = null;
byte ret = ImGuiNative.igBegin(native_name, p_open, flags);
return ret != 0;
}
public static bool MenuItem(string label, bool enabled)
{
return MenuItem(label, string.Empty, false, enabled);
}
}
}

@ -1,18 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>A .NET wrapper for the dear ImGui library.</Description>
<AssemblyVersion>0.4.7</AssemblyVersion>
<Description>A .NET wrapper for the Dear ImGui library.</Description>
<AssemblyVersion>1.65.0</AssemblyVersion>
<Authors>Eric Mellino</Authors>
<TargetFramework>netstandard1.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>portable</DebugType>
<AssemblyName>ImGui.NET</AssemblyName>
<PackageId>ImGui.NET</PackageId>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<PackagePrereleaseIdentifier>-beta0</PackagePrereleaseIdentifier>
<PackageVersion>$(AssemblyVersion)$(PackagePrereleaseIdentifier)</PackageVersion>
<PackageTags>ImGui ImGui.NET Immediate Mode GUI</PackageTags>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/mellinoe/imgui.net</PackageProjectUrl>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<DocumentationFile Condition="'$(Configuration)' == 'Release'">$(OutputPath)\ImGui.NET.xml</DocumentationFile>
<RootNamespace>ImGuiNET</RootNamespace>
</PropertyGroup>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,4 @@
namespace ImGuiNET
{
public unsafe delegate void ImGuiSizeCallback(ImGuiSizeCallbackData* data);
}

@ -0,0 +1,4 @@
namespace ImGuiNET
{
public unsafe delegate int ImGuiInputTextCallback(ImGuiInputTextCallbackData* data);
}

@ -1,26 +0,0 @@
using System.Numerics;
namespace ImGuiNET
{
public struct ImRect
{
public Vector2 Min;
public Vector2 Max;
public ImRect(Vector2 min, Vector2 max)
{
Min = min;
Max = max;
}
public bool Contains(Vector2 p)
{
return p.X >= Min.X && p.Y >= Min.Y && p.X < Max.X && p.Y < Max.Y;
}
public Vector2 GetSize()
{
return Max - Min;
}
}
}

@ -1,13 +1,75 @@
using System.Runtime.InteropServices;
using System;
using System.Runtime.CompilerServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct ImVector
{
public int Size;
public int Capacity;
///<summary>T* Data</summary>
public void* Data;
public readonly int Size;
public readonly int Capacity;
public readonly IntPtr Data;
public ref T Ref<T>(int index)
{
return ref Unsafe.AsRef<T>((byte*)Data + index * Unsafe.SizeOf<T>());
}
public IntPtr Address<T>(int index)
{
return (IntPtr)((byte*)Data + index * Unsafe.SizeOf<T>());
}
}
public unsafe struct ImVector<T>
{
public readonly int Size;
public readonly int Capacity;
public readonly IntPtr Data;
public ImVector(ImVector vector)
{
Size = vector.Size;
Capacity = vector.Capacity;
Data = vector.Data;
}
public ImVector(int size, int capacity, IntPtr data)
{
Size = size;
Capacity = capacity;
Data = data;
}
public ref T this[int index] => ref Unsafe.AsRef<T>((byte*)Data + index * Unsafe.SizeOf<T>());
}
public unsafe struct ImPtrVector<T>
{
public readonly int Size;
public readonly int Capacity;
public readonly IntPtr Data;
private readonly int _stride;
public ImPtrVector(ImVector vector, int stride)
: this(vector.Size, vector.Capacity, vector.Data, stride)
{ }
public ImPtrVector(int size, int capacity, IntPtr data, int stride)
{
Size = size;
Capacity = capacity;
Data = data;
_stride = stride;
}
public T this[int index]
{
get
{
byte* address = (byte*)Data + index * _stride;
T ret = Unsafe.Read<T>(&address);
return ret;
}
}
}
}

@ -1,82 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// Flags for ImGui.InputText()
/// </summary>
public enum InputTextFlags : int
{
Default = 0,
/// <summary>
/// Allow 0123456789.+-*/
/// </summary>
CharsDecimal = 1 << 0,
/// <summary>
/// Allow 0123456789ABCDEFabcdef
/// </summary>
CharsHexadecimal = 1 << 1,
/// <summary>
/// Turn a..z into A..Z
/// </summary>
CharsUppercase = 1 << 2,
/// <summary>
/// Filter out spaces, tabs
/// </summary>
CharsNoBlank = 1 << 3,
/// <summary>
/// Select entire text when first taking mouse focus
/// </summary>
AutoSelectAll = 1 << 4,
/// <summary>
/// Return 'true' when Enter is pressed (as opposed to when the value was modified)
/// </summary>
EnterReturnsTrue = 1 << 5,
/// <summary>
/// Call user function on pressing TAB (for completion handling)
/// </summary>
CallbackCompletion = 1 << 6,
/// <summary>
/// Call user function on pressing Up/Down arrows (for history handling)
/// </summary>
CallbackHistory = 1 << 7,
/// <summary>
/// Call user function every time
/// </summary>
CallbackAlways = 1 << 8,
/// <summary>
/// Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.
/// </summary>
CallbackCharFilter = 1 << 9,
/// <summary>
/// Pressing TAB input a '\t' character into the text field
/// </summary>
AllowTabInput = 1 << 10,
/// <summary>
/// In multi-line mode, allow exiting edition by pressing Enter. Ctrl+Enter to add new line (by default adds new lines with Enter).
/// </summary>
CtrlEnterForNewLine = 1 << 11,
/// <summary>
/// Disable following the cursor horizontally
/// </summary>
NoHorizontalScroll = 1 << 12,
/// <summary>
/// Insert mode
/// </summary>
AlwaysInsertMode = 1 << 13,
/// <summary>
/// Read-only mode
/// </summary>
ReadOnly = 1 << 14,
/// <summary>
/// Password mode, display all characters as '*'
/// </summary>
Password,
/// <summary>
/// Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
/// </summary>
NoUndoRedo,
/// <summary>
/// For internal use by InputTextMultiline()
/// </summary>
Multiline = 1 << 20
}
}

@ -1,22 +0,0 @@
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public struct Int2
{
public readonly int X, Y;
}
[StructLayout(LayoutKind.Sequential)]
public struct Int3
{
public readonly int X, Y, Z;
}
[StructLayout(LayoutKind.Sequential)]
public struct Int4
{
public readonly int X, Y, Z, W;
}
}

@ -1,34 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// Enumeration for GetMouseCursor()
/// </summary>
public enum MouseCursorKind
{
Arrow = 0,
/// <summary>
/// When hovering over InputText, etc.
/// </summary>
TextInput,
/// <summary>
/// Unused
/// </summary>
Move,
/// <summary>
/// Unused
/// </summary>
ResizeNS,
/// <summary>
/// When hovering over a column
/// </summary>
ResizeEW,
/// <summary>
/// Unused
/// </summary>
ResizeNESW,
/// <summary>
/// When hovering over the bottom-right corner of a window
/// </summary>
ResizeNWSE,
}
}

@ -1,142 +0,0 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct NativeContext
{
public byte Initialized;
public NativeIO IO;
public NativeStyle Style;
public NativeFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
public float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.
public float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.
public NativeDrawListSharedData DrawListSharedData;
public float Time;
public int FrameCount;
public int FrameCountEnded;
public int FrameCountRendered;
public ImVector Windows;
public ImVector WindowsSortBuffer;
public ImVector CurrentWindowStack;
public Storage WindowsById;
public int WindowsActiveCount;
public NativeWindow* CurrentWindow; // Being drawn into
public NativeWindow* NavWindow; // Nav/focused window for navigation
public NativeWindow* HoveredWindow; // Will catch mouse inputs
public NativeWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
public uint HoveredId; // Hovered widget
public byte HoveredIdAllowOverlap;
public uint HoveredIdPreviousFrame;
public float HoveredIdTimer;
public uint ActiveId; // Active widget
public uint ActiveIdPreviousFrame;
public float ActiveIdTimer;
public byte ActiveIdIsAlive; // Active widget has been seen this frame
public byte ActiveIdIsJustActivated; // Set at the time of activation for one frame
public byte ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
public Vector2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
public NativeWindow* ActiveIdWindow;
public NativeWindow* MovingWindow; // Track the child window we clicked on to move a window.
public uint MovingWindowMoveId; // == MovingWindow->MoveId
public ImVector ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
public ImVector StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
public ImVector FontStack; // Stack for PushFont()/PopFont()
public ImVector OpenPopupStack; // Which popups are open (persistent)
public ImVector CurrentPopupStack; // Which level of BeginPopup() we are in (reset every frame)
// Storage for SetNexWindow** and SetNextTreeNode*** functions
public Vector2 SetNextWindowPosVal;
public Vector2 SetNextWindowPosPivot;
public Vector2 SetNextWindowSizeVal;
public Vector2 SetNextWindowContentSizeVal;
public byte SetNextWindowCollapsedVal;
public Condition SetNextWindowPosCond;
public Condition SetNextWindowSizeCond;
public Condition SetNextWindowContentSizeCond;
public Condition SetNextWindowCollapsedCond;
public ImRect SetNextWindowSizeConstraintRect; // Valid if 'SetNextWindowSizeConstraint' is true
public IntPtr SetNextWindowSizeConstraintCallback;
public void* SetNextWindowSizeConstraintCallbackUserData;
public byte SetNextWindowSizeConstraint;
public byte SetNextWindowFocus;
public byte SetNextTreeNodeOpenVal;
public Condition SetNextTreeNodeOpenCond;
// Render
public DrawData RenderDrawData; // Main ImDrawData instance to pass render information to the user
public ImVector RenderDrawLists0;
public ImVector RenderDrawLists1;
public ImVector RenderDrawLists2;
public float ModalWindowDarkeningRatio;
public DrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays
public int MouseCursor;
public fixed byte MouseCursorData[7 * (4 + 8 + 8 + 16 + 16)];
// Drag and Drop
public byte DragDropActive;
public int DragDropSourceFlags;
public int DragDropMouseButton;
public NativePayload DragDropPayload;
public ImRect DragDropTargetRect;
public uint DragDropTargetId;
public float DragDropAcceptIdCurrRectSurface;
public uint DragDropAcceptIdCurr; // Target item id (set at the time of accepting the payload)
public uint DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
public int DragDropAcceptFrameCount; // Last time a target expressed a desire to accept the source
public ImVector DragDropPayloadBufHeap; // We don't expose the ImVector<> directly
public fixed byte DragDropPayloadBufLocal[8];
// Widget state
public ImGuiTextEditState InputTextState;
public NativeFont InputTextPasswordFont;
public uint ScalarAsInputTextId; // Temporary text input when CTRL+clicking on a slider, etc.
public int ColorEditOptions; // Store user options for color edit widgets
public Vector4 ColorPickerRef;
public float DragCurrentValue; // Currently dragged value, always float, not rounded by end-user precision settings
public Vector2 DragLastMouseDelta;
public float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
public float DragSpeedScaleSlow;
public float DragSpeedScaleFast;
public Vector2 ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
public int TooltipOverrideCount;
public ImVector PrivateClipboard; // If no custom clipboard handler is defined
public Vector2 OsImePosRequest, OsImePosSet; // Cursor position request & last passed to the OS Input Method Editor
// Settings
public float SettingsDirtyTimer; // Save .ini Settings on disk when time reaches zero
public ImVector SettingsWindows; // .ini settings for NativeWindow
public ImVector SettingsHandlers; // List of .ini settings handlers
// Logging
public byte LogEnabled;
public void* LogFile; // If != NULL log to stdout/ file
public void* LogClipboard; // Else log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
public int LogStartDepth;
public int LogAutoExpandMaxDepth;
// Misc
public fixed float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
public int FramerateSecPerFrameIdx;
public float FramerateSecPerFrameAccum;
public int WantCaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
public int WantCaptureKeyboardNextFrame;
public int WantTextInputNextFrame;
public fixed byte TempBuffer[1024 * 3 + 1]; // temporary text buffer
}
public unsafe struct NativeDrawListSharedData
{
public Vector2 TexUvWhitePixel; // UV of white pixel in the atlas
public NativeFont* Font; // Current/default font (optional, for simplified AddText overload)
public float FontSize; // Current/default font size (optional, for simplified AddText overload)
public float CurveTessellationTol;
public Vector4 ClipRectFullscreen; // Value for PushClipRectFullscreen()
// Const data
public fixed float CircleVtx12[12 * 2];
}
}

@ -1,55 +0,0 @@
using System.Numerics;
namespace ImGuiNET
{
// Transient per-window data, reset at the beginning of the frame
public unsafe struct NativeDrawContext
{
public Vector2 CursorPos;
public Vector2 CursorPosPrevLine;
public Vector2 CursorStartPos;
public Vector2 CursorMaxPos; // Implicitly calculate the size of our contents, always extending. Saved into window->SizeContents at the end of the frame
public float CurrentLineHeight;
public float CurrentLineTextBaseOffset;
public float PrevLineHeight;
public float PrevLineTextBaseOffset;
public float LogLinePosY;
public int TreeDepth;
public uint LastItemId;
public ImRect LastItemRect;
public byte LastItemHoveredAndUsable; // Item rectangle is hovered, and its window is currently interactable with (not blocked by a popup preventing access to the window)
public byte LastItemHoveredRect; // Item rectangle is hovered, but its window may or not be currently interactable with (might be blocked by a popup preventing access to the window)
public byte MenuBarAppending;
public float MenuBarOffsetX;
public ImVector ChildWindows;
public Storage StateStorage;
public int LayoutType;
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
public float ItemWidth; // == ItemWidthStack.back(). 0.0: default, >0.0: width in pixels, <0.0: align xx pixels to the right of window
public float TextWrapPos; // == TextWrapPosStack.back() [empty == -1.0f]
public byte AllowKeyboardFocus; // == AllowKeyboardFocusStack.back() [empty == true]
public byte ButtonRepeat; // == ButtonRepeatStack.back() [empty == false]
public ImVector ItemWidthStack;
public ImVector TextWrapPosStack;
public ImVector AllowKeyboardFocusStack;
public ImVector ButtonRepeatStack;
public ImVector GroupStack;
public ColorEditFlags ColorEditMode;
public fixed int StackSizesBackup[6]; // Store size of various stacks for asserting
public float IndentX; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
public float GroupOffsetX;
public float ColumnsOffsetX; // Offset to the current column (if ColumnsCurrent > 0).
public int ColumnsCurrent;
public int ColumnsCount;
public float ColumnsMinX;
public float ColumnsMaxX;
public float ColumnsStartPosY;
public float ColumnsCellMinY;
public float ColumnsCellMaxY;
public byte ColumnsShowBorders;
public uint ColumnsSetId;
public ImVector ColumnsData;
}
}

@ -1,354 +0,0 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct NativeIO
{
//------------------------------------------------------------------
// Settings (fill once)
//------------------------------------------------------------------
/// <summary>
/// Display size, in pixels. For clamping windows positions.
/// Default value: [unset]
/// </summary>
public Vector2 DisplaySize;
/// <summary>
/// Time elapsed since last frame, in seconds.
/// Default value: 1.0f / 10.0f.
/// </summary>
public float DeltaTime;
/// <summary>
/// Maximum time between saving positions/sizes to .ini file, in seconds.
/// Default value: 5.0f.
/// </summary>
public float IniSavingRate;
/// <summary>
/// Path to .ini file. NULL to disable .ini saving.
/// Default value: "imgui.ini"
/// </summary>
public IntPtr IniFilename;
/// <summary>
/// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
/// Default value: "imgui_log.txt"
/// </summary>
public IntPtr LogFilename;
/// <summary>
/// Time for a double-click, in seconds.
/// Default value: 0.30f.
/// </summary>
public float MouseDoubleClickTime;
/// <summary>
/// Distance threshold to stay in to validate a double-click, in pixels.
/// Default Value: 6.0f.
/// </summary>
public float MouseDoubleClickMaxDist;
/// <summary>
/// Distance threshold before considering we are dragging.
/// Default Value: 6.0f.
/// </summary>
public float MouseDragThreshold;
/// <summary>
/// Map of indices into the KeysDown[512] entries array.
/// Default values: [unset]
/// </summary>
public fixed int KeyMap[(int)GuiKey.Count];
/// <summary>
/// When holding a key/button, time before it starts repeating, in seconds. (for actions where 'repeat' is active).
/// Default value: 0.250f.
/// </summary>
public float KeyRepeatDelay;
/// <summary>
/// When holding a key/button, rate at which it repeats, in seconds.
/// Default value: 0.020f.
/// </summary>
public float KeyRepeatRate;
/// <summary>
/// Store your own data for retrieval by callbacks.
/// Default value: IntPtr.Zero.
/// </summary>
public IntPtr UserData;
/// <summary>
/// Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
/// Default value: [auto]
/// </summary>
public NativeFontAtlas* FontAtlas;
/// <summary>
/// Global scale all fonts.
/// Default value: 1.0f.
/// </summary>
public float FontGlobalScale;
/// <summary>
/// Allow user scaling text of individual window with CTRL+Wheel.
/// Default value: false.
/// </summary>
public byte FontAllowUserScaling;
/// <summary>
/// Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].
/// Default value: null.
/// </summary>
public NativeFont* FontDefault;
/// <summary>
/// For retina display or other situations where window coordinates are different from framebuffer coordinates.
/// User storage only, presently not used by ImGui.
/// Default value: (1.0f, 1.0f).
/// </summary>
public Vector2 DisplayFramebufferScale;
/// <summary>
/// If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.
/// Default value: (0.0f, 0.0f)
/// </summary>
public Vector2 DisplayVisibleMin;
/// <summary>
/// If the values are the same, we defaults to Min=0.0f) and Max=DisplaySize.
/// Default value: (0.0f, 0.0f).
/// </summary>
public Vector2 DisplayVisibleMax;
/// <summary>
/// OS X style: Text editing cursor movement using Alt instead of Ctrl,
/// Shortcuts using Cmd/Super instead of Ctrl,
/// Line/Text Start and End using Cmd+Arrows instead of Home/End,
/// Double click selects by word instead of selecting whole text,
/// Multi-selection in lists uses Cmd/Super instead of Ctrl
/// Default value: True on OSX; false otherwise.
/// </summary>
public byte OptMacOSXBehaviors;
/// <summary>
/// Enable blinking cursor, for users who consider it annoying.
/// Default value: true.
/// </summary>
public byte OptCursorBlink;
//------------------------------------------------------------------
// User Functions
//------------------------------------------------------------------
/// <summary>
/// Rendering function, will be called in Render().
/// Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer.
/// </summary>
public IntPtr RenderDrawListsFn;
/// <summary>
/// Optional: access OS clipboard
/// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
/// </summary>
public IntPtr GetClipboardTextFn;
/// <summary>
/// Optional: access OS clipboard
/// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
/// </summary>
public IntPtr SetClipboardTextFn;
public IntPtr ClipboardUserData;
/// <summary>
/// Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer.
/// (default to posix malloc/free)
/// </summary>
public IntPtr MemAllocFn;
/// <summary>
/// Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer.
/// (default to posix malloc/free)
/// </summary>
public IntPtr MemFreeFn;
/// <summary>
/// Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows)
/// (default to use native imm32 api on Windows)
/// </summary>
public IntPtr ImeSetInputScreenPosFn;
/// <summary>
/// (Windows) Set this to your HWND to get automatic IME cursor positioning.
/// </summary>
public IntPtr ImeWindowHandle;
//------------------------------------------------------------------
// Input - Fill before calling NewFrame()
//------------------------------------------------------------------
/// <summary>
/// Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.).
/// </summary>
public Vector2 MousePos;
/// <summary>
/// Mouse buttons: left, right, middle + extras.
/// ImGui itself mostly only uses left button (BeginPopupContext** are using right button).
/// Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.
/// </summary>
public fixed byte MouseDown[5];
/// <summary>
/// Mouse wheel: 1 unit scrolls about 5 lines text.
/// </summary>
public float MouseWheel;
/// <summary>
/// Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
/// </summary>
public byte MouseDrawCursor;
/// <summary>
/// Keyboard modifier pressed: Control.
/// </summary>
public byte KeyCtrl;
/// <summary>
/// Keyboard modifier pressed: Shift
/// </summary>
public byte KeyShift;
/// <summary>
/// Keyboard modifier pressed: Alt
/// </summary>
public byte KeyAlt;
/// <summary>
/// Keyboard modifier pressed: Cmd/Super/Windows
/// </summary>
public byte KeySuper;
/// <summary>
/// Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
/// </summary>
public fixed byte KeysDown[512];
/// <summary>
/// List of characters input (translated by user from keypress+keyboard state).
/// Fill using AddInputCharacter() helper.
/// </summary>
public fixed ushort InputCharacters[16 + 1];
//------------------------------------------------------------------
// Output - Retrieve after calling NewFrame(), you can use them to discard inputs or hide them from the rest of your application
//------------------------------------------------------------------
/// <summary>
/// Mouse is hovering a window or widget is active (= ImGui will use your mouse input).
/// </summary>
public byte WantCaptureMouse;
/// <summary>
/// Widget is active (= ImGui will use your keyboard input).
/// </summary>
public byte WantCaptureKeyboard;
/// <summary>
/// Some text input widget is active, which will read input characters from the InputCharacters array.
/// </summary>
public byte WantTextInput;
/// <summary>
/// MousePos has been altered, back-end should reposition mouse on next frame. Set only when 'NavMovesMouse=true'.
/// </summary>
public byte WantMoveMouse;
/// <summary>
/// Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames.
/// </summary>
public float Framerate;
/// <summary>
/// Number of active memory allocations.
/// </summary>
public int MetricsAllocs;
/// <summary>
/// Vertices output during last call to Render().
/// </summary>
public int MetricsRenderVertices;
/// <summary>
/// Indices output during last call to Render() = number of triangles * 3
/// </summary>
public int MetricsRenderIndices;
/// <summary>
/// Number of visible windows (exclude child windows)
/// </summary>
public int MetricsActiveWindows;
/// <summary>
/// Mouse delta. Note that this is zero if either current or previous position are negative,
/// so a disappearing/reappearing mouse won't have a huge delta for one frame.
/// </summary>
public Vector2 MouseDelta;
//------------------------------------------------------------------
// [Internal] ImGui will maintain those fields for you
//------------------------------------------------------------------
/// <summary>
/// Previous mouse position
/// </summary>
public Vector2 MousePosPrev;
/// <summary>
/// Position at time of clicking
/// </summary>
public Vector2 MouseClickedPos0;
/// <summary>
/// Position at time of clicking
/// </summary>
public Vector2 MouseClickedPos1;
/// <summary>
/// Position at time of clicking
/// </summary>
public Vector2 MouseClickedPos2;
/// <summary>
/// Position at time of clicking
/// </summary>
public Vector2 MouseClickedPos3;
/// <summary>
/// Position at time of clicking
/// </summary>
public Vector2 MouseClickedPos4;
/// <summary>
/// Time of last click (used to figure out double-click)
/// </summary>
public fixed float MouseClickedTime[5];
/// <summary>
/// Mouse button went from !Down to Down
/// </summary>
public fixed byte MouseClicked[5];
/// <summary>
/// Has mouse button been double-clicked?
/// </summary>
public fixed byte MouseDoubleClicked[5];
/// <summary>
/// Mouse button went from Down to !Down
/// </summary>
public fixed byte MouseReleased[5];
/// <summary>
/// Track if button was clicked inside a window.
/// We don't request mouse capture from the application if click started outside ImGui bounds.
/// </summary>
public fixed byte MouseDownOwned[5];
/// <summary>
/// Duration the mouse button has been down (0.0f == just clicked).
/// </summary>
public fixed float MouseDownDuration[5];
/// <summary>
/// Previous time the mouse button has been down
/// </summary>
public fixed float MouseDownDurationPrev[5];
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs0;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs1;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs2;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs3;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs4;
/// <summary>
/// Squared maximum distance of how much mouse has traveled from the click point
/// </summary>
public fixed float MouseDragMaxDistanceSqr[5];
/// <summary>
/// Duration the keyboard key has been down (0.0f == just pressed)
/// </summary>
public fixed float KeysDownDuration[512];
/// <summary>
/// Previous duration the key has been down
/// </summary>
public fixed float KeysDownDurationPrev[512];
}
}

@ -1,19 +0,0 @@
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct NativePayload
{
public void* Data;
public int DataSize;
// Internal
private uint SourceId;
private uint SourceParentId;
private int DataFrameCount;
private fixed byte DataType[8 + 1];
private byte Preview;
private byte Delivery;
}
}

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

Loading…
Cancel
Save