mirror of
https://github.com/whoswhip/Spectrum.git
synced 2026-12-06 01:28:42 +00:00
feat: closest to mouse fov and bounds move based off of position of mouse
This commit is contained in:
@@ -47,12 +47,25 @@ namespace Spectrum.Detection
|
|||||||
|
|
||||||
renderer?.ClearDetectionDrawCommands();
|
renderer?.ClearDetectionDrawCommands();
|
||||||
|
|
||||||
bounds = new Rectangle(
|
if (!config.ClosestToMouse)
|
||||||
(screenSize.Width - config.ImageWidth) / 2,
|
{
|
||||||
(screenSize.Height - config.ImageHeight) / 2,
|
bounds = new Rectangle(
|
||||||
config.ImageWidth,
|
(screenSize.Width - config.ImageWidth) / 2,
|
||||||
config.ImageHeight
|
(screenSize.Height - config.ImageHeight) / 2,
|
||||||
);
|
config.ImageWidth,
|
||||||
|
config.ImageHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||||
|
bounds = new Rectangle(
|
||||||
|
mousePos.X - (config.ImageWidth/2),
|
||||||
|
mousePos.Y - (config.ImageHeight/2),
|
||||||
|
config.ImageWidth,
|
||||||
|
config.ImageHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
var screenshot = null as Bitmap;
|
var screenshot = null as Bitmap;
|
||||||
if (config.CaptureMethod == CaptureMethod.DirectX && _captureManager.IsDirectXAvailable)
|
if (config.CaptureMethod == CaptureMethod.DirectX && _captureManager.IsDirectXAvailable)
|
||||||
screenshot = _captureManager.CaptureScreenshotDirectX(bounds);
|
screenshot = _captureManager.CaptureScreenshotDirectX(bounds);
|
||||||
|
|||||||
@@ -188,15 +188,9 @@ namespace Spectrum.Input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetLastDetection(Point point)
|
public static void SetLastDetection(Point point) { lastDetection = point; }
|
||||||
{
|
|
||||||
lastDetection = point;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetLastDetectionBox(Rectangle box)
|
public static void SetLastDetectionBox(Rectangle box) { lastDetectionBox = box; }
|
||||||
{
|
|
||||||
lastDetectionBox = box;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern short GetAsyncKeyState(int vKey);
|
private static extern short GetAsyncKeyState(int vKey);
|
||||||
|
|||||||
+28
-5
@@ -735,14 +735,37 @@ namespace Spectrum
|
|||||||
{
|
{
|
||||||
if (config.FOVType == FovType.Rectangle)
|
if (config.FOVType == FovType.Rectangle)
|
||||||
{
|
{
|
||||||
drawList.AddRect(new Vector2((screenSize.width - config.ImageWidth) / 2, (screenSize.height - config.ImageHeight) / 2),
|
Vector2 topLeft;
|
||||||
new Vector2((screenSize.width + config.ImageWidth) / 2, (screenSize.height + config.ImageHeight) / 2),
|
Vector2 bottomRight;
|
||||||
ImGui.GetColorU32(config.FOVColor), 0.0f, ImDrawFlags.None, 1.0f);
|
if (!config.ClosestToMouse)
|
||||||
|
{
|
||||||
|
topLeft = new((screenSize.width - config.ImageWidth) / 2, (screenSize.height - config.ImageHeight) / 2);
|
||||||
|
bottomRight = new((screenSize.width + config.ImageWidth) / 2, (screenSize.height + config.ImageHeight) / 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||||
|
topLeft = new(mousePos.X - (config.ImageWidth / 2), mousePos.Y - (config.ImageHeight / 2));
|
||||||
|
bottomRight = new(mousePos.X + (config.ImageWidth / 2), mousePos.Y + (config.ImageHeight / 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
drawList.AddRect(topLeft, bottomRight, ImGui.GetColorU32(config.FOVColor), 0.0f, ImDrawFlags.None, 1.0f);
|
||||||
}
|
}
|
||||||
else if (config.FOVType == FovType.Circle)
|
else if (config.FOVType == FovType.Circle)
|
||||||
{
|
{
|
||||||
drawList.AddCircle(new Vector2(screenSize.width / 2, screenSize.height / 2), config.ImageWidth / 2,
|
Vector2 center;
|
||||||
ImGui.GetColorU32(config.FOVColor), 100, 1.0f);
|
if (!config.ClosestToMouse)
|
||||||
|
{
|
||||||
|
center = new(screenSize.width / 2, screenSize.height / 2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = InputManager.GetCursorPos(out System.Drawing.Point mousePos);
|
||||||
|
center = new(mousePos.X, mousePos.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
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