Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DelvCD/Config/Styles/BarStyleConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class BarStyleConfig : IConfigPage
public int GlowThickness = 2;
public int GlowSegments = 8;
public float GlowSpeed = 1f;
public bool GlowClockwise = true;
public ConfigColor GlowColor = new ConfigColor(230f / 255f, 150f / 255f, 0f / 255f, 1f);
public ConfigColor GlowColor2 = new ConfigColor(0f / 255f, 0f / 255f, 0f / 255f, 0f);

Expand Down Expand Up @@ -256,6 +257,9 @@ public void DrawConfig(IConfigurable parent, Vector2 size, float padX, float pad
{
GlowColor2.Vector = vector;
}

DrawHelpers.DrawNestIndicator(1);
ImGui.Checkbox("Glow rotates Clockwise", ref GlowClockwise);
}
}

Expand Down
4 changes: 4 additions & 0 deletions DelvCD/Config/Styles/IconStyleConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class IconStyleConfig : IConfigPage
public int GlowThickness = 2;
public int GlowSegments = 8;
public float GlowSpeed = 1f;
public bool GlowClockwise = true;
public ConfigColor GlowColor = new ConfigColor(230f / 255f, 150f / 255f, 0f / 255f, 1f);
public ConfigColor GlowColor2 = new ConfigColor(0f / 255f, 0f / 255f, 0f / 255f, 0f);

Expand Down Expand Up @@ -235,6 +236,9 @@ public void DrawConfig(IConfigurable parent, Vector2 size, float padX, float pad
vector = GlowColor2.Vector;
ImGui.ColorEdit4("Glow Color 2##Glow", ref vector, ImGuiColorEditFlags.AlphaPreview | ImGuiColorEditFlags.AlphaBar);
GlowColor2.Vector = vector;

DrawHelpers.DrawNestIndicator(1);
ImGui.Checkbox("Glow rotates Clockwise", ref GlowClockwise);
}

DrawHelpers.DrawSpacing(1);
Expand Down
7 changes: 6 additions & 1 deletion DelvCD/Helpers/DrawHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,17 @@ public static void DrawSegmentedLineVertical(
drawList.AddRectFilled(start, start + last, colors[1]);
}

public static void DrawGlow(Vector2 pos, Vector2 size, int thickness, int segments, float speed, ConfigColor col1, ConfigColor col2, ImDrawListPtr drawList)
public static void DrawGlow(Vector2 pos, Vector2 size, int thickness, int segments, float speed, ConfigColor col1, ConfigColor col2, ImDrawListPtr drawList, bool clockwise = true)
{
speed = Math.Abs(speed);
int mod = speed == 0 ? 1 : (int)(250 / speed);
float prog = (float)(DateTimeOffset.Now.ToUnixTimeMilliseconds() % mod) / mod;

if (!clockwise)
{
prog = 1.0f - prog;
}

float offset = thickness / 2 + thickness % 2;
Vector2 c1 = new Vector2(pos.X, pos.Y);
Vector2 c2 = new Vector2(pos.X + size.X, pos.Y);
Expand Down
2 changes: 1 addition & 1 deletion DelvCD/UIElements/Bar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public override bool Draw(Vector2 pos, Vector2? parentSize = null, bool parentVi

if (style.Glow)
{
DrawHelpers.DrawGlow(localPos, size, style.GlowThickness, style.GlowSegments, style.GlowSpeed, style.GlowColor, style.GlowColor2, drawList);
DrawHelpers.DrawGlow(localPos, size, style.GlowThickness, style.GlowSegments, style.GlowSpeed, style.GlowColor, style.GlowColor2, drawList, style.GlowClockwise);
}
}

Expand Down
2 changes: 1 addition & 1 deletion DelvCD/UIElements/Icon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public override bool Draw(Vector2 pos, Vector2? parentSize = null, bool parentVi

if (style.Glow)
{
DrawHelpers.DrawGlow(localPos, size, style.GlowThickness, style.GlowSegments, style.GlowSpeed, style.GlowColor, style.GlowColor2, drawList);
DrawHelpers.DrawGlow(localPos, size, style.GlowThickness, style.GlowSegments, style.GlowSpeed, style.GlowColor, style.GlowColor2, drawList, style.GlowClockwise);
}
});

Expand Down