[WIP] Adjustments

internals
Eric Mellino 4 years ago
parent 2d1fc76b21
commit 9d7c2dc54e
  1. 6
      NuGet.Config
  2. 4
      src/CodeGenerator/ImguiDefinitions.cs
  3. 10
      src/CodeGenerator/Program.cs
  4. 4
      src/ImGui.NET.SampleProgram/ImGuiController.cs
  5. 2
      src/ImGui.NET.sln
  6. 8
      src/ImNodes.NET/Generated/AttributeFlags.gen.cs
  7. 36
      src/ImNodes.NET/Generated/ColorStyle.gen.cs
  8. 4
      src/ImNodes.NET/Generated/EmulateThreeButtonMouse.gen.cs
  9. 4
      src/ImNodes.NET/Generated/IO.gen.cs
  10. 154
      src/ImNodes.NET/Generated/ImNodes.gen.cs
  11. 4
      src/ImNodes.NET/Generated/ImNodesNative.gen.cs
  12. 4
      src/ImNodes.NET/Generated/LinkDetachWithModifierClick.gen.cs
  13. 14
      src/ImNodes.NET/Generated/PinShape.gen.cs
  14. 4
      src/ImNodes.NET/Generated/Style.gen.cs
  15. 8
      src/ImNodes.NET/Generated/StyleFlags.gen.cs
  16. 30
      src/ImNodes.NET/Generated/StyleVar.gen.cs
  17. 8
      src/ImNodes.NET/ImNodes.NET.csproj

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="dotnet-myget dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
</configuration>

@ -268,6 +268,10 @@ namespace CodeGenerator
if (memberName.StartsWith(Name)) if (memberName.StartsWith(Name))
{ {
ret = memberName.Substring(Name.Length); ret = memberName.Substring(Name.Length);
if (ret.StartsWith("_"))
{
ret = ret.Substring(1);
}
} }
if (ret.EndsWith('_')) if (ret.EndsWith('_'))

@ -39,9 +39,9 @@ namespace CodeGenerator
{ {
"cimgui" => "ImGuiNET", "cimgui" => "ImGuiNET",
"cimplot" => "ImPlotNET", "cimplot" => "ImPlotNET",
"cimnodes" => "ImNodesNET", "cimnodes" => "imnodesNET",
"cimguizmo" => "ImGuizmoNET", "cimguizmo" => "ImGuizmoNET",
_ => throw new NotImplementedException() _ => throw new NotImplementedException($"Library \"{libraryName}\" is not supported.")
}; };
bool referencesImGui = libraryName switch bool referencesImGui = libraryName switch
@ -50,16 +50,16 @@ namespace CodeGenerator
"cimplot" => true, "cimplot" => true,
"cimnodes" => true, "cimnodes" => true,
"cimguizmo" => true, "cimguizmo" => true,
_ => throw new NotImplementedException() _ => throw new NotImplementedException($"Library \"{libraryName}\" is not supported.")
}; };
string classPrefix = libraryName switch string classPrefix = libraryName switch
{ {
"cimgui" => "ImGui", "cimgui" => "ImGui",
"cimplot" => "ImPlot", "cimplot" => "ImPlot",
"cimnodes" => "ImNodes", "cimnodes" => "imnodes",
"cimguizmo" => "ImGuizmo", "cimguizmo" => "ImGuizmo",
_ => throw new NotImplementedException() _ => throw new NotImplementedException($"Library \"{libraryName}\" is not supported.")
}; };
string dllName = libraryName switch string dllName = libraryName switch

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Numerics; using System.Numerics;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using ImPlotNET;
using Veldrid; using Veldrid;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -62,9 +61,6 @@ namespace ImGuiNET
IntPtr context = ImGui.CreateContext(); IntPtr context = ImGui.CreateContext();
ImGui.SetCurrentContext(context); ImGui.SetCurrentContext(context);
IntPtr implotContext = ImPlot.CreateContext();
ImPlot.SetCurrentContext(implotContext);
ImPlot.SetImGuiContext(context);
var fonts = ImGui.GetIO().Fonts; var fonts = ImGui.GetIO().Fonts;
ImGui.GetIO().Fonts.AddFontDefault(); ImGui.GetIO().Fonts.AddFontDefault();

