Made Draedon's Log work with any resolution

This commit is contained in:
DominicKarma42 committed 2020-07-14 20:33:46 -05:00
1 parent fb3e06d22f
commit 97ffb4c01c
1 file changed
+7 -5
+7 -5
View File
@@ -75,6 +75,7 @@ namespace CalamityMod.UI
if (FadeTime >= FadeTimeMax - 4 && Active)
{
int textWidth = (int)(xScale * 2 * pageTexture.Width) - TextStartOffsetX;
textWidth = (int)(textWidth * Main.screenWidth / 2560f);
List<string> dialogLines = Utils.WordwrapString(placeholderText, Main.fontMouseText, textWidth, 250, out _).ToList();
dialogLines.RemoveAll(text => string.IsNullOrEmpty(text));
@@ -143,12 +144,12 @@ namespace CalamityMod.UI
bool onNextPage = i - startingLine > TotalLinesPerPage;
if (dialogLines[i] != null)
{
int textDrawPositionX = Main.screenWidth / 2 - pageTexture.Width * 2 - TextStartOffsetX;
int textDrawPositionY = 50 + (i - startingLine) * 24 + (int)yPageTop;
int textDrawPositionX = Main.screenWidth / 2 - (int)((pageTexture.Width * 2 - TextStartOffsetX) * Main.screenWidth / 2560f);
int textDrawPositionY = 50 + (int)((i - startingLine) * 24 * Main.screenHeight / 1440f) + (int)yPageTop;
if (onNextPage)
{
textDrawPositionX = Main.screenWidth / 2 + (int)(TextStartOffsetX * 1.5);
textDrawPositionY = 50 + (i - startingLine - (TotalLinesPerPage + 1)) * 24 + (int)yPageTop;
textDrawPositionX = Main.screenWidth / 2 + (int)(TextStartOffsetX * 1.5 * Main.screenWidth / 2560f);
textDrawPositionY = 50 + (int)((i - startingLine - (TotalLinesPerPage + 1)) * 24 * Main.screenHeight / 1440f) + (int)yPageTop;
}
Color drawColor = Color.Lerp(Color.Cyan, Color.DarkCyan, (float)Math.Cos(i * 0.4) * 0.5f + 0.5f);
@@ -159,7 +160,8 @@ namespace CalamityMod.UI
textDrawPositionY,
drawColor,
Color.Black,
Vector2.Zero);
Vector2.Zero,
Main.screenWidth / 2560f);
}
}
}