From 6740dbd4e1408fbd98637747160c17b3adfd87cb Mon Sep 17 00:00:00 2001 From: prime31 Date: Tue, 19 Feb 2019 10:36:23 -0800 Subject: [PATCH] Create DemoComponent.cs --- project_name/DemoComponent.cs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 project_name/DemoComponent.cs diff --git a/project_name/DemoComponent.cs b/project_name/DemoComponent.cs new file mode 100644 index 0000000..cceb7c0 --- /dev/null +++ b/project_name/DemoComponent.cs @@ -0,0 +1,34 @@ +using ImGuiNET; +using Nez; +using Nez.ImGuiTools; + +namespace project_name +{ + public class DemoComponent : Component + { + int _buttonClickCounter; + + public override void onAddedToEntity() + { + // register with the ImGuiMangaer letting it know we want to render some IMGUI + Core.getGlobalManager().registerDrawCommand(imGuiDraw); + } + + public override void onRemovedFromEntity() + { + // remove ourselves when we are removed from the Scene + Core.getGlobalManager().unregisterDrawCommand(imGuiDraw); + } + + 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(); + } + + } +}