1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-15 16:56:00 -05:00

Merge pull request #954 from gucio321/credits-color

colored credits
This commit is contained in:
Tim Sarbin 2020-11-27 11:46:45 -05:00 committed by GitHub
commit b27f169c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -208,9 +208,9 @@ func (v *Credits) addNextItem() {
var label = v.getNewFontLabel(isHeading)
if isHeading {
label.SetText(text[1:])
label.SetText(d2ui.ColorTokenize(text[1:], d2ui.ColorTokenRed))
} else {
label.SetText(text)
label.SetText(d2ui.ColorTokenize(text, d2ui.ColorTokenGold))
}
isDoubled, isNextHeading := v.setItemLabelPosition(label, isHeading, isNextHeading, isNextSpace)
@ -253,7 +253,7 @@ func (v *Credits) setItemLabelPosition(label *d2ui.Label, isHeading, isNextHeadi
nextHeading = len(v.creditsText) > 0 && len(v.creditsText[0]) > 0 && v.creditsText[0][0] == '*'
label2 := v.getNewFontLabel(isHeading)
label2.SetText(text2)
label2.SetText(d2ui.ColorTokenize(text2, d2ui.ColorTokenGold))
label2.SetPosition(itemLabelX+itemLabel2offsetX, itemLabelY)
@ -265,37 +265,12 @@ func (v *Credits) setItemLabelPosition(label *d2ui.Label, isHeading, isNextHeadi
return isDoubled, isNextHeading
}
const (
lightRed = 0xff5852ff
beige = 0xc6b296ff
)
func (v *Credits) getNewFontLabel(isHeading bool) *d2ui.Label {
for _, label := range v.labels {
if label.Available {
label.Available = false
if isHeading {
label.Label.Color[0] = rgbaColor(lightRed)
} else {
label.Label.Color[0] = rgbaColor(beige)
}
return label.Label
}
}
newLabelItem := &labelItem{
Available: false,
IsHeading: isHeading,
Label: v.uiManager.NewLabel(d2resource.FontFormal10, d2resource.PaletteSky),
}
if isHeading {
newLabelItem.Label.Color[0] = rgbaColor(lightRed)
} else {
newLabelItem.Label.Color[0] = rgbaColor(beige)
}
v.labels = append(v.labels, newLabelItem)
return newLabelItem.Label