large worlds engine compat refactor, change vector -> float

This commit is contained in:
2022-06-13 22:06:37 +03:00
parent 3b6b5686d0
commit a0d2b127de
18 changed files with 389 additions and 389 deletions

View File

@@ -186,7 +186,7 @@ namespace Game
public override void Draw()
{
// Cache data
Rectangle rect = new Rectangle(Vector2.Zero, Size);
Rectangle rect = new Rectangle(Float2.Zero, Size);
Font font = Font.GetFont();
if (!font)
return;
@@ -267,7 +267,7 @@ namespace Game
if (lineIndex > selectionLeftLine && lineIndex < selectionRightLine)
{
// whole line is selected
Vector2 lineSize = font.MeasureText(line);
Float2 lineSize = font.MeasureText(line);
selectionRect.Width = lineSize.X;
selectionRect.Height = lineSize.Y;
}
@@ -276,8 +276,8 @@ namespace Game
if (lineIndex < selectionRightLine)
{
// right side of the line is selected
Vector2 leftSize = font.MeasureText(fullLine.Substring(0, leftChar));
Vector2 rightSize = font.MeasureText(fullLine.Substring(leftChar));
Float2 leftSize = font.MeasureText(fullLine.Substring(0, leftChar));
Float2 rightSize = font.MeasureText(fullLine.Substring(leftChar));
selectionRect.X += leftSize.X;
selectionRect.Width = rightSize.X;
selectionRect.Height = rightSize.Y;
@@ -288,9 +288,9 @@ namespace Game
else if (lineIndex == selectionRightLine && leftChar != rightChar)
{
// selecting middle of the one line
Vector2 lineSize = font.MeasureText(fullLine);
Vector2 leftSize = font.MeasureText(fullLine.Substring(0, leftChar));
Vector2 midSize =
Float2 lineSize = font.MeasureText(fullLine);
Float2 leftSize = font.MeasureText(fullLine.Substring(0, leftChar));
Float2 midSize =
font.MeasureText(fullLine.Substring(leftChar, rightChar - leftChar));
selectionRect.X += leftSize.X;
@@ -304,7 +304,7 @@ namespace Game
else if (lineIndex == selectionRightLine)
{
// left side of the line is selected
Vector2 leftSize = font.MeasureText(fullLine.Substring(0, rightChar));
Float2 leftSize = font.MeasureText(fullLine.Substring(0, rightChar));
selectionRect.Width = leftSize.X;
selectionRect.Height = leftSize.Y;
@@ -340,7 +340,7 @@ namespace Game
/*if (CaretPosition > -1)
{
var prefixSize = TextPrefix != "" ? font.MeasureText(TextPrefix) : new Vector2();
var prefixSize = TextPrefix != "" ? font.MeasureText(TextPrefix) : new Float2();
var caretBounds = CaretBounds;
caretBounds.X += prefixSize.X;
@@ -374,7 +374,7 @@ namespace Game
EndMouseCapture();
}
public bool HitTestText(Vector2 location, out int hitLine, out int hitChar)
public bool HitTestText(Float2 location, out int hitLine, out int hitChar)
{
hitLine = 0;
hitChar = 0;
@@ -422,7 +422,7 @@ namespace Game
return true;
}
/*public int CharIndexAtPoint(ref Vector2 location)
/*public int CharIndexAtPoint(ref Float2 location)
{
return HitTestText(location + _viewOffset);
}*/
@@ -460,7 +460,7 @@ namespace Game
return base.OnKeyDown(key);
}
public override bool OnMouseWheel(Vector2 location, float delta)
public override bool OnMouseWheel(Float2 location, float delta)
{
if (delta < 0)
{
@@ -479,7 +479,7 @@ namespace Game
return false;
}
public override bool OnMouseDown(Vector2 location, MouseButton button)
public override bool OnMouseDown(Float2 location, MouseButton button)
{
bool ret = false;
if (button == MouseButton.Left && !IsFocused)
@@ -525,7 +525,7 @@ namespace Game
return ret;
}
public override void OnMouseMove(Vector2 location)
public override void OnMouseMove(Float2 location)
{
if (selectionActive)
if (HitTestText(location, out int hitLine, out int hitChar))
@@ -537,7 +537,7 @@ namespace Game
}
/// <inheritdoc />
public override bool OnMouseUp(Vector2 location, MouseButton button)
public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{