Prefer named colors

This commit is contained in:
Chris Thrasher 2023-03-19 13:43:04 -06:00
parent 865a50899c
commit 53e2fab582
4 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ public:
/// \param color Fill color /// \param color Fill color
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void create(const Vector2u& size, const Color& color = Color(0, 0, 0)); void create(const Vector2u& size, const Color& color = Color::Black);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Create the image from an array of pixels /// \brief Create the image from an array of pixels

View File

@ -80,7 +80,7 @@ public:
/// \param color Fill color to use to clear the render target /// \param color Fill color to use to clear the render target
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void clear(const Color& color = Color(0, 0, 0, 255)); void clear(const Color& color = Color::Black);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Change the current active view /// \brief Change the current active view

View File

@ -834,12 +834,12 @@ Font::Page::Page(bool smooth)
{ {
// Make sure that the texture is initialized by default // Make sure that the texture is initialized by default
sf::Image image; sf::Image image;
image.create({128, 128}, Color(255, 255, 255, 0)); image.create({128, 128}, Color::Transparent);
// Reserve a 2x2 white square for texturing underlines // Reserve a 2x2 white square for texturing underlines
for (unsigned int x = 0; x < 2; ++x) for (unsigned int x = 0; x < 2; ++x)
for (unsigned int y = 0; y < 2; ++y) for (unsigned int y = 0; y < 2; ++y)
image.setPixel({x, y}, Color(255, 255, 255, 255)); image.setPixel({x, y}, Color::White);
// Create the texture // Create the texture
if (!texture.loadFromImage(image)) if (!texture.loadFromImage(image))

View File

@ -36,7 +36,7 @@ TEST_CASE("[Graphics] sf::Image")
{ {
for (std::uint32_t j = 0; j < 10; ++j) for (std::uint32_t j = 0; j < 10; ++j)
{ {
CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color(0, 0, 0)); CHECK(image.getPixel(sf::Vector2u(i, j)) == sf::Color::Black);
} }
} }
} }
@ -133,7 +133,7 @@ TEST_CASE("[Graphics] sf::Image")
if (i <= 4 && j <= 4) if (i <= 4 && j <= 4)
CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color::Blue); CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color::Blue);
else else
CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color(0, 0, 0)); CHECK(image2.getPixel(sf::Vector2u(i, j)) == sf::Color::Black);
} }
} }
} }