mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Bugfix mouse events and cursor not being offset by border
This commit is contained in:
parent
4c78f8afff
commit
444652da12
2 changed files with 3 additions and 2 deletions
|
@ -74,7 +74,7 @@ public class InputManager
|
|||
};
|
||||
|
||||
public Texture2D Texture { get; set; }
|
||||
public float WindowScale { get; set; }
|
||||
public float WindowScale => Capy64.Instance.Scale;
|
||||
public const int MouseScrollDelta = 120;
|
||||
|
||||
private Point mousePosition;
|
||||
|
@ -113,7 +113,7 @@ public class InputManager
|
|||
if (!isActive)
|
||||
return;
|
||||
|
||||
var rawPosition = state.Position;
|
||||
var rawPosition = state.Position - new Point(Capy64.Instance.Borders.Left, Capy64.Instance.Borders.Top);
|
||||
var pos = new Point((int)(rawPosition.X / WindowScale), (int)(rawPosition.Y / WindowScale)) + new Point(1, 1);
|
||||
|
||||
if (pos.X < 1 || pos.Y < 1 || pos.X > Texture.Width || pos.Y > Texture.Height)
|
||||
|
|
|
@ -306,6 +306,7 @@ internal class Term : IComponent
|
|||
{
|
||||
var realpos = ToRealPos(CursorPosition - Vector2.One);
|
||||
var charpos = (realpos * _game.Scale) + (CharOffset + new Vector2(0, 2)) * _game.Scale;
|
||||
charpos += new Vector2(Capy64.Instance.Borders.Left, Capy64.Instance.Borders.Top);
|
||||
_game.Game.SpriteBatch.Draw(cursorTexture, charpos, null, ForegroundColor, 0f, Vector2.Zero, _game.Scale, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue