default glyph

This commit is contained in:
Anna 2022-09-06 03:57:38 -04:00
parent 120f037fe1
commit 7b641d1948
3 changed files with 14 additions and 2 deletions

View File

@ -14,4 +14,5 @@ public class Configuration : IPluginConfiguration {
public bool AutoViewer;
public bool AutoViewerClose = true;
public float ViewerOpacity = 100.0f;
public int DefaultGlyph = 3;
}

View File

@ -29,6 +29,12 @@ internal class Settings : ITab {
anyChanged |= ImGui.Checkbox("Close the viewer automatically when no signs are nearby", ref this.Plugin.Config.AutoViewerClose);
anyChanged |= ImGui.SliderFloat("Viewer opacity", ref this.Plugin.Config.ViewerOpacity, 0f, 100.0f, $"{this.Plugin.Config.ViewerOpacity:N3}%%");
var glyph = this.Plugin.Config.DefaultGlyph + 1;
if (ImGui.InputInt("Default glyph", ref glyph)) {
this.Plugin.Config.DefaultGlyph = Math.Min(4, Math.Max(0, glyph - 1));
anyChanged = true;
}
if (anyChanged) {
this.Plugin.SaveConfig();
}

View File

@ -36,6 +36,8 @@ internal class Write : ITab {
internal Write(Plugin plugin) {
this.Plugin = plugin;
this.LoadSignImages();
this._glyph = this.Plugin.Config.DefaultGlyph;
}
public void Dispose() {
@ -175,12 +177,14 @@ internal class Write : ITab {
}
if (ImGui.BeginCombo("Glyph", this._glyph.ToString())) {
var tooltipShown = false;
for (var i = 0; i < 5; i++) {
if (ImGui.Selectable($"{i + 1}", this._glyph == i)) {
this._glyph = i;
}
if (!ImGui.IsItemHovered()) {
if (tooltipShown || !ImGui.IsItemHovered()) {
continue;
}
@ -188,6 +192,7 @@ internal class Write : ITab {
var image = this.GlyphImages[i];
ImGui.Image(image.ImGuiHandle, new Vector2(imageHeight));
ImGui.EndTooltip();
tooltipShown = true;
}
ImGui.EndCombo();
@ -263,7 +268,7 @@ internal class Write : ITab {
this._part1 = this._part2 = this._conj = -1;
this._word1 = (-1, -1);
this._word2 = (-1, -1);
this._glyph = 0;
this._glyph = this.Plugin.Config.DefaultGlyph;
}
private void ClearIfNecessary() {