Skip to content

Commit

Permalink
Update to ImGui 1.91.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JunaMeinhold committed Sep 10, 2024
1 parent 0e8f0b2 commit 0d4e69a
Show file tree
Hide file tree
Showing 125 changed files with 8,042 additions and 7,611 deletions.
19 changes: 9 additions & 10 deletions ExampleFramework/ImGuiDemo/ImGuiSDL2Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private unsafe struct BackendData
return !ImGui.GetCurrentContext().IsNull ? (BackendData*)ImGui.GetIO().BackendPlatformUserData : null;
}

private static unsafe byte* GetClipboardText(void* data)
private static unsafe byte* GetClipboardText(ImGuiContext* data)
{
BackendData* bd = GetBackendData();
if (bd->ClipboardTextData != null)
Expand All @@ -70,7 +70,7 @@ private unsafe struct BackendData
return bd->ClipboardTextData;
}

private static unsafe void SetClipboardText(void* data, byte* text)
private static unsafe void SetClipboardText(ImGuiContext* data, byte* text)
{
sdl.SetClipboardText(text);
}
Expand Down Expand Up @@ -419,13 +419,6 @@ public static unsafe bool Init(Window* window, Renderer* renderer, void* sdlGLCo
}
bd->WantUpdateMonitors = true;

io.SetClipboardTextFn = (void*)Marshal.GetFunctionPointerForDelegate<SetClipboardTextFn>(SetClipboardText);
io.GetClipboardTextFn = (void*)Marshal.GetFunctionPointerForDelegate<GetClipboardTextFn>(GetClipboardText);
io.ClipboardUserData = null;

io.PlatformSetImeDataFn = (void*)Marshal.GetFunctionPointerForDelegate<PlatformSetImeDataFn>(SetPlatformImeData);
io.PlatformOpenInShellFn = (void*)Marshal.GetFunctionPointerForDelegate<PlatformOpenInShellFn>(OpenPlatformInShell);

bd->MouseCursors = (Cursor**)AllocArray((uint)ImGuiMouseCursor.Count);
bd->MouseCursors[(int)ImGuiMouseCursor.Arrow] = sdl.CreateSystemCursor(SystemCursor.SystemCursorArrow);
bd->MouseCursors[(int)ImGuiMouseCursor.TextInput] = sdl.CreateSystemCursor(SystemCursor.SystemCursorIbeam);
Expand Down Expand Up @@ -1034,6 +1027,12 @@ private static unsafe void InitPlatformInterface(Window* window, void* sdl_gl_co
platform_io->PlatformSwapBuffers = (void*)Marshal.GetFunctionPointerForDelegate<PlatformSwapBuffers>(SwapBuffers);
platform_io->PlatformSetWindowAlpha = (void*)Marshal.GetFunctionPointerForDelegate<PlatformSetWindowAlpha>(SetWindowAlpha);
platform_io->PlatformCreateVkSurface = (void*)Marshal.GetFunctionPointerForDelegate<PlatformCreateVkSurface>(CreateVkSurface);
platform_io->PlatformSetClipboardTextFn = (void*)Marshal.GetFunctionPointerForDelegate<PlatformSetClipboardTextFn>(SetClipboardText);
platform_io->PlatformGetClipboardTextFn = (void*)Marshal.GetFunctionPointerForDelegate<PlatformGetClipboardTextFn>(GetClipboardText);
platform_io->PlatformClipboardUserData = null;

platform_io->PlatformSetImeDataFn = (void*)Marshal.GetFunctionPointerForDelegate<PlatformSetImeDataFn>(SetPlatformImeData);
platform_io->PlatformOpenInShellFn = (void*)Marshal.GetFunctionPointerForDelegate<PlatformOpenInShellFn>(OpenPlatformInShell);

ImGuiViewport* main_viewport = ImGui.GetMainViewport().Handle;
ViewportData* vd = AllocT<ViewportData>();
Expand All @@ -1051,4 +1050,4 @@ private static void ShutdownPlatformInterface()
ImGui.DestroyPlatformWindows();
}
}
}
}
2 changes: 1 addition & 1 deletion ExampleFramework/ImGuiDemo/OpenFileDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void Display(string? rel, string str)
ImGui.EndChild();

ImGui.SameLine();
if (ImGui.BeginChild(2, new Vector2(width, -footerHeightToReserve), ImGuiChildFlags.Border, 0))
if (ImGui.BeginChild(2, new Vector2(width, -footerHeightToReserve), ImGuiChildFlags.Borders, 0))
{
if (currentDir.Exists)
{
Expand Down
7 changes: 6 additions & 1 deletion Generator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ internal unsafe class Program

private static void Main(string[] args)
{
Directory.Delete("patches", true);
if (Directory.Exists("patches"))
{
Directory.Delete("patches", true);
}

Directory.CreateDirectory("./patches");
Generate(CImGuiHeader, CImGuiConfig, ImGuiOutputPath, null, out var metadata);
Generate(CImGuizmoHeader, CImGuizmoConfig, ImGuizmoOutputPath, metadata, out _);
Generate(CImPlotHeader, CImPlotConfig, ImPlotOutputPath, metadata, out _);
Expand Down
Loading

0 comments on commit 0d4e69a

Please sign in to comment.