FNA-VSCode-Template/project_name/DemoComponent.cs
foxnne 3e5a7e6a78 Nearly finalized, added back all the osx compatibility.
Hopefully this now works with both OSX and Windows... I tried to create platform specific properties everywhere I could. All Windows build tasks for VSCode seem to be working correctly now.
2019-09-02 17:49:21 -05:00

40 lines
1.0 KiB
C#

using ImGuiNET;
using Nez;
using Nez.ImGuiTools;
namespace lucid
{
public class DemoComponent : Component
{
int _buttonClickCounter;
public override void onAddedToEntity()
{
// register with the ImGuiMangaer letting it know we want to render some IMGUI
#if DEBUG
Core.getGlobalManager<ImGuiManager>().registerDrawCommand(imGuiDraw);
#endif
}
public override void onRemovedFromEntity()
{
// remove ourselves when we are removed from the Scene
#if DEBUG
Core.getGlobalManager<ImGuiManager>().unregisterDrawCommand(imGuiDraw);
#endif
}
void imGuiDraw()
{
// do your actual drawing here
ImGui.Begin("Your ImGui Window", ImGuiWindowFlags.AlwaysAutoResize);
ImGui.Text("This is being drawn in DemoComponent");
if (ImGui.Button($"Clicked me {_buttonClickCounter} times"))
_buttonClickCounter++;
ImGui.End();
}
}
}