Skip to content

Commit

Permalink
add ImageButton demo
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Dec 23, 2022
1 parent 011ac3b commit 71e2a66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.import/
.mono/
.vs/
.vscode/
*.old
imgui.ini
.godot/
Expand Down
10 changes: 10 additions & 0 deletions src/MySecondNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public partial class MySecondNode : Node
private float scale;
private ImFontPtr proggy;
private ColorRect background;
private int numClicks = 0;

private static bool fontLoaded = false;
private static System.Numerics.Vector4 myTextColor = Colors.Aquamarine.ToVector4();
Expand Down Expand Up @@ -94,6 +95,15 @@ private void OnImGuiLayout()
Widgets.Image(iconTexture, new(iconSize, iconSize));
ImGui.DragInt("size", ref iconSize, 1.0f, 32, 512);

ImGui.Separator();
ImGui.Text("ImageButton");
if (Widgets.ImageButton("myimgbtn", iconTexture, new(128, 128)))
{
++numClicks;
}
ImGui.SameLine();
ImGui.Text($"{numClicks}");

ImGui.Separator();
ImGui.Text("Unicode");
ImGui.Text("Hiragana: こんばんは");
Expand Down

0 comments on commit 71e2a66

Please sign in to comment.