mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Disable URL detection in classic mode.
This commit is contained in:
parent
15a77f4ae0
commit
5860746eda
@ -158,35 +158,41 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
return null;
|
||||
}
|
||||
|
||||
Texture MakeTexture(int index, string text) {
|
||||
DrawTextArgs args = new DrawTextArgs(text, font, true);
|
||||
LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0;
|
||||
Texture tex;
|
||||
|
||||
if (game.ClassicMode || NextToken(text, 0, ref prevFlags) == -1) {
|
||||
tex = game.Drawer2D.MakeTextTexture(ref args, 0, 0);
|
||||
} else {
|
||||
tex = DrawAdvanced(ref args, index, text);
|
||||
}
|
||||
|
||||
game.Drawer2D.ReducePadding(ref tex, Utils.Floor(args.Font.Size), 3);
|
||||
return tex;
|
||||
}
|
||||
|
||||
public void SetText(int index, string text) {
|
||||
gfx.DeleteTexture(ref Textures[index]);
|
||||
DrawTextArgs args = new DrawTextArgs(text, font, true);
|
||||
linkData[index] = default(LinkData);
|
||||
LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0;
|
||||
Texture tex;
|
||||
|
||||
if (!IDrawer2D.EmptyText(text)) {
|
||||
Texture tex = NextToken(text, 0, ref prevFlags) == -1 ? DrawSimple(ref args) :
|
||||
DrawAdvanced(ref args, index, text);
|
||||
game.Drawer2D.ReducePadding(ref tex, Utils.Floor(args.Font.Size), 3);
|
||||
|
||||
tex.X1 = CalcPos(HorizontalAnchor, XOffset, tex.Width, game.Width);
|
||||
tex.Y1 = CalcY(index, tex.Height);
|
||||
Textures[index] = tex;
|
||||
tex = MakeTexture(index, text);
|
||||
lines[index] = text;
|
||||
} else {
|
||||
int height = PlaceholderHeight[index] ? defaultHeight : 0;
|
||||
int y = CalcY(index, height);
|
||||
Textures[index] = new Texture(-1, 0, y, 0, height, 0, 0);
|
||||
tex = new Texture(-1, 0, 0, 0, 0, 0, 0);
|
||||
tex.Height = (ushort)(PlaceholderHeight[index] ? defaultHeight : 0);
|
||||
lines[index] = null;
|
||||
}
|
||||
|
||||
tex.X1 = CalcPos(HorizontalAnchor, XOffset, tex.Width, game.Width);
|
||||
tex.Y1 = CalcY(index, tex.Height);
|
||||
Textures[index] = tex;
|
||||
UpdateDimensions();
|
||||
}
|
||||
|
||||
Texture DrawSimple(ref DrawTextArgs args) {
|
||||
return game.Drawer2D.MakeTextTexture(ref args, 0, 0);
|
||||
}
|
||||
|
||||
unsafe Texture DrawAdvanced(ref DrawTextArgs args, int index, string text) {
|
||||
LinkData data = Split(index, text);
|
||||
Size total = Size.Empty;
|
||||
|
Loading…
x
Reference in New Issue
Block a user