Fix documentation bugs

This commit is contained in:
Chris Thrasher 2024-06-12 10:00:04 -05:00
parent da17ec4f11
commit 2f54312481
8 changed files with 14 additions and 14 deletions

View File

@ -222,10 +222,10 @@ SFML_AUDIO_API Vector3f getUpVector();
/// Usage example:
/// \code
/// // Move the listener to the position (1, 0, -5)
/// sf::Listener::setPosition(1, 0, -5);
/// sf::Listener::setPosition({1, 0, -5});
///
/// // Make it face the right axis (1, 0, 0)
/// sf::Listener::setDirection(1, 0, 0);
/// sf::Listener::setDirection({1, 0, 0});
///
/// // Reduce the global volume
/// sf::Listener::setGlobalVolume(50);

View File

@ -303,10 +303,10 @@ private:
/// auto music = sf::Music::openFromFile("music.ogg").value();
///
/// // Change some parameters
/// music.setPosition(0, 1, 10); // change its 3D position
/// music.setPitch(2); // increase the pitch
/// music.setVolume(50); // reduce the volume
/// music.setLoop(true); // make it loop
/// music.setPosition({0, 1, 10}); // change its 3D position
/// music.setPitch(2); // increase the pitch
/// music.setVolume(50); // reduce the volume
/// music.setLoop(true); // make it loop
///
/// // Play it
/// music.play();

View File

@ -146,7 +146,7 @@ private:
/// circle.setRadius(150);
/// circle.setOutlineColor(sf::Color::Red);
/// circle.setOutlineThickness(5);
/// circle.setPosition(10, 20);
/// circle.setPosition({10, 20});
/// ...
/// window.draw(circle);
/// \endcode

View File

@ -145,7 +145,7 @@ private:
/// polygon.setPoint(2, sf::Vector2f(25, 5));
/// polygon.setOutlineColor(sf::Color::Red);
/// polygon.setOutlineThickness(5);
/// polygon.setPosition(10, 20);
/// polygon.setPosition({10, 20});
/// ...
/// window.draw(polygon);
/// \endcode

View File

@ -133,7 +133,7 @@ private:
/// rectangle.setSize(sf::Vector2f(100, 50));
/// rectangle.setOutlineColor(sf::Color::Red);
/// rectangle.setOutlineThickness(5);
/// rectangle.setPosition(10, 20);
/// rectangle.setPosition({10, 20});
/// ...
/// window.draw(rectangle);
/// \endcode

View File

@ -273,7 +273,7 @@ private:
/// sf::Sprite sprite(texture);
/// sprite.setTextureRect(sf::IntRect({10, 10}, {50, 30}));
/// sprite.setColor(sf::Color(255, 255, 255, 200));
/// sprite.setPosition(100, 25);
/// sprite.setPosition({100, 25});
///
/// // Draw it
/// window.draw(sprite);

View File

@ -296,8 +296,8 @@ private:
/// };
///
/// MyEntity entity;
/// entity.setPosition(10, 20);
/// entity.setRotation(45);
/// entity.setPosition({10, 20});
/// entity.setRotation(sf::degrees(45));
/// window.draw(entity);
/// \endcode
///

View File

@ -54,7 +54,7 @@ TEST_CASE("[Graphics] sf::Image")
SECTION("Vector2 and std::uint8_t* constructor")
{
// 10 x 10, with 4 colour channels array
// 10 x 10, with 4 color channels array
std::array<std::uint8_t, 400> pixels{};
for (std::size_t i = 0; i < pixels.size(); i += 4)
{
@ -359,7 +359,7 @@ TEST_CASE("[Graphics] sf::Image")
const sf::Color dest(255, 0, 0, 255);
const sf::Color source(5, 255, 78, 232);
// Create the composited colour for via the alpha composite over operation
// Create the composited color for via the alpha composite over operation
const auto a = static_cast<std::uint8_t>(source.a + (dest.a * (255 - source.a)) / 255);
const auto r = static_cast<std::uint8_t>(
((source.r * source.a) + ((dest.r * dest.a) * (255 - source.a)) / 255) / a);