Console singleton, dpi fixes, no linespacing
This commit is contained in:
@@ -48,7 +48,7 @@ namespace Cabrito
|
||||
set
|
||||
{
|
||||
heightMultiplier = value;
|
||||
Height = Screen.Size.Y * HeightMultiplier;
|
||||
UpdateHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ namespace Cabrito
|
||||
if (font == null)
|
||||
return (int)Height;
|
||||
|
||||
return (int)Mathf.Round(LineSpacing * (font.Height / Platform.DpiScale) * Scale.Y);
|
||||
int h = (int)Mathf.Round(LineSpacing * (font.Height / Platform.DpiScale) * Scale.Y);
|
||||
Console.Print("height: " + LineSpacing.ToString());
|
||||
return h;
|
||||
}
|
||||
|
||||
private int GetHeightInLines()
|
||||
@@ -108,14 +110,26 @@ namespace Cabrito
|
||||
return (int)(Height / (font.Height / Platform.DpiScale)); // number of fully visible lines
|
||||
}
|
||||
|
||||
protected override void OnParentChangedInternal()
|
||||
{
|
||||
base.OnParentChangedInternal();
|
||||
|
||||
if (Parent != null)
|
||||
OnParentResized();
|
||||
}
|
||||
|
||||
public override void OnParentResized()
|
||||
{
|
||||
if (HeightMultiplier > 0)
|
||||
Height = Screen.Size.Y * HeightMultiplier;
|
||||
UpdateHeight();
|
||||
base.OnParentResized();
|
||||
}
|
||||
|
||||
private void UpdateHeight()
|
||||
{
|
||||
if (Parent != null && Parent.Parent != null)
|
||||
Height = (Parent.Parent.Size.Y * HeightMultiplier) - GetFontHeight();
|
||||
}
|
||||
|
||||
|
||||
private void CalculateVisibleLines(IReadOnlyCollection<ConsoleLine> lines, out int firstVisibleLine, out int lastVisibleLine, out LineInfo[] wrappedLines)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user