mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25: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;
|
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) {
|
public void SetText(int index, string text) {
|
||||||
gfx.DeleteTexture(ref Textures[index]);
|
gfx.DeleteTexture(ref Textures[index]);
|
||||||
DrawTextArgs args = new DrawTextArgs(text, font, true);
|
|
||||||
linkData[index] = default(LinkData);
|
linkData[index] = default(LinkData);
|
||||||
LinkFlags prevFlags = index > 0 ? linkData[index - 1].flags : 0;
|
Texture tex;
|
||||||
|
|
||||||
if (!IDrawer2D.EmptyText(text)) {
|
if (!IDrawer2D.EmptyText(text)) {
|
||||||
Texture tex = NextToken(text, 0, ref prevFlags) == -1 ? DrawSimple(ref args) :
|
tex = MakeTexture(index, text);
|
||||||
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;
|
|
||||||
lines[index] = text;
|
lines[index] = text;
|
||||||
} else {
|
} else {
|
||||||
int height = PlaceholderHeight[index] ? defaultHeight : 0;
|
tex = new Texture(-1, 0, 0, 0, 0, 0, 0);
|
||||||
int y = CalcY(index, height);
|
tex.Height = (ushort)(PlaceholderHeight[index] ? defaultHeight : 0);
|
||||||
Textures[index] = new Texture(-1, 0, y, 0, height, 0, 0);
|
|
||||||
lines[index] = null;
|
lines[index] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tex.X1 = CalcPos(HorizontalAnchor, XOffset, tex.Width, game.Width);
|
||||||
|
tex.Y1 = CalcY(index, tex.Height);
|
||||||
|
Textures[index] = tex;
|
||||||
UpdateDimensions();
|
UpdateDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture DrawSimple(ref DrawTextArgs args) {
|
|
||||||
return game.Drawer2D.MakeTextTexture(ref args, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe Texture DrawAdvanced(ref DrawTextArgs args, int index, string text) {
|
unsafe Texture DrawAdvanced(ref DrawTextArgs args, int index, string text) {
|
||||||
LinkData data = Split(index, text);
|
LinkData data = Split(index, text);
|
||||||
Size total = Size.Empty;
|
Size total = Size.Empty;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user