mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 09:34:19 +00:00
Make color pickers not change selected color as much
As described in #5844, sometimes the color kept changing when activating a color picker. By rounding the color components before packing them into an unsigned, the color only changes very little and only at most once when activating a color picker.
This commit is contained in:
parent
a9207a931f
commit
25b487703f
|
@ -111,7 +111,7 @@ public:
|
|||
|
||||
unsigned Pack(bool Alpha = true)
|
||||
{
|
||||
return (Alpha ? ((unsigned)(a * 255.0f) << 24) : 0) + ((unsigned)(x * 255.0f) << 16) + ((unsigned)(y * 255.0f) << 8) + (unsigned)(z * 255.0f);
|
||||
return (Alpha ? ((unsigned)round_to_int(a * 255.0f) << 24) : 0) + ((unsigned)round_to_int(x * 255.0f) << 16) + ((unsigned)round_to_int(y * 255.0f) << 8) + (unsigned)round_to_int(z * 255.0f);
|
||||
}
|
||||
|
||||
DerivedT WithAlpha(float alpha)
|
||||
|
|
Loading…
Reference in a new issue