(a17abe3fa) Remove a not so useful loop from a method, which might be used often.
This commit is contained in:
@@ -67,7 +67,6 @@ namespace Barotrauma
|
||||
public static bool ScreenChanged;
|
||||
|
||||
public static ScalableFont Font => Style?.Font;
|
||||
public static ScalableFont UnscaledSmallFont => Style?.UnscaledSmallFont;
|
||||
public static ScalableFont SmallFont => Style?.SmallFont;
|
||||
public static ScalableFont LargeFont => Style?.LargeFont;
|
||||
public static ScalableFont VideoTitleFont => Style?.VideoTitleFont;
|
||||
|
||||
@@ -471,16 +471,13 @@ namespace Barotrauma
|
||||
|
||||
public static void DrawToolTip(SpriteBatch spriteBatch, string toolTip, Rectangle targetElement)
|
||||
{
|
||||
int width = (int)(400 * GUI.Scale);
|
||||
int height = (int)(18 * GUI.Scale);
|
||||
Point padding = new Point((int)(20 * GUI.Scale), (int)(7 * GUI.Scale));
|
||||
|
||||
int width = 400;
|
||||
if (toolTipBlock == null || (string)toolTipBlock.userData != toolTip)
|
||||
{
|
||||
toolTipBlock = new GUITextBlock(new RectTransform(new Point(width, height), null), toolTip, font: GUI.SmallFont, wrap: true, style: "GUIToolTip");
|
||||
toolTipBlock = new GUITextBlock(new RectTransform(new Point(width, 18), null), toolTip, font: GUI.SmallFont, wrap: true, style: "GUIToolTip");
|
||||
toolTipBlock.RectTransform.NonScaledSize = new Point(
|
||||
(int)(GUI.SmallFont.MeasureString(toolTipBlock.WrappedText).X + padding.X),
|
||||
(int)(GUI.SmallFont.MeasureString(toolTipBlock.WrappedText).Y + padding.Y));
|
||||
(int)(GUI.SmallFont.MeasureString(toolTipBlock.WrappedText).X + 20),
|
||||
toolTipBlock.WrappedText.Split('\n').Length * 18 + 7);
|
||||
toolTipBlock.userData = toolTip;
|
||||
}
|
||||
toolTipBlock.SetTextPos();
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace Barotrauma
|
||||
private ScalableFont defaultFont;
|
||||
|
||||
public ScalableFont Font { get; private set; }
|
||||
public ScalableFont UnscaledSmallFont { get; private set; }
|
||||
public ScalableFont SmallFont { get; private set; }
|
||||
public ScalableFont LargeFont { get; private set; }
|
||||
public ScalableFont VideoTitleFont { get; private set; }
|
||||
@@ -65,9 +64,6 @@ namespace Barotrauma
|
||||
case "font":
|
||||
Font = LoadFont(subElement, graphicsDevice);
|
||||
break;
|
||||
case "unscaledsmallfont":
|
||||
UnscaledSmallFont = LoadFont(subElement, graphicsDevice);
|
||||
break;
|
||||
case "smallfont":
|
||||
SmallFont = LoadFont(subElement, graphicsDevice);
|
||||
break;
|
||||
|
||||
@@ -203,12 +203,10 @@ namespace Barotrauma
|
||||
{
|
||||
string wrappedTip = ToolBox.WrapText(selectedTip, GameMain.GraphicsWidth * 0.5f, GUI.Font);
|
||||
string[] lines = wrappedTip.Split('\n');
|
||||
float lineHeight = GUI.Font.MeasureString(selectedTip).Y;
|
||||
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
GUI.Font.DrawString(spriteBatch, lines[i],
|
||||
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f, GameMain.GraphicsHeight * 0.78f + i * lineHeight), Color.White);
|
||||
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f, GameMain.GraphicsHeight * 0.78f + i * (15 * GUI.Scale)), Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user