Skip to content

Commit

Permalink
Better clipping for the new 2.7 DCS windows
Browse files Browse the repository at this point in the history
  • Loading branch information
glenmurphy committed Apr 17, 2021
1 parent c565f22 commit 77a2f4c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Fingers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,24 @@ private void SetCursorPos(Vector2 pos)
if (!cursorEnabled)
return;

// Could use ClipCursor, but direct control is good
int x = (int)(screenCenter.X + pos.X);
int y = (int)(screenCenter.Y + pos.Y);

if (DCSWindow.W == 0)
{ }
else if (x < DCSWindow.X)
x = (int)DCSWindow.X;
else if (x > DCSWindow.X + DCSWindow.W)
x = (int)(DCSWindow.X + DCSWindow.W);

Winput.SetCursorPosition(x, (int)(screenCenter.Y + pos.Y));
if (DCSWindow.Z == 0)
{ }
else if (y < DCSWindow.Y)
y = (int)DCSWindow.Y;
else if (y >= DCSWindow.Y + DCSWindow.Z)
y = (int)(DCSWindow.Y + DCSWindow.Z - 1);

Winput.SetCursorPosition(x, y);
}
}

0 comments on commit 77a2f4c

Please sign in to comment.