forked from TehCheat/PassiveSkillTreePlanter
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathImGuiExtension.cs
More file actions
33 lines (27 loc) · 910 Bytes
/
ImGuiExtension.cs
File metadata and controls
33 lines (27 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Generic;
using ImGuiNET;
namespace PassiveSkillTreePlanter;
public class ImGuiExtension
{
public static string ComboBox(string sideLabel, string currentSelectedItem, List<string> objectList, out bool didChange,
ImGuiComboFlags comboFlags = ImGuiComboFlags.HeightRegular)
{
if (ImGui.BeginCombo(sideLabel, currentSelectedItem, comboFlags))
{
foreach (var obj in objectList)
{
var isSelected = currentSelectedItem == obj;
if (ImGui.Selectable(obj, isSelected))
{
didChange = true;
ImGui.EndCombo();
return obj;
}
if (isSelected) ImGui.SetItemDefaultFocus();
}
ImGui.EndCombo();
}
didChange = false;
return currentSelectedItem;
}
}