Skip to content

Commit

Permalink
Disable code in mobile export
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Oct 27, 2023
1 parent 2991202 commit fc172e7
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/ImGuiGD.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -249,3 +250,4 @@ public enum RendererType
Canvas,
RenderingDevice
}
#endif
15 changes: 15 additions & 0 deletions addons/imgui-godot/ImGuiGodot/ImGuiLayer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Godot;
#if !GODOT_MOBILE
using ImGuiNET;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -247,3 +248,17 @@ private void PrintErrContentScale()
GD.PrintErr($" current mode is {_window.ContentScaleMode}/{_window.ContentScaleAspect}");
}
}
#else
namespace ImGuiNET
{
}

namespace ImGuiGodot
{
public partial class ImGuiLayer : CanvasLayer
{
[Export(PropertyHint.ResourceType, "ImGuiConfig")]
public GodotObject Config = null!;
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/CanvasRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -218,3 +219,4 @@ private void ClearCanvasItems()
_canvasItemPools.Clear();
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/DummyRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;

Expand Down Expand Up @@ -31,3 +32,4 @@ public void Shutdown()
{
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/Fonts.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -166,3 +167,4 @@ public unsafe void RebuildFontAtlas(float scale)
ImGui.GetStyle().ScaleAllSizes(scale);
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/Input.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -395,3 +396,4 @@ private static void UpdateKeyMods(ImGuiIOPtr io)
_ => ImGuiKey.None
};
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/RdRenderer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -404,3 +405,4 @@ protected Rid GetFramebuffer(Rid vprid)
return fb;
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -128,3 +129,4 @@ private void OnFramePreDraw()
FreeUnusedTextures();
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/State.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -89,3 +90,4 @@ public unsafe void SetIniFilename(ImGuiIOPtr io, string fileName)
}
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/Util.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using System;
using System.Reflection;
Expand Down Expand Up @@ -32,3 +33,4 @@ public static Rid AddLayerSubViewport(Node parent)
return svp;
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Internal/Viewports.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -348,3 +349,4 @@ private static void Godot_SetWindowTitle(ImGuiViewportPtr vp, string title)
window.SetWindowTitle(title);
}
}
#endif
2 changes: 2 additions & 0 deletions addons/imgui-godot/ImGuiGodot/Widgets.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !GODOT_MOBILE
using Godot;
using ImGuiNET;
using System;
Expand Down Expand Up @@ -87,3 +88,4 @@ public static bool ImageButton(string str_id, Texture2D tex, Vector2 size, Vecto
return ImGui.ImageButton(str_id, (IntPtr)tex.GetRid().Id, size, uv0, uv1, bg_col, tint_col);
}
}
#endif
2 changes: 2 additions & 0 deletions src/MyNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public override void _Ready()

public override void _Process(double delta)
{
#if !GODOT_MOBILE
ImGui.ShowDemoWindow();
#endif
}

private void OnButton1Pressed()
Expand Down
2 changes: 2 additions & 0 deletions src/MySecondNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace DemoProject;

public partial class MySecondNode : Node
{
#if !GODOT_MOBILE
private Texture2D _iconTexture = null!;
private SubViewport _vp = null!;
private int _iconSize = 64;
Expand Down Expand Up @@ -162,4 +163,5 @@ private void OnScaleChanged()
// old font pointers are invalid after changing scale
_proggy = ImGui.GetIO().Fonts.Fonts[1];
}
#endif
}

0 comments on commit fc172e7

Please sign in to comment.