@ -12,7 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerator", "CodeGenera
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImPlot.NET", "ImPlot.NET\ImPlot.NET.csproj", "{817A9820-E750-43AB-B89E-FD51E58ACBF4}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImPlot.NET", "ImPlot.NET\ImPlot.NET.csproj", "{817A9820-E750-43AB-B89E-FD51E58ACBF4}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImNodes.NET", "ImNodes.NET\ImNodes.NET.csproj", "{2786BF48-AE57-44EE-9E28-401AE88E972D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "imnodes.NET", "imnodes.NET\imnodes.NET.csproj", "{2786BF48-AE57-44EE-9E28-401AE88E972D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGuizmo.NET", "ImGuizmo.NET\ImGuizmo.NET.csproj", "{760568AB-DCC9-443E-ADFA-2B06B2E2B421}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGuizmo.NET", "ImGuizmo.NET\ImGuizmo.NET.csproj", "{760568AB-DCC9-443E-ADFA-2B06B2E2B421}"
EndProject EndProject

@ -1,10 +1,10 @@
namespace ImNodesNET namespace imnodesNET
{ {
[System.Flags] [System.Flags]
public enum AttributeFlags public enum AttributeFlags
{ {
_None = 0, None = 0,
_EnableLinkDetachWithDragClick = 1, EnableLinkDetachWithDragClick = 1,
_EnableLinkCreationOnSnap = 2, EnableLinkCreationOnSnap = 2,
} }
} }

@ -1,23 +1,23 @@
namespace ImNodesNET namespace imnodesNET
{ {
public enum ColorStyle public enum ColorStyle
{ {
_NodeBackground = 0, NodeBackground = 0,
_NodeBackgroundHovered = 1, NodeBackgroundHovered = 1,
_NodeBackgroundSelected = 2, NodeBackgroundSelected = 2,
_NodeOutline = 3, NodeOutline = 3,
_TitleBar = 4, TitleBar = 4,
_TitleBarHovered = 5, TitleBarHovered = 5,
_TitleBarSelected = 6, TitleBarSelected = 6,
_Link = 7, Link = 7,
_LinkHovered = 8, LinkHovered = 8,
_LinkSelected = 9, LinkSelected = 9,
_Pin = 10, Pin = 10,
_PinHovered = 11, PinHovered = 11,
_BoxSelector = 12, BoxSelector = 12,
_BoxSelectorOutline = 13, BoxSelectorOutline = 13,
_GridBackground = 14, GridBackground = 14,
_GridLine = 15, GridLine = 15,
_Count = 16, Count = 16,
} }
} }

@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using ImGuiNET; using ImGuiNET;
namespace ImNodesNET namespace imnodesNET
{ {
public unsafe partial struct EmulateThreeButtonMouse public unsafe partial struct EmulateThreeButtonMouse
{ {
@ -23,7 +23,7 @@ namespace ImNodesNET
public IntPtr modifier { get => (IntPtr)NativePtr->modifier; set => NativePtr->modifier = (byte*)value; } public IntPtr modifier { get => (IntPtr)NativePtr->modifier; set => NativePtr->modifier = (byte*)value; }
public void Destroy() public void Destroy()
{ {
ImNodesNative.EmulateThreeButtonMouse_destroy((EmulateThreeButtonMouse*)(NativePtr)); imnodesNative.EmulateThreeButtonMouse_destroy((EmulateThreeButtonMouse*)(NativePtr));
} }
} }
} }

@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using ImGuiNET; using ImGuiNET;
namespace ImNodesNET namespace imnodesNET
{ {
public unsafe partial struct IO public unsafe partial struct IO
{ {
@ -23,7 +23,7 @@ namespace ImNodesNET
public ref LinkDetachWithModifierClick link_detach_with_modifier_click => ref Unsafe.AsRef<LinkDetachWithModifierClick>(&NativePtr->link_detach_with_modifier_click); public ref LinkDetachWithModifierClick link_detach_with_modifier_click => ref Unsafe.AsRef<LinkDetachWithModifierClick>(&NativePtr->link_detach_with_modifier_click);
public void Destroy() public void Destroy()
{ {
ImNodesNative.IO_destroy((IO*)(NativePtr)); imnodesNative.IO_destroy((IO*)(NativePtr));
} }
} }
} }

@ -4,177 +4,177 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using ImGuiNET; using ImGuiNET;
namespace ImNodesNET namespace imnodesNET
{ {
public static unsafe partial class ImNodes public static unsafe partial class imnodes
{ {
public static void BeginInputAttribute(int id) public static void BeginInputAttribute(int id)
{ {
PinShape shape = PinShape._CircleFilled; PinShape shape = PinShape._CircleFilled;
ImNodesNative.imnodes_BeginInputAttribute(id, shape); imnodesNative.imnodes_BeginInputAttribute(id, shape);
} }
public static void BeginInputAttribute(int id, PinShape shape) public static void BeginInputAttribute(int id, PinShape shape)
{ {
ImNodesNative.imnodes_BeginInputAttribute(id, shape); imnodesNative.imnodes_BeginInputAttribute(id, shape);
} }
public static void BeginNode(int id) public static void BeginNode(int id)
{ {
ImNodesNative.imnodes_BeginNode(id); imnodesNative.imnodes_BeginNode(id);
} }
public static void BeginNodeEditor() public static void BeginNodeEditor()
{ {
ImNodesNative.imnodes_BeginNodeEditor(); imnodesNative.imnodes_BeginNodeEditor();
} }
public static void BeginNodeTitleBar() public static void BeginNodeTitleBar()
{ {
ImNodesNative.imnodes_BeginNodeTitleBar(); imnodesNative.imnodes_BeginNodeTitleBar();
} }
public static void BeginOutputAttribute(int id) public static void BeginOutputAttribute(int id)
{ {
PinShape shape = PinShape._CircleFilled; PinShape shape = PinShape._CircleFilled;
ImNodesNative.imnodes_BeginOutputAttribute(id, shape); imnodesNative.imnodes_BeginOutputAttribute(id, shape);
} }
public static void BeginOutputAttribute(int id, PinShape shape) public static void BeginOutputAttribute(int id, PinShape shape)
{ {
ImNodesNative.imnodes_BeginOutputAttribute(id, shape); imnodesNative.imnodes_BeginOutputAttribute(id, shape);
} }
public static void BeginStaticAttribute(int id) public static void BeginStaticAttribute(int id)
{ {
ImNodesNative.imnodes_BeginStaticAttribute(id); imnodesNative.imnodes_BeginStaticAttribute(id);
} }
public static void ClearLinkSelection() public static void ClearLinkSelection()
{ {
ImNodesNative.imnodes_ClearLinkSelection(); imnodesNative.imnodes_ClearLinkSelection();
} }
public static void ClearNodeSelection() public static void ClearNodeSelection()
{ {
ImNodesNative.imnodes_ClearNodeSelection(); imnodesNative.imnodes_ClearNodeSelection();
} }
public static IntPtr EditorContextCreate() public static IntPtr EditorContextCreate()
{ {
IntPtr ret = ImNodesNative.imnodes_EditorContextCreate(); IntPtr ret = imnodesNative.imnodes_EditorContextCreate();
return ret; return ret;
} }
public static void EditorContextFree(IntPtr noname1) public static void EditorContextFree(IntPtr noname1)
{ {
ImNodesNative.imnodes_EditorContextFree(noname1); imnodesNative.imnodes_EditorContextFree(noname1);
} }
public static Vector2 EditorContextGetPanning() public static Vector2 EditorContextGetPanning()
{ {
Vector2 __retval; Vector2 __retval;
ImNodesNative.imnodes_EditorContextGetPanning(&__retval); imnodesNative.imnodes_EditorContextGetPanning(&__retval);
return __retval; return __retval;
} }
public static void EditorContextMoveToNode(int node_id) public static void EditorContextMoveToNode(int node_id)
{ {
ImNodesNative.imnodes_EditorContextMoveToNode(node_id); imnodesNative.imnodes_EditorContextMoveToNode(node_id);
} }
public static void EditorContextResetPanning(Vector2 pos) public static void EditorContextResetPanning(Vector2 pos)
{ {
ImNodesNative.imnodes_EditorContextResetPanning(pos); imnodesNative.imnodes_EditorContextResetPanning(pos);
} }
public static void EditorContextSet(IntPtr noname1) public static void EditorContextSet(IntPtr noname1)
{ {
ImNodesNative.imnodes_EditorContextSet(noname1); imnodesNative.imnodes_EditorContextSet(noname1);
} }
public static void EndInputAttribute() public static void EndInputAttribute()
{ {
ImNodesNative.imnodes_EndInputAttribute(); imnodesNative.imnodes_EndInputAttribute();
} }
public static void EndNode() public static void EndNode()
{ {
ImNodesNative.imnodes_EndNode(); imnodesNative.imnodes_EndNode();
} }
public static void EndNodeEditor() public static void EndNodeEditor()
{ {
ImNodesNative.imnodes_EndNodeEditor(); imnodesNative.imnodes_EndNodeEditor();
} }
public static void EndNodeTitleBar() public static void EndNodeTitleBar()
{ {
ImNodesNative.imnodes_EndNodeTitleBar(); imnodesNative.imnodes_EndNodeTitleBar();
} }
public static void EndOutputAttribute() public static void EndOutputAttribute()
{ {
ImNodesNative.imnodes_EndOutputAttribute(); imnodesNative.imnodes_EndOutputAttribute();
} }
public static void EndStaticAttribute() public static void EndStaticAttribute()
{ {
ImNodesNative.imnodes_EndStaticAttribute(); imnodesNative.imnodes_EndStaticAttribute();
} }
public static IO* GetIO() public static IO* GetIO()
{ {
IO* ret = ImNodesNative.imnodes_GetIO(); IO* ret = imnodesNative.imnodes_GetIO();
return ret; return ret;
} }
public static Vector2 GetNodeDimensions(int id) public static Vector2 GetNodeDimensions(int id)
{ {
Vector2 __retval; Vector2 __retval;
ImNodesNative.imnodes_GetNodeDimensions(&__retval, id); imnodesNative.imnodes_GetNodeDimensions(&__retval, id);
return __retval; return __retval;
} }
public static Vector2 GetNodeEditorSpacePos(int node_id) public static Vector2 GetNodeEditorSpacePos(int node_id)
{ {
Vector2 __retval; Vector2 __retval;
ImNodesNative.imnodes_GetNodeEditorSpacePos(&__retval, node_id); imnodesNative.imnodes_GetNodeEditorSpacePos(&__retval, node_id);
return __retval; return __retval;
} }
public static Vector2 GetNodeGridSpacePos(int node_id) public static Vector2 GetNodeGridSpacePos(int node_id)
{ {
Vector2 __retval; Vector2 __retval;
ImNodesNative.imnodes_GetNodeGridSpacePos(&__retval, node_id); imnodesNative.imnodes_GetNodeGridSpacePos(&__retval, node_id);
return __retval; return __retval;
} }
public static Vector2 GetNodeScreenSpacePos(int node_id) public static Vector2 GetNodeScreenSpacePos(int node_id)
{ {
Vector2 __retval; Vector2 __retval;
ImNodesNative.imnodes_GetNodeScreenSpacePos(&__retval, node_id); imnodesNative.imnodes_GetNodeScreenSpacePos(&__retval, node_id);
return __retval; return __retval;
} }
public static void GetSelectedLinks(ref int link_ids) public static void GetSelectedLinks(ref int link_ids)
{ {
fixed (int* native_link_ids = &link_ids) fixed (int* native_link_ids = &link_ids)
{ {
ImNodesNative.imnodes_GetSelectedLinks(native_link_ids); imnodesNative.imnodes_GetSelectedLinks(native_link_ids);
} }
} }
public static void GetSelectedNodes(ref int node_ids) public static void GetSelectedNodes(ref int node_ids)
{ {
fixed (int* native_node_ids = &node_ids) fixed (int* native_node_ids = &node_ids)
{ {
ImNodesNative.imnodes_GetSelectedNodes(native_node_ids); imnodesNative.imnodes_GetSelectedNodes(native_node_ids);
} }
} }
public static Style* GetStyle() public static Style* GetStyle()
{ {
Style* ret = ImNodesNative.imnodes_GetStyle(); Style* ret = imnodesNative.imnodes_GetStyle();
return ret; return ret;
} }
public static void Initialize() public static void Initialize()
{ {
ImNodesNative.imnodes_Initialize(); imnodesNative.imnodes_Initialize();
} }
public static bool IsAnyAttributeActive() public static bool IsAnyAttributeActive()
{ {
int* attribute_id = null; int* attribute_id = null;
byte ret = ImNodesNative.imnodes_IsAnyAttributeActive(attribute_id); byte ret = imnodesNative.imnodes_IsAnyAttributeActive(attribute_id);
return ret != 0; return ret != 0;
} }
public static bool IsAnyAttributeActive(ref int attribute_id) public static bool IsAnyAttributeActive(ref int attribute_id)
{ {
fixed (int* native_attribute_id = &attribute_id) fixed (int* native_attribute_id = &attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsAnyAttributeActive(native_attribute_id); byte ret = imnodesNative.imnodes_IsAnyAttributeActive(native_attribute_id);
return ret != 0; return ret != 0;
} }
} }
public static bool IsAttributeActive() public static bool IsAttributeActive()
{ {
byte ret = ImNodesNative.imnodes_IsAttributeActive(); byte ret = imnodesNative.imnodes_IsAttributeActive();
return ret != 0; return ret != 0;
} }
public static bool IsEditorHovered() public static bool IsEditorHovered()
{ {
byte ret = ImNodesNative.imnodes_IsEditorHovered(); byte ret = imnodesNative.imnodes_IsEditorHovered();
return ret != 0; return ret != 0;
} }
public static bool IsLinkCreated(ref int started_at_attribute_id, ref int ended_at_attribute_id) public static bool IsLinkCreated(ref int started_at_attribute_id, ref int ended_at_attribute_id)
@ -184,7 +184,7 @@ namespace ImNodesNET
{ {
fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id) fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkCreatedBoolPtr(native_started_at_attribute_id, native_ended_at_attribute_id, created_from_snap); byte ret = imnodesNative.imnodes_IsLinkCreatedBoolPtr(native_started_at_attribute_id, native_ended_at_attribute_id, created_from_snap);
return ret != 0; return ret != 0;
} }
} }
@ -197,7 +197,7 @@ namespace ImNodesNET
{ {
fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id) fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkCreatedBoolPtr(native_started_at_attribute_id, native_ended_at_attribute_id, native_created_from_snap); byte ret = imnodesNative.imnodes_IsLinkCreatedBoolPtr(native_started_at_attribute_id, native_ended_at_attribute_id, native_created_from_snap);
created_from_snap = native_created_from_snap_val != 0; created_from_snap = native_created_from_snap_val != 0;
return ret != 0; return ret != 0;
} }
@ -214,7 +214,7 @@ namespace ImNodesNET
{ {
fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id) fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkCreatedIntPtr(native_started_at_node_id, native_started_at_attribute_id, native_ended_at_node_id, native_ended_at_attribute_id, created_from_snap); byte ret = imnodesNative.imnodes_IsLinkCreatedIntPtr(native_started_at_node_id, native_started_at_attribute_id, native_ended_at_node_id, native_ended_at_attribute_id, created_from_snap);
return ret != 0; return ret != 0;
} }
} }
@ -233,7 +233,7 @@ namespace ImNodesNET
{ {
fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id) fixed (int* native_ended_at_attribute_id = &ended_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkCreatedIntPtr(native_started_at_node_id, native_started_at_attribute_id, native_ended_at_node_id, native_ended_at_attribute_id, native_created_from_snap); byte ret = imnodesNative.imnodes_IsLinkCreatedIntPtr(native_started_at_node_id, native_started_at_attribute_id, native_ended_at_node_id, native_ended_at_attribute_id, native_created_from_snap);
created_from_snap = native_created_from_snap_val != 0; created_from_snap = native_created_from_snap_val != 0;
return ret != 0; return ret != 0;
} }
@ -245,7 +245,7 @@ namespace ImNodesNET
{ {
fixed (int* native_link_id = &link_id) fixed (int* native_link_id = &link_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkDestroyed(native_link_id); byte ret = imnodesNative.imnodes_IsLinkDestroyed(native_link_id);
return ret != 0; return ret != 0;
} }
} }
@ -253,7 +253,7 @@ namespace ImNodesNET
{ {
int* started_at_attribute_id = null; int* started_at_attribute_id = null;
byte including_detached_links = 1; byte including_detached_links = 1;
byte ret = ImNodesNative.imnodes_IsLinkDropped(started_at_attribute_id, including_detached_links); byte ret = imnodesNative.imnodes_IsLinkDropped(started_at_attribute_id, including_detached_links);
return ret != 0; return ret != 0;
} }
public static bool IsLinkDropped(ref int started_at_attribute_id) public static bool IsLinkDropped(ref int started_at_attribute_id)
@ -261,7 +261,7 @@ namespace ImNodesNET
byte including_detached_links = 1; byte including_detached_links = 1;
fixed (int* native_started_at_attribute_id = &started_at_attribute_id) fixed (int* native_started_at_attribute_id = &started_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkDropped(native_started_at_attribute_id, including_detached_links); byte ret = imnodesNative.imnodes_IsLinkDropped(native_started_at_attribute_id, including_detached_links);
return ret != 0; return ret != 0;
} }
} }
@ -270,7 +270,7 @@ namespace ImNodesNET
byte native_including_detached_links = including_detached_links ? (byte)1 : (byte)0; byte native_including_detached_links = including_detached_links ? (byte)1 : (byte)0;
fixed (int* native_started_at_attribute_id = &started_at_attribute_id) fixed (int* native_started_at_attribute_id = &started_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkDropped(native_started_at_attribute_id, native_including_detached_links); byte ret = imnodesNative.imnodes_IsLinkDropped(native_started_at_attribute_id, native_including_detached_links);
return ret != 0; return ret != 0;
} }
} }
@ -278,7 +278,7 @@ namespace ImNodesNET
{ {
fixed (int* native_link_id = &link_id) fixed (int* native_link_id = &link_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkHovered(native_link_id); byte ret = imnodesNative.imnodes_IsLinkHovered(native_link_id);
return ret != 0; return ret != 0;
} }
} }
@ -286,7 +286,7 @@ namespace ImNodesNET
{ {
fixed (int* native_started_at_attribute_id = &started_at_attribute_id) fixed (int* native_started_at_attribute_id = &started_at_attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsLinkStarted(native_started_at_attribute_id); byte ret = imnodesNative.imnodes_IsLinkStarted(native_started_at_attribute_id);
return ret != 0; return ret != 0;
} }
} }
@ -294,7 +294,7 @@ namespace ImNodesNET
{ {
fixed (int* native_node_id = &node_id) fixed (int* native_node_id = &node_id)
{ {
byte ret = ImNodesNative.imnodes_IsNodeHovered(native_node_id); byte ret = imnodesNative.imnodes_IsNodeHovered(native_node_id);
return ret != 0; return ret != 0;
} }
} }
@ -302,13 +302,13 @@ namespace ImNodesNET
{ {
fixed (int* native_attribute_id = &attribute_id) fixed (int* native_attribute_id = &attribute_id)
{ {
byte ret = ImNodesNative.imnodes_IsPinHovered(native_attribute_id); byte ret = imnodesNative.imnodes_IsPinHovered(native_attribute_id);
return ret != 0; return ret != 0;
} }
} }
public static void Link(int id, int start_attribute_id, int end_attribute_id) public static void Link(int id, int start_attribute_id, int end_attribute_id)
{ {
ImNodesNative.imnodes_Link(id, start_attribute_id, end_attribute_id); imnodesNative.imnodes_Link(id, start_attribute_id, end_attribute_id);
} }
public static void LoadCurrentEditorStateFromIniFile(string file_name) public static void LoadCurrentEditorStateFromIniFile(string file_name)
{ {
@ -330,7 +330,7 @@ namespace ImNodesNET
native_file_name[native_file_name_offset] = 0; native_file_name[native_file_name_offset] = 0;
} }
else { native_file_name = null; } else { native_file_name = null; }
ImNodesNative.imnodes_LoadCurrentEditorStateFromIniFile(native_file_name); imnodesNative.imnodes_LoadCurrentEditorStateFromIniFile(native_file_name);
if (file_name_byteCount > Util.StackAllocationSizeLimit) if (file_name_byteCount > Util.StackAllocationSizeLimit)
{ {
Util.Free(native_file_name); Util.Free(native_file_name);
@ -356,7 +356,7 @@ namespace ImNodesNET
native_data[native_data_offset] = 0; native_data[native_data_offset] = 0;
} }
else { native_data = null; } else { native_data = null; }
ImNodesNative.imnodes_LoadCurrentEditorStateFromIniString(native_data, data_size); imnodesNative.imnodes_LoadCurrentEditorStateFromIniString(native_data, data_size);
if (data_byteCount > Util.StackAllocationSizeLimit) if (data_byteCount > Util.StackAllocationSizeLimit)
{ {
Util.Free(native_data); Util.Free(native_data);
@ -382,7 +382,7 @@ namespace ImNodesNET
native_file_name[native_file_name_offset] = 0; native_file_name[native_file_name_offset] = 0;
} }
else { native_file_name = null; } else { native_file_name = null; }
ImNodesNative.imnodes_LoadEditorStateFromIniFile(editor, native_file_name); imnodesNative.imnodes_LoadEditorStateFromIniFile(editor, native_file_name);
if (file_name_byteCount > Util.StackAllocationSizeLimit) if (file_name_byteCount > Util.StackAllocationSizeLimit)
{ {
Util.Free(native_file_name); Util.Free(native_file_name);
@ -408,7 +408,7 @@ namespace ImNodesNET
native_data[native_data_offset] = 0; native_data[native_data_offset] = 0;
} }
else { native_data = null; } else { native_data = null; }
ImNodesNative.imnodes_LoadEditorStateFromIniString(editor, native_data, data_size); imnodesNative.imnodes_LoadEditorStateFromIniString(editor, native_data, data_size);
if (data_byteCount > Util.StackAllocationSizeLimit) if (data_byteCount > Util.StackAllocationSizeLimit)
{ {
Util.Free(native_data); Util.Free(native_data);
@ -416,37 +416,37 @@ namespace ImNodesNET
} }
public static int NumSelectedLinks() public static int NumSelectedLinks()
{ {
int ret = ImNodesNative.imnodes_NumSelectedLinks(); int ret = imnodesNative.imnodes_NumSelectedLinks();
return ret; return ret;
} }
public static int NumSelectedNodes() public static int NumSelectedNodes()
{ {
int ret = ImNodesNative.imnodes_NumSelectedNodes(); int ret = imnodesNative.imnodes_NumSelectedNodes();
return ret; return ret;
} }
public static void PopAttributeFlag() public static void PopAttributeFlag()
{ {
ImNodesNative.imnodes_PopAttributeFlag(); imnodesNative.imnodes_PopAttributeFlag();
} }
public static void PopColorStyle() public static void PopColorStyle()
{ {
ImNodesNative.imnodes_PopColorStyle(); imnodesNative.imnodes_PopColorStyle();
} }
public static void PopStyleVar() public static void PopStyleVar()
{ {
ImNodesNative.imnodes_PopStyleVar(); imnodesNative.imnodes_PopStyleVar();
} }
public static void PushAttributeFlag(AttributeFlags flag) public static void PushAttributeFlag(AttributeFlags flag)
{ {
ImNodesNative.imnodes_PushAttributeFlag(flag); imnodesNative.imnodes_PushAttributeFlag(flag);
} }
public static void PushColorStyle(ColorStyle item, uint color) public static void PushColorStyle(ColorStyle item, uint color)
{ {
ImNodesNative.imnodes_PushColorStyle(item, color); imnodesNative.imnodes_PushColorStyle(item, color);
} }
public static void PushStyleVar(StyleVar style_item, float value) public static void PushStyleVar(StyleVar style_item, float value)
{ {
ImNodesNative.imnodes_PushStyleVar(style_item, value); imnodesNative.imnodes_PushStyleVar(style_item, value);
} }
public static void SaveCurrentEditorStateToIniFile(string file_name) public static void SaveCurrentEditorStateToIniFile(string file_name)
{ {
@ -468,7 +468,7 @@ namespace ImNodesNET
native_file_name[native_file_name_offset] = 0; native_file_name[native_file_name_offset] = 0;
} }
else { native_file_name = null; } else { native_file_name = null; }
ImNodesNative.imnodes_SaveCurrentEditorStateToIniFile(native_file_name); imnodesNative.imnodes_SaveCurrentEditorStateToIniFile(native_file_name);
if (file_name_byteCount > Util.StackAllocationSizeLimit) if (file_name_byteCount > Util.StackAllocationSizeLimit)
{ {
Util.Free(native_file_name); Util.Free(native_file_name);
@ -477,14 +477,14 @@ namespace ImNodesNET
public static string SaveCurrentEditorStateToIniString() public static string SaveCurrentEditorStateToIniString()
{ {
uint* data_size = null; uint* data_size = null;
byte* ret = ImNodesNative.imnodes_SaveCurrentEditorStateToIniString(data_size); byte* ret = imnodesNative.imnodes_SaveCurrentEditorStateToIniString(data_size);
return Util.StringFromPtr(ret); return Util.StringFromPtr(ret);
} }
public static string SaveCurrentEditorStateToIniString(ref uint data_size) public static string SaveCurrentEditorStateToIniString(ref uint data_size)
{ {
fixed (uint* native_data_size = &data_size) fixed (uint* native_data_size = &data_size)
{ {
byte* ret = ImNodesNative.imnodes_SaveCurrentEditorStateToIniString(native_data_size); byte* ret = imnodesNative.imnodes_SaveCurrentEditorStateToIniString(native_data_size);
return Util.StringFromPtr(ret); return Util.StringFromPtr(ret);
} }
} }
@ -508,7 +508,7 @@ namespace ImNodesNET
native_file_name[native_file_name_offset] = 0; native_file_name[native_file_name_offset] = 0;
} }
else { native_file_name = null; } else { native_file_name = null; }
ImNodesNative.imnodes_SaveEditorStateToIniFile(editor, native_file_name); imnodesNative.imnodes_SaveEditorStateToIniFile(editor, native_file_name);
if (file_name_byteCount > Util.StackAllocationSizeLimit) if (file_name_byteCount > Util.StackAllocationSizeLimit)
{ {
Util.Free(native_file_name); Util.Free(native_file_name);
@ -517,53 +517,53 @@ namespace ImNodesNET
public static string SaveEditorStateToIniString(IntPtr editor) public static string SaveEditorStateToIniString(IntPtr editor)
{ {
uint* data_size = null; uint* data_size = null;
byte* ret = ImNodesNative.imnodes_SaveEditorStateToIniString(editor, data_size); byte* ret = imnodesNative.imnodes_SaveEditorStateToIniString(editor, data_size);
return Util.StringFromPtr(ret); return Util.StringFromPtr(ret);
} }
public static string SaveEditorStateToIniString(IntPtr editor, ref uint data_size) public static string SaveEditorStateToIniString(IntPtr editor, ref uint data_size)
{ {
fixed (uint* native_data_size = &data_size) fixed (uint* native_data_size = &data_size)
{ {
byte* ret = ImNodesNative.imnodes_SaveEditorStateToIniString(editor, native_data_size); byte* ret = imnodesNative.imnodes_SaveEditorStateToIniString(editor, native_data_size);
return Util.StringFromPtr(ret); return Util.StringFromPtr(ret);
} }
} }
public static void SetImGuiContext(IntPtr ctx) public static void SetImGuiContext(IntPtr ctx)
{ {
ImNodesNative.imnodes_SetImGuiContext(ctx); imnodesNative.imnodes_SetImGuiContext(ctx);
} }
public static void SetNodeDraggable(int node_id, bool draggable) public static void SetNodeDraggable(int node_id, bool draggable)
{ {
byte native_draggable = draggable ? (byte)1 : (byte)0; byte native_draggable = draggable ? (byte)1 : (byte)0;
ImNodesNative.imnodes_SetNodeDraggable(node_id, native_draggable); imnodesNative.imnodes_SetNodeDraggable(node_id, native_draggable);
} }
public static void SetNodeEditorSpacePos(int node_id, Vector2 editor_space_pos) public static void SetNodeEditorSpacePos(int node_id, Vector2 editor_space_pos)
{ {
ImNodesNative.imnodes_SetNodeEditorSpacePos(node_id, editor_space_pos); imnodesNative.imnodes_SetNodeEditorSpacePos(node_id, editor_space_pos);
} }
public static void SetNodeGridSpacePos(int node_id, Vector2 grid_pos) public static void SetNodeGridSpacePos(int node_id, Vector2 grid_pos)
{ {
ImNodesNative.imnodes_SetNodeGridSpacePos(node_id, grid_pos); imnodesNative.imnodes_SetNodeGridSpacePos(node_id, grid_pos);
} }
public static void SetNodeScreenSpacePos(int node_id, Vector2 screen_space_pos) public static void SetNodeScreenSpacePos(int node_id, Vector2 screen_space_pos)
{ {
ImNodesNative.imnodes_SetNodeScreenSpacePos(node_id, screen_space_pos); imnodesNative.imnodes_SetNodeScreenSpacePos(node_id, screen_space_pos);
} }
public static void Shutdown() public static void Shutdown()
{ {
ImNodesNative.imnodes_Shutdown(); imnodesNative.imnodes_Shutdown();
} }
public static void StyleColorsClassic() public static void StyleColorsClassic()
{ {
ImNodesNative.imnodes_StyleColorsClassic(); imnodesNative.imnodes_StyleColorsClassic();
} }
public static void StyleColorsDark() public static void StyleColorsDark()
{ {
ImNodesNative.imnodes_StyleColorsDark(); imnodesNative.imnodes_StyleColorsDark();
} }
public static void StyleColorsLight() public static void StyleColorsLight()
{ {
ImNodesNative.imnodes_StyleColorsLight(); imnodesNative.imnodes_StyleColorsLight();
} }
} }
} }

