mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
Use RenderChar instead of AddText
This commit is contained in:
parent
2c3139d8b7
commit
806ecc0faf
2 changed files with 32 additions and 17 deletions
|
|
@ -105,7 +105,7 @@ internal sealed unsafe class DalamudIme : IDisposable, IServiceType
|
|||
/// <summary>
|
||||
/// Gets the input mode icon from <see cref="SeIconChar"/>.
|
||||
/// </summary>
|
||||
internal string? InputModeIcon { get; private set; }
|
||||
internal char InputModeIcon { get; private set; }
|
||||
|
||||
private static ref ImGuiInputTextState TextState => ref *(ImGuiInputTextState*)(ImGui.GetCurrentContext() + 0x4588);
|
||||
|
||||
|
|
@ -251,37 +251,37 @@ internal sealed unsafe class DalamudIme : IDisposable, IServiceType
|
|||
{
|
||||
case LANG.LANG_KOREAN:
|
||||
if (native)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeKoreanHangul}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeKoreanHangul;
|
||||
else if (fullwidth)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeAlphanumeric}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeAlphanumeric;
|
||||
else
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeAlphanumericHalfWidth}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeAlphanumericHalfWidth;
|
||||
break;
|
||||
|
||||
case LANG.LANG_JAPANESE:
|
||||
// wtf
|
||||
// see the function called from: 48 8b 0d ?? ?? ?? ?? e8 ?? ?? ?? ?? 8b d8 e9 ?? 00 00 0
|
||||
if (open && native && katakana && fullwidth)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeKatakana}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeKatakana;
|
||||
else if (open && native && katakana)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeKatakanaHalfWidth}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeKatakanaHalfWidth;
|
||||
else if (open && native)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeHiragana}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeHiragana;
|
||||
else if (open && fullwidth)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeAlphanumeric}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeAlphanumeric;
|
||||
else
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeAlphanumericHalfWidth}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeAlphanumericHalfWidth;
|
||||
break;
|
||||
|
||||
case LANG.LANG_CHINESE:
|
||||
if (native)
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeChineseHan}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeChineseHan;
|
||||
else
|
||||
this.InputModeIcon = $"{(char)SeIconChar.ImeChineseLatin}";
|
||||
this.InputModeIcon = (char)SeIconChar.ImeChineseLatin;
|
||||
break;
|
||||
|
||||
default:
|
||||
this.InputModeIcon = null;
|
||||
this.InputModeIcon = default;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ internal unsafe class DalamudImeWindow : Window
|
|||
|
||||
var drawCand = ime.ImmCand.Count != 0;
|
||||
var drawConv = drawCand || ime.ShowPartialConversion;
|
||||
var drawIme = ime.InputModeIcon != null;
|
||||
var drawIme = ime.InputModeIcon != 0;
|
||||
var imeIconFont = InterfaceManager.DefaultFont;
|
||||
|
||||
var pad = ImGui.GetStyle().WindowPadding;
|
||||
var candTextSize = ImGui.CalcTextSize(ime.ImmComp == string.Empty ? " " : ime.ImmComp);
|
||||
|
|
@ -139,7 +140,9 @@ internal unsafe class DalamudImeWindow : Window
|
|||
{
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
drawList.AddText(
|
||||
imeIconFont.RenderChar(
|
||||
drawList,
|
||||
imeIconFont.FontSize,
|
||||
cursor + new Vector2(dx, dy),
|
||||
ImGui.GetColorU32(ImGuiCol.WindowBg),
|
||||
ime.InputModeIcon);
|
||||
|
|
@ -147,7 +150,12 @@ internal unsafe class DalamudImeWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
drawList.AddText(cursor, ImGui.GetColorU32(ImGuiCol.Text), ime.InputModeIcon);
|
||||
imeIconFont.RenderChar(
|
||||
drawList,
|
||||
imeIconFont.FontSize,
|
||||
cursor,
|
||||
ImGui.GetColorU32(ImGuiCol.Text),
|
||||
ime.InputModeIcon);
|
||||
cursor.Y += candTextSize.Y + spaceY;
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +207,9 @@ internal unsafe class DalamudImeWindow : Window
|
|||
{
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
drawList.AddText(
|
||||
imeIconFont.RenderChar(
|
||||
drawList,
|
||||
imeIconFont.FontSize,
|
||||
cursor + new Vector2(dx, dy),
|
||||
ImGui.GetColorU32(ImGuiCol.WindowBg),
|
||||
ime.InputModeIcon);
|
||||
|
|
@ -207,7 +217,12 @@ internal unsafe class DalamudImeWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
drawList.AddText(cursor, ImGui.GetColorU32(ImGuiCol.Text), ime.InputModeIcon);
|
||||
imeIconFont.RenderChar(
|
||||
drawList,
|
||||
imeIconFont.FontSize,
|
||||
cursor,
|
||||
ImGui.GetColorU32(ImGuiCol.Text),
|
||||
ime.InputModeIcon);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue