Skip to content

Commit

Permalink
Cleanup textbox a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
bittiez committed Feb 7, 2024
1 parent 6856d1d commit a97013f
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions src/ClassicUO.Client/Game/UI/Controls/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,36 +71,8 @@ public TextBox
bool supportsCommands = true,
bool ignoreColorCommands = false,
bool calculateGlyphs = false
)
{
if (strokeEffect)
text = $"/es[{getStrokeSize}]" + text;

_rtl = new RichTextLayout
{
Font = TrueTypeLoader.Instance.GetFont(font, size),
Text = text,
IgnoreColorCommand = ignoreColorCommands,
SupportsCommands = supportsCommands,
CalculateGlyphs = calculateGlyphs
};

if (width != null)
_rtl.Width = width;
) : this(text, font, size, width, ConvertHueToColor(hue), align, strokeEffect, supportsCommands, ignoreColorCommands, calculateGlyphs) { }

_font = font;
_size = size;
_color.PackedValue = HuesLoader.Instance.GetHueColorRgba8888(31, (ushort)hue);

if (hue == 0xFFFF || hue == ushort.MaxValue)
_color = Color.White;

_align = align;

AcceptMouseInput = true;
Width = _rtl.Width == null ? _rtl.Size.X : (int)_rtl.Width;
base.Height = _rtl.Size.Y;
}
public TextBox
(
string text,
Expand Down Expand Up @@ -140,6 +112,11 @@ public TextBox
base.Height = _rtl.Size.Y;
}

public static Color ConvertHueToColor(int hue)
{
return new Color() { PackedValue = HuesLoader.Instance.GetHueColorRgba8888(31, (ushort)hue) };
}

public bool PixelCheck(int x, int y)
{
if (!AcceptMouseInput || string.IsNullOrWhiteSpace(Text))
Expand Down

0 comments on commit a97013f

Please sign in to comment.