mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Fix documentation bugs
This commit is contained in:
parent
da17ec4f11
commit
2f54312481
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
///
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user