Skip to content

Commit 08cf79f

Browse files
committed
aw man
1 parent 911efb6 commit 08cf79f

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v1.2.2
2+
- Fix visual bug with fading color progress bars
3+
14
# v1.2.1
25
- Raised *Inversed Inputs* option Silly Tier to **Medium**
36
- Raised *Size Changer* option Silly Tier to **Medium**

src/util/Themes.hpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,27 @@ namespace horrible {
1818
inline constexpr cocos2d::ccColor3B gold = {255, 200, 150};
1919
inline constexpr cocos2d::ccColor3B black = {0, 0, 0};
2020

21-
inline constexpr cocos2d::ccColor3B lerpColor(cocos2d::ccColor3B const& a, cocos2d::ccColor3B const& b, float t) noexcept {
22-
return {
23-
static_cast<GLubyte>(a.r + (b.r - a.r) * t),
24-
static_cast<GLubyte>(a.g + (b.g - a.g) * t),
25-
static_cast<GLubyte>(a.b + (b.b - a.b) * t),
21+
namespace internal {
22+
23+
inline constexpr cocos2d::ccColor3B lerpColor(cocos2d::ccColor3B const& a, cocos2d::ccColor3B const& b, float t) noexcept {
24+
return {
25+
static_cast<GLubyte>(a.r + (b.r - a.r) * t),
26+
static_cast<GLubyte>(a.g + (b.g - a.g) * t),
27+
static_cast<GLubyte>(a.b + (b.b - a.b) * t),
28+
};
2629
};
2730
};
2831

2932
inline constexpr cocos2d::ccColor3B fadeColor(float value) noexcept {
33+
if (value > 100.f) value = 100.f;
34+
if (value < 0.f) value = 0.f;
35+
3036
if (value <= 50.0f) {
31-
float t = value / 50.0f;
32-
return lerpColor(red, yellow, t);
37+
auto t = value / 50.0f;
38+
return internal::lerpColor(red, yellow, t);
3339
} else {
34-
float t = (value - 50.0f) / 50.0f;
35-
return lerpColor(yellow, green, t);
40+
auto t = (value - 50.0f) / 50.0f;
41+
return internal::lerpColor(yellow, green, t);
3642
};
3743
};
3844
};

0 commit comments

Comments
 (0)