console dpi fix

This commit is contained in:
GoaLitiuM
2021-04-10 18:32:15 +03:00
parent 1234dd9393
commit 6f905f7b30

View File

@@ -343,8 +343,9 @@ namespace Cabrito
base.OnUpdate();
float targetY;
float conHeight = rootControl.Control.Height /*/ Platform.DpiScale*/;
if (!Console.IsOpen)
targetY = -rootControl.Control.Height;
targetY = -conHeight;
else
targetY = 0.0f;
@@ -364,8 +365,8 @@ namespace Cabrito
else if (location.Y < targetY)
{
// opening
if (location.Y < -rootControl.Control.Height * ConsoleHeight)
location.Y = -rootControl.Control.Height * ConsoleHeight;
if (location.Y < -conHeight * ConsoleHeight)
location.Y = -conHeight * ConsoleHeight;
location.Y += Time.UnscaledDeltaTime * ConsoleSpeed;
if (location.Y > targetY)
@@ -381,8 +382,8 @@ namespace Cabrito
}
else if (!Console.IsOpen)
{
int fontHeight = consoleNotifyBox.Font.GetFont().Height;
if (location.Y < (-rootControl.Control.Height * ConsoleHeight) + fontHeight)
int fontHeight = (int)(consoleNotifyBox.Font.GetFont().Height / Platform.DpiScale);
if (location.Y < (-conHeight * ConsoleHeight) + fontHeight)
{
consoleNotifyBox.Visible = true;
consoleInputBox.Visible = false;
@@ -393,7 +394,7 @@ namespace Cabrito
public override void OnLineAdded(string text)
{
int fontHeight = consoleNotifyBox.Font.GetFont().Height;
int fontHeight = (int)(consoleNotifyBox.Font.GetFont().Height / Platform.DpiScale);
consoleNotifyBox.Height = Math.Min(ConsoleNotifyLines, Console.Lines.Count) * fontHeight;
}