mirror of
https://github.com/Floriansylvain/SFMLplayground.git
synced 2026-08-19 19:53:25 +02:00
refac: rendering, debug overlay, & game mechanics
This commit is contained in:
+9
-9
@@ -69,15 +69,15 @@ void Ball::updateColor() {
|
||||
constexpr float TRANSITION_SPEED = 0.05f;
|
||||
|
||||
sf::Color newColor;
|
||||
newColor.r = static_cast<std::uint8_t>(static_cast<float>(currentColor.r) +
|
||||
TRANSITION_SPEED *
|
||||
(targetColor.r - currentColor.r));
|
||||
newColor.g = static_cast<std::uint8_t>(static_cast<float>(currentColor.g) +
|
||||
TRANSITION_SPEED *
|
||||
(targetColor.g - currentColor.g));
|
||||
newColor.b = static_cast<std::uint8_t>(static_cast<float>(currentColor.b) +
|
||||
TRANSITION_SPEED *
|
||||
(targetColor.b - currentColor.b));
|
||||
newColor.r = static_cast<std::uint8_t>(
|
||||
static_cast<float>(currentColor.r) +
|
||||
TRANSITION_SPEED * static_cast<float>(targetColor.r - currentColor.r));
|
||||
newColor.g = static_cast<std::uint8_t>(
|
||||
static_cast<float>(currentColor.g) +
|
||||
TRANSITION_SPEED * static_cast<float>(targetColor.g - currentColor.g));
|
||||
newColor.b = static_cast<std::uint8_t>(
|
||||
static_cast<float>(currentColor.b) +
|
||||
TRANSITION_SPEED * static_cast<float>(targetColor.b - currentColor.b));
|
||||
newColor.a = 255;
|
||||
|
||||
m_shape.setFillColor(newColor);
|
||||
|
||||
Reference in New Issue
Block a user