diff options
Diffstat (limited to 'src/gui/palette.cpp')
-rw-r--r-- | src/gui/palette.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index aa639546b..36fde8761 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -1,12 +1,12 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,10 +33,15 @@ #include "debug.h" +// required by MSYS2 / Windows +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795 +#endif + const Color Palette::BLACK = Color(0, 0, 0, 255); Palette::Palettes Palette::mInstances; -const Color Palette::RAINBOW_COLORS[7] = +const Color Palette::RAINBOW_COLORS[] = { Color(255, 0, 0, 255), Color(255, 153, 0, 255), @@ -47,8 +52,6 @@ const Color Palette::RAINBOW_COLORS[7] = Color(153, 0, 153, 255) }; -const int Palette::RAINBOW_COLOR_COUNT = 7; - Palette::Palette(const int size) : mRainbowTime(tick_time), mColors(Colors(size)), @@ -106,7 +109,7 @@ void Palette::advanceGradient() const int numOfColors = (elem->grad == GradientType::SPECTRUM ? 6 : grad == GradientType::PULSE ? 127 : - RAINBOW_COLOR_COUNT); + NUM_ELEMENTS(RAINBOW_COLORS)); elem->gradientIndex = (elem->gradientIndex + advance) % (delay * numOfColors); @@ -172,8 +175,9 @@ void Palette::advanceGradient() else if (elem->grad == GradientType::RAINBOW) { const Color &startCol = RAINBOW_COLORS[colIndex]; - const Color &destCol - = RAINBOW_COLORS[(colIndex + 1) % numOfColors]; + const int destIndex + = (colIndex + 1) % NUM_ELEMENTS(RAINBOW_COLORS); + const Color &destCol = RAINBOW_COLORS[destIndex]; double startColVal; double destColVal; |