feat: add new settings ui

Also add window display options.
This commit is contained in:
Anna
2022-01-15 14:27:56 -05:00
parent c835167e33
commit b34a855a92
8 changed files with 239 additions and 156 deletions
+34
View File
@@ -0,0 +1,34 @@
using ChatTwo.Code;
using ChatTwo.Util;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class ChatColours : ISettingsTab {
private Configuration Mutable { get; }
public string Name => "Chat colours";
internal ChatColours(Configuration mutable) {
this.Mutable = mutable;
}
public void Draw() {
foreach (var type in Enum.GetValues<ChatType>()) {
if (ImGui.Button($"Default##{type}")) {
this.Mutable.ChatColours.Remove(type);
}
ImGui.SameLine();
var vec = this.Mutable.ChatColours.TryGetValue(type, out var colour)
? ColourUtil.RgbaToVector3(colour)
: ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0);
if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) {
this.Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec);
}
}
ImGui.TreePop();
}
}