mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Prefer named colors
This commit is contained in:
parent
865a50899c
commit
53e2fab582
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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))
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user