Skip to content

Commit

Permalink
remove Init from IRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jan 19, 2024
1 parent b1c9de7 commit 80aa5b4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 32 deletions.
6 changes: 0 additions & 6 deletions addons/imgui-godot/ImGuiGodot/Internal/CanvasRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ private sealed class ViewportData

public string Name => "godot4_net_canvas";

public void Init(ImGuiIOPtr io)
{
io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset;
io.BackendFlags |= ImGuiBackendFlags.RendererHasViewports;
}

public void InitViewport(Rid vprid)
{
Rid canvas = RenderingServer.CanvasCreate();
Expand Down
5 changes: 0 additions & 5 deletions addons/imgui-godot/ImGuiGodot/Internal/DummyRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#if GODOT_PC
using Godot;
using ImGuiNET;

namespace ImGuiGodot.Internal;

internal sealed class DummyRenderer : IRenderer
{
public string Name => "godot4_net_dummy";

public void Init(ImGuiIOPtr io)
{
}

public void InitViewport(Rid vprid)
{
}
Expand Down
13 changes: 13 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/IRenderer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Godot;

namespace ImGuiGodot.Internal;

internal interface IRenderer
{
public string Name { get; }
public void InitViewport(Rid vprid);
public void CloseViewport(Rid vprid);
public void RenderDrawData();
public void OnHide();
public void Shutdown();
}
6 changes: 0 additions & 6 deletions addons/imgui-godot/ImGuiGodot/Internal/RdRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ public RdRenderer()
_uniformArray.Resize(1);
}

public void Init(ImGuiIOPtr io)
{
io.BackendFlags |= ImGuiBackendFlags.RendererHasVtxOffset;
io.BackendFlags |= ImGuiBackendFlags.RendererHasViewports;
}

public void InitViewport(Rid vprid)
{
//RenderingServer.ViewportSetUpdateMode(vprid, RenderingServer.ViewportUpdateMode.Disabled);
Expand Down
21 changes: 6 additions & 15 deletions addons/imgui-godot/ImGuiGodot/Internal/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@

namespace ImGuiGodot.Internal;

internal interface IRenderer
{
public string Name { get; }
public void Init(ImGuiIOPtr io);
public void InitViewport(Rid vprid);
public void CloseViewport(Rid vprid);
public void RenderDrawData();
public void OnHide();
public void Shutdown();
}

internal sealed class State : IDisposable
{
private enum RendererType
Expand Down Expand Up @@ -52,10 +41,12 @@ public State(Window mainWindow, Rid mainSubViewport, IRenderer renderer)
ImGui.SetCurrentContext(context);
var io = ImGui.GetIO();

io.BackendFlags = 0;
io.BackendFlags |= ImGuiBackendFlags.HasGamepad;
io.BackendFlags |= ImGuiBackendFlags.HasSetMousePos;
io.BackendFlags |= ImGuiBackendFlags.HasMouseCursors;
io.BackendFlags =
ImGuiBackendFlags.HasGamepad |
ImGuiBackendFlags.HasSetMousePos |
ImGuiBackendFlags.HasMouseCursors |
ImGuiBackendFlags.RendererHasVtxOffset |
ImGuiBackendFlags.RendererHasViewports;

if (_rendererName == IntPtr.Zero)
{
Expand Down

0 comments on commit 80aa5b4

Please sign in to comment.