mirror of
https://github.com/whoswhip/Spectrum.git
synced 2026-12-06 01:28:42 +00:00
fix: closest to mouse not clamped
This commit is contained in:
@@ -60,15 +60,27 @@ namespace Spectrum.Detection
|
|||||||
{
|
{
|
||||||
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||||
bounds = new Rectangle(
|
bounds = new Rectangle(
|
||||||
mousePos.X - (config.ImageWidth/2),
|
mousePos.X - (config.ImageWidth / 2),
|
||||||
mousePos.Y - (config.ImageHeight/2),
|
mousePos.Y - (config.ImageHeight / 2),
|
||||||
config.ImageWidth,
|
config.ImageWidth,
|
||||||
config.ImageHeight
|
config.ImageHeight
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var screenshot = null as Bitmap;
|
|
||||||
|
var screenRect = new Rectangle(0, 0, screenSize.Width, screenSize.Height);
|
||||||
|
bounds = Rectangle.Intersect(bounds, screenRect);
|
||||||
|
if (bounds.Width <= 0 || bounds.Height <= 0)
|
||||||
|
{
|
||||||
|
renderer?.CommitDetectionDrawCommands();
|
||||||
|
Thread.Sleep(2);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bitmap? screenshot = null;
|
||||||
if (config.CaptureMethod == CaptureMethod.DirectX && _captureManager.IsDirectXAvailable)
|
if (config.CaptureMethod == CaptureMethod.DirectX && _captureManager.IsDirectXAvailable)
|
||||||
|
{
|
||||||
screenshot = _captureManager.CaptureScreenshotDirectX(bounds);
|
screenshot = _captureManager.CaptureScreenshotDirectX(bounds);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_captureManager.IsInitialized)
|
if (_captureManager.IsInitialized)
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ namespace Spectrum
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||||
topLeft = new(mousePos.X - (config.ImageWidth / 2), mousePos.Y - (config.ImageHeight / 2));
|
topLeft = new(mousePos.X - (config.ImageWidth / 2), mousePos.Y - (config.ImageHeight / 2));
|
||||||
bottomRight = new(mousePos.X + (config.ImageWidth / 2), mousePos.Y + (config.ImageHeight / 2));
|
bottomRight = new(mousePos.X + (config.ImageWidth / 2), mousePos.Y + (config.ImageHeight / 2));
|
||||||
}
|
}
|
||||||
@@ -765,7 +765,7 @@ namespace Spectrum
|
|||||||
center = new(mousePos.X, mousePos.Y);
|
center = new(mousePos.X, mousePos.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawList.AddCircle(center, config.ImageWidth / 2,ImGui.GetColorU32(config.FOVColor), 100, 1.0f);
|
drawList.AddCircle(center, config.ImageWidth / 2, ImGui.GetColorU32(config.FOVColor), 100, 1.0f);
|
||||||
} // added straight to drawlist to prevent caching/flickering
|
} // added straight to drawlist to prevent caching/flickering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user