This commit is contained in:
Alessandro Proto 2023-01-10 18:27:12 +01:00
parent 2e4d73e608
commit 39e17e6ace

View file

@ -92,18 +92,21 @@ public class InputManager
return; return;
var rawPosition = state.Position; var rawPosition = state.Position;
var pos = new Point((int)(rawPosition.X / WindowScale), (int)(rawPosition.Y / WindowScale)); var pos = new Point((int)(rawPosition.X / WindowScale), (int)(rawPosition.Y / WindowScale)) + new Point(1, 1);
if (pos.X < 0 || pos.Y < 0 || pos.X >= Texture.Width || pos.Y >= Texture.Height) if (pos.X < 1 || pos.Y < 1 || pos.X > Texture.Width || pos.Y > Texture.Height)
return; return;
if (pos != mousePosition) if (pos != mousePosition)
{ {
mousePosition = pos + new Point(1, 1); mousePosition = pos;
_eventEmitter.RaiseMouseMove(new() _eventEmitter.RaiseMouseMove(new()
{ {
Position = mousePosition, Position = mousePosition,
PressedButtons = mouseButtonStates.Where(q => q.Value == ButtonState.Pressed).Select(q => (int)q.Key).ToArray() PressedButtons = mouseButtonStates
.Where(q => q.Value == ButtonState.Pressed)
.Select(q => (int)q.Key)
.ToArray()
}); });
} }