mirror of
https://github.com/whoswhip/Spectrum.git
synced 2026-12-06 01:28:42 +00:00
feat: add configurable aimpoint types
This commit is contained in:
@@ -316,6 +316,12 @@ namespace Spectrum
|
||||
Circle,
|
||||
Rectangle
|
||||
}
|
||||
public enum AimpointType
|
||||
{
|
||||
Crosshair,
|
||||
Dot,
|
||||
Circle
|
||||
}
|
||||
public enum CaptureMethod
|
||||
{
|
||||
GDI,
|
||||
@@ -390,6 +396,7 @@ namespace Spectrum
|
||||
public Vector4 FOVColor { get; set; } = new Vector4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
public bool DrawAimPoint { get; set; } = true;
|
||||
public Vector4 AimPointColor { get; set; } = new Vector4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
public AimpointType AimPointType { get; set; } = AimpointType.Dot;
|
||||
#endregion
|
||||
|
||||
#region Data Collection Settings
|
||||
|
||||
@@ -185,9 +185,20 @@ namespace Spectrum.Detection
|
||||
|
||||
if (config.DrawAimPoint)
|
||||
{
|
||||
renderer!.AddLine(new System.Numerics.Vector2(targetX - 10, targetY), new System.Numerics.Vector2(targetX + 10, targetY), config.AimPointColor, 2);
|
||||
renderer!.AddLine(new System.Numerics.Vector2(targetX, targetY - 10), new System.Numerics.Vector2(targetX, targetY + 10), config.AimPointColor, 2);
|
||||
renderer!.AddCircle(new System.Numerics.Vector2(targetX, targetY), 5, config.AimPointColor, 20);
|
||||
if (config.AimPointType == AimpointType.Crosshair)
|
||||
{
|
||||
renderer!.AddLine(new System.Numerics.Vector2(targetX - 10, targetY), new System.Numerics.Vector2(targetX + 10, targetY), config.AimPointColor, 2);
|
||||
renderer!.AddLine(new System.Numerics.Vector2(targetX, targetY - 10), new System.Numerics.Vector2(targetX, targetY + 10), config.AimPointColor, 2);
|
||||
renderer!.AddCircle(new System.Numerics.Vector2(targetX, targetY), 5, config.AimPointColor, 20);
|
||||
}
|
||||
else if (config.AimPointType == AimpointType.Dot)
|
||||
{
|
||||
renderer!.AddCircleFilled(new System.Numerics.Vector2(targetX, targetY), 5, config.AimPointColor, 20);
|
||||
}
|
||||
else if (config.AimPointType == AimpointType.Circle)
|
||||
{
|
||||
renderer!.AddCircle(new System.Numerics.Vector2(targetX, targetY), 10, config.AimPointColor, 20);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.AutoLabel && drawing != null)
|
||||
@@ -233,13 +244,9 @@ namespace Spectrum.Detection
|
||||
drawing?.Dispose();
|
||||
|
||||
if (!AutoLabeling.Started && (config.CollectData || config.AutoLabel))
|
||||
{
|
||||
AutoLabeling.StartLabeling();
|
||||
}
|
||||
else if (AutoLabeling.Started && !config.CollectData && !config.AutoLabel)
|
||||
{
|
||||
AutoLabeling.StopLabeling();
|
||||
}
|
||||
|
||||
if (config.DebugMode)
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace Spectrum
|
||||
|
||||
int triggerFov = config.TriggerFov;
|
||||
if (ImGuiExtensions.SliderFill("Trigger FOV (px)", ref triggerFov, 1, 100))
|
||||
config.TriggerFov = triggerFov;
|
||||
config.TriggerFov = triggerFov;
|
||||
|
||||
bool DrawTriggerFov = config.DrawTriggerFov;
|
||||
if (ImGui.Checkbox("##Draw Trigger FOV", ref DrawTriggerFov))
|
||||
@@ -322,6 +322,24 @@ namespace Spectrum
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
}
|
||||
if (DrawAimPoint)
|
||||
{
|
||||
AimpointType aimpointType = config.AimPointType;
|
||||
ImGui.TextUnformatted("Aimpoint Type");
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
if (ImGui.BeginCombo("##Aimpoint Type", aimpointType.ToString()))
|
||||
{
|
||||
foreach (AimpointType type in Enum.GetValues(typeof(AimpointType)))
|
||||
{
|
||||
bool isSelected = (type == aimpointType);
|
||||
if (ImGui.Selectable(type.ToString(), isSelected))
|
||||
config.AimPointType = type;
|
||||
if (isSelected)
|
||||
ImGui.SetItemDefaultFocus();
|
||||
}
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
}
|
||||
ImGuiExtensions.EndPane();
|
||||
}
|
||||
ImGuiExtensions.EndPaneGroup();
|
||||
@@ -950,6 +968,15 @@ namespace Spectrum
|
||||
detectionDrawCommands.Add(drawList => drawList.AddCircle(center, radius, ImGui.GetColorU32(color), numSegments, thickness));
|
||||
}
|
||||
}
|
||||
public void AddCircleFilled(Vector2 center, float radius, Vector4 color, int numSegments = 0)
|
||||
{
|
||||
if (numSegments <= 0)
|
||||
numSegments = (int)(Math.Max(1, radius / 2.0f));
|
||||
lock (detectionDrawLock)
|
||||
{
|
||||
detectionDrawCommands.Add(drawList => drawList.AddCircleFilled(center, radius, ImGui.GetColorU32(color), numSegments));
|
||||
}
|
||||
}
|
||||
|
||||
public void AddText(Vector2 pos, Vector4 color, string text, int fontSize = 16)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user