-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply draw colour to segmented graph #22285
Conversation
private ColourInfo getSegmentColour(SegmentInfo segment) | ||
{ | ||
var tierColour = segment.Tier >= 0 ? tierColours[segment.Tier] : new Colour4(0, 0, 0, 0); | ||
var ourColour = DrawColourInfo.Colour; | ||
|
||
return new ColourInfo | ||
{ | ||
TopLeft = tierColour * Interpolation.ValueAt<Colour4>(segment.Start, ourColour.TopLeft, ourColour.TopRight, 0, 1), | ||
TopRight = tierColour * Interpolation.ValueAt<Colour4>(segment.End, ourColour.TopLeft, ourColour.TopRight, 0, 1), | ||
BottomLeft = tierColour * Interpolation.ValueAt<Colour4>(segment.Start, ourColour.BottomLeft, ourColour.BottomRight, 0, 1), | ||
BottomRight = tierColour * Interpolation.ValueAt<Colour4>(segment.End, ourColour.BottomLeft, ourColour.BottomRight, 0, 1) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar function (getting a colour quad out of source colour) exists in TrianglesV2, probably would be useful to create one in the framework level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'm looking to get this out the door for a release tomorrow for now though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a simplified version
private ColourInfo getSegmentColour(SegmentInfo segment) | |
{ | |
var tierColour = segment.Tier >= 0 ? tierColours[segment.Tier] : new Colour4(0, 0, 0, 0); | |
var ourColour = DrawColourInfo.Colour; | |
return new ColourInfo | |
{ | |
TopLeft = tierColour * Interpolation.ValueAt<Colour4>(segment.Start, ourColour.TopLeft, ourColour.TopRight, 0, 1), | |
TopRight = tierColour * Interpolation.ValueAt<Colour4>(segment.End, ourColour.TopLeft, ourColour.TopRight, 0, 1), | |
BottomLeft = tierColour * Interpolation.ValueAt<Colour4>(segment.Start, ourColour.BottomLeft, ourColour.BottomRight, 0, 1), | |
BottomRight = tierColour * Interpolation.ValueAt<Colour4>(segment.End, ourColour.BottomLeft, ourColour.BottomRight, 0, 1) | |
}; | |
private ColourInfo getSegmentColour(SegmentInfo segment) | |
{ | |
var subQuad = new ColourInfo | |
{ | |
TopLeft = DrawColourInfo.Colour.Interpolate(new Vector2(segment.Start, 0f)), | |
TopRight = DrawColourInfo.Colour.Interpolate(new Vector2(segment.End, 0f)), | |
BottomLeft = DrawColourInfo.Colour.Interpolate(new Vector2(segment.Start, 1f)), | |
BottomRight = DrawColourInfo.Colour.Interpolate(new Vector2(segment.End, 1f)) | |
}; | |
subQuad.ApplyChild(segment.Tier >= 0 ? tierColours[segment.Tier] : new Colour4(0, 0, 0, 0)); | |
return subQuad; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied with minor variations, thanks.
This fixes the issue mentioned in #22144 (review), wherein the new argon song progress bar would not hide along with the rest of the HUD.
The segmented graph entirely ignored
DrawColourInfo
, which meant that the drawable's draw colour did not change how it was drawn at all. In particular, this meant that if the graph was hidden at a higher level, therefore having a transparent draw colour - which is the case with gameplay HUD - it would still continue to draw the exact same way regardless.The fix is rather self-explanatory and easy. I even made it fully support gradiented colours because I could:
2023-01-18.23-09-50.mp4