@ -3,9 +3,9 @@ using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ImGuiNET; using ImGuiNET;
namespace ImNodesNET namespace imnodesNET
{ {
public static unsafe partial class ImNodesNative public static unsafe partial class imnodesNative
{ {
[DllImport("cimnodes", CallingConvention = CallingConvention.Cdecl)] [DllImport("cimnodes", CallingConvention = CallingConvention.Cdecl)]
public static extern void EmulateThreeButtonMouse_destroy(EmulateThreeButtonMouse* self); public static extern void EmulateThreeButtonMouse_destroy(EmulateThreeButtonMouse* self);

@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using ImGuiNET; using ImGuiNET;
namespace ImNodesNET namespace imnodesNET
{ {
public unsafe partial struct LinkDetachWithModifierClick public unsafe partial struct LinkDetachWithModifierClick
{ {
@ -21,7 +21,7 @@ namespace ImNodesNET
public IntPtr modifier { get => (IntPtr)NativePtr->modifier; set => NativePtr->modifier = (byte*)value; } public IntPtr modifier { get => (IntPtr)NativePtr->modifier; set => NativePtr->modifier = (byte*)value; }
public void Destroy() public void Destroy()
{ {
ImNodesNative.LinkDetachWithModifierClick_destroy((LinkDetachWithModifierClick*)(NativePtr)); imnodesNative.LinkDetachWithModifierClick_destroy((LinkDetachWithModifierClick*)(NativePtr));
} }
} }
} }

@ -1,12 +1,12 @@
namespace ImNodesNET namespace imnodesNET
{ {
public enum PinShape public enum PinShape
{ {
_Circle = 0, Circle = 0,
_CircleFilled = 1, CircleFilled = 1,
_Triangle = 2, Triangle = 2,
_TriangleFilled = 3, TriangleFilled = 3,
_Quad = 4, Quad = 4,
_QuadFilled = 5, QuadFilled = 5,
} }
} }

@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using ImGuiNET; using ImGuiNET;
namespace ImNodesNET namespace imnodesNET
{ {
public unsafe partial struct Style public unsafe partial struct Style
{ {
@ -51,7 +51,7 @@ namespace ImNodesNET
public RangeAccessor<uint> colors => new RangeAccessor<uint>(NativePtr->colors, 16); public RangeAccessor<uint> colors => new RangeAccessor<uint>(NativePtr->colors, 16);
public void Destroy() public void Destroy()
{ {
ImNodesNative.Style_destroy((Style*)(NativePtr)); imnodesNative.Style_destroy((Style*)(NativePtr));
} }
} }
} }

@ -1,10 +1,10 @@
namespace ImNodesNET namespace imnodesNET
{ {
[System.Flags] [System.Flags]
public enum StyleFlags public enum StyleFlags
{ {
_None = 0, None = 0,
_NodeOutline = 1, NodeOutline = 1,
_GridLines = 4, GridLines = 4,
} }
} }

@ -1,20 +1,20 @@
namespace ImNodesNET namespace imnodesNET
{ {
public enum StyleVar public enum StyleVar
{ {
_GridSpacing = 0, GridSpacing = 0,
_NodeCornerRounding = 1, NodeCornerRounding = 1,
_NodePaddingHorizontal = 2, NodePaddingHorizontal = 2,
_NodePaddingVertical = 3, NodePaddingVertical = 3,
_NodeBorderThickness = 4, NodeBorderThickness = 4,
_LinkThickness = 5, LinkThickness = 5,
_LinkLineSegmentsPerLength = 6, LinkLineSegmentsPerLength = 6,
_LinkHoverDistance = 7, LinkHoverDistance = 7,
_PinCircleRadius = 8, PinCircleRadius = 8,
_PinQuadSideLength = 9, PinQuadSideLength = 9,
_PinTriangleSideLength = 10, PinTriangleSideLength = 10,
_PinLineThickness = 11, PinLineThickness = 11,
_PinHoverRadius = 12, PinHoverRadius = 12,
_PinOffset = 13, PinOffset = 13,
} }
} }

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Description>A .NET wrapper for the ImNodes library.</Description> <Description>A .NET wrapper for the imnodes library.</Description>
<AssemblyVersion>0.3.0</AssemblyVersion> <AssemblyVersion>0.3.0</AssemblyVersion>
<Authors>Eric Mellino</Authors> <Authors>Eric Mellino</Authors>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
@ -10,10 +10,10 @@
<PackageId>ImNodes.NET</PackageId> <PackageId>ImNodes.NET</PackageId>
<PackagePrereleaseIdentifier></PackagePrereleaseIdentifier> <PackagePrereleaseIdentifier></PackagePrereleaseIdentifier>
<PackageVersion>$(AssemblyVersion)$(PackagePrereleaseIdentifier)</PackageVersion> <PackageVersion>$(AssemblyVersion)$(PackagePrereleaseIdentifier)</PackageVersion>
<PackageTags>ImNodes ImGui ImGui.NET Immediate Mode GUI</PackageTags> <PackageTags>imnodes ImGui ImGui.NET Immediate Mode GUI</PackageTags>
<PackageProjectUrl>https://github.com/mellinoe/imgui.net</PackageProjectUrl> <PackageProjectUrl>https://github.com/mellinoe/imgui.net</PackageProjectUrl>
<DocumentationFile Condition="'$(Configuration)' == 'Release'">$(OutputPath)\ImNodes.NET.xml</DocumentationFile> <DocumentationFile Condition="'$(Configuration)' == 'Release'">$(OutputPath)\imnodes.NET.xml</DocumentationFile>
<RootNamespace>ImNodesNET</RootNamespace> <RootNamespace>imnodesNET</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" /> <PackageReference Include="System.Numerics.Vectors" Version="4.4.0" />

Loading…
Cancel
Save