Skip to content

Commit

Permalink
move Connect to ImGuiGD
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jan 18, 2024
1 parent da6dde4 commit 0270140
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
10 changes: 10 additions & 0 deletions addons/imgui-godot/ImGuiGodot/ImGuiGD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,15 @@ public static void RebuildFontAtlas()

Internal.State.Instance.Fonts.RebuildFontAtlas(scaleToDpi ? Scale * dpiFactor : Scale);
}

public static void Connect(Callable callable)
{
ImGuiLayer.Instance?.Signaler.Connect("imgui_layout", callable);
}

public static void Connect(Action action)
{
Connect(Callable.From(action));
}
}
#endif
11 changes: 0 additions & 11 deletions addons/imgui-godot/ImGuiGodot/ImGuiLayer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Godot;
#if GODOT_PC
using ImGuiNET;
using System;

namespace ImGuiGodot;

Expand Down Expand Up @@ -152,16 +151,6 @@ public override void _Input(InputEvent e)
}
}

public static void Connect(Callable callable)
{
Instance?.Signaler.Connect("imgui_layout", callable);
}

public static void Connect(Action action)
{
Connect(Callable.From(action));
}

private void CheckContentScale()
{
switch (_window.ContentScaleMode)
Expand Down
2 changes: 1 addition & 1 deletion src/MySecondNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void _EnterTree()

public override void _Ready()
{
ImGuiLayer.Connect(OnImGuiLayout);
ImGuiGD.Connect(OnImGuiLayout);
_iconTexture = GD.Load<Texture2D>("res://data/icon.svg");
_atlasTexture = GD.Load<AtlasTexture>("res://data/robot_eye.tres");
_vp = GetNode<SubViewport>("%SubViewport");
Expand Down

0 comments on commit 0270140

Please sign in to comment.