diff --git a/addons/imgui-godot/ImGuiGodot/ImGuiExtensions.cs b/addons/imgui-godot/ImGuiGodot/ImGuiExtensions.cs new file mode 100644 index 0000000..aed6829 --- /dev/null +++ b/addons/imgui-godot/ImGuiGodot/ImGuiExtensions.cs @@ -0,0 +1,65 @@ +using Godot; +using ImGuiNET; +using Vector3 = System.Numerics.Vector3; +using Vector4 = System.Numerics.Vector4; + +namespace ImGuiGodot; + +public static class ImGuiExtensions +{ + /// + /// Extension method to translate between and + /// + public static ImGuiKey ToImGuiKey(this Key key) + { + return Internal.Input.ConvertKey(key); + } + + /// + /// Extension method to translate between and + /// + public static ImGuiKey ToImGuiKey(this JoyButton button) + { + return Internal.Input.ConvertJoyButton(button); + } + + /// + /// Convert to ImGui color RGBA + /// + public static Vector4 ToVector4(this Color color) + { + return new Vector4(color.R, color.G, color.B, color.A); + } + + /// + /// Convert to ImGui color RGB + /// + public static Vector3 ToVector3(this Color color) + { + return new Vector3(color.R, color.G, color.B); + } + + /// + /// Convert RGB to + /// + public static Color ToColor(this Vector3 vec) + { + return new Color(vec.X, vec.Y, vec.Z); + } + + /// + /// Convert RGBA to + /// + public static Color ToColor(this Vector4 vec) + { + return new Color(vec.X, vec.Y, vec.Z, vec.W); + } + + /// + /// Set IniFilename, converting Godot path to native + /// + public static void SetIniFilename(this ImGuiIOPtr io, string fileName) + { + Internal.State.Instance.SetIniFilename(io, fileName); + } +} diff --git a/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs b/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs index 339f98d..a5a7ff1 100644 --- a/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs +++ b/addons/imgui-godot/ImGuiGodot/ImGuiGD.cs @@ -2,8 +2,6 @@ using Godot; using ImGuiNET; using System; -using Vector3 = System.Numerics.Vector3; -using Vector4 = System.Numerics.Vector4; namespace ImGuiGodot; @@ -176,62 +174,6 @@ public static bool ProcessInput(InputEvent evt, Window window) { return Internal.State.Instance.Input.ProcessInput(evt, window); } - - /// - /// Extension method to translate between and - /// - public static ImGuiKey ToImGuiKey(this Key key) - { - return Internal.Input.ConvertKey(key); - } - - /// - /// Extension method to translate between and - /// - public static ImGuiKey ToImGuiKey(this JoyButton button) - { - return Internal.Input.ConvertJoyButton(button); - } - - /// - /// Convert to ImGui color RGBA - /// - public static Vector4 ToVector4(this Color color) - { - return new Vector4(color.R, color.G, color.B, color.A); - } - - /// - /// Convert to ImGui color RGB - /// - public static Vector3 ToVector3(this Color color) - { - return new Vector3(color.R, color.G, color.B); - } - - /// - /// Convert RGB to - /// - public static Color ToColor(this Vector3 vec) - { - return new Color(vec.X, vec.Y, vec.Z); - } - - /// - /// Convert RGBA to - /// - public static Color ToColor(this Vector4 vec) - { - return new Color(vec.X, vec.Y, vec.Z, vec.W); - } - - /// - /// Set IniFilename, converting Godot path to native - /// - public static void SetIniFilename(this ImGuiIOPtr io, string fileName) - { - Internal.State.Instance.SetIniFilename(io, fileName); - } } public enum RendererType