mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 07:41: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:
|
/// Usage example:
|
||||||
/// \code
|
/// \code
|
||||||
/// // Move the listener to the position (1, 0, -5)
|
/// // 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)
|
/// // 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
|
/// // Reduce the global volume
|
||||||
/// sf::Listener::setGlobalVolume(50);
|
/// sf::Listener::setGlobalVolume(50);
|
||||||
|
@ -303,10 +303,10 @@ private:
|
|||||||
/// auto music = sf::Music::openFromFile("music.ogg").value();
|
/// auto music = sf::Music::openFromFile("music.ogg").value();
|
||||||
///
|
///
|
||||||
/// // Change some parameters
|
/// // Change some parameters
|
||||||
/// music.setPosition(0, 1, 10); // change its 3D position
|
/// music.setPosition({0, 1, 10}); // change its 3D position
|
||||||
/// music.setPitch(2); // increase the pitch
|
/// music.setPitch(2); // increase the pitch
|
||||||
/// music.setVolume(50); // reduce the volume
|
/// music.setVolume(50); // reduce the volume
|
||||||
/// music.setLoop(true); // make it loop
|
/// music.setLoop(true); // make it loop
|
||||||
///
|
///
|
||||||
/// // Play it
|
/// // Play it
|
||||||
/// music.play();
|
/// music.play();
|
||||||
|
@ -146,7 +146,7 @@ private:
|
|||||||
/// circle.setRadius(150);
|
/// circle.setRadius(150);
|
||||||
/// circle.setOutlineColor(sf::Color::Red);
|
/// circle.setOutlineColor(sf::Color::Red);
|
||||||
/// circle.setOutlineThickness(5);
|
/// circle.setOutlineThickness(5);
|
||||||
/// circle.setPosition(10, 20);
|
/// circle.setPosition({10, 20});
|
||||||
/// ...
|
/// ...
|
||||||
/// window.draw(circle);
|
/// window.draw(circle);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
|
@ -145,7 +145,7 @@ private:
|
|||||||
/// polygon.setPoint(2, sf::Vector2f(25, 5));
|
/// polygon.setPoint(2, sf::Vector2f(25, 5));
|
||||||
/// polygon.setOutlineColor(sf::Color::Red);
|
/// polygon.setOutlineColor(sf::Color::Red);
|
||||||
/// polygon.setOutlineThickness(5);
|
/// polygon.setOutlineThickness(5);
|
||||||
/// polygon.setPosition(10, 20);
|
/// polygon.setPosition({10, 20});
|
||||||
/// ...
|
/// ...
|
||||||
/// window.draw(polygon);
|
/// window.draw(polygon);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
|
@ -133,7 +133,7 @@ private:
|
|||||||
/// rectangle.setSize(sf::Vector2f(100, 50));
|
/// rectangle.setSize(sf::Vector2f(100, 50));
|
||||||
/// rectangle.setOutlineColor(sf::Color::Red);
|
/// rectangle.setOutlineColor(sf::Color::Red);
|
||||||
/// rectangle.setOutlineThickness(5);
|
/// rectangle.setOutlineThickness(5);
|
||||||
/// rectangle.setPosition(10, 20);
|
/// rectangle.setPosition({10, 20});
|
||||||
/// ...
|
/// ...
|
||||||
/// window.draw(rectangle);
|
/// window.draw(rectangle);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
|
@ -273,7 +273,7 @@ private:
|
|||||||
/// sf::Sprite sprite(texture);
|
/// sf::Sprite sprite(texture);
|
||||||
/// sprite.setTextureRect(sf::IntRect({10, 10}, {50, 30}));
|
/// sprite.setTextureRect(sf::IntRect({10, 10}, {50, 30}));
|
||||||
/// sprite.setColor(sf::Color(255, 255, 255, 200));
|
/// sprite.setColor(sf::Color(255, 255, 255, 200));
|
||||||
/// sprite.setPosition(100, 25);
|
/// sprite.setPosition({100, 25});
|
||||||
///
|
///
|
||||||
/// // Draw it
|
/// // Draw it
|
||||||
/// window.draw(sprite);
|
/// window.draw(sprite);
|
||||||
|
@ -296,8 +296,8 @@ private:
|
|||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// MyEntity entity;
|
/// MyEntity entity;
|
||||||
/// entity.setPosition(10, 20);
|
/// entity.setPosition({10, 20});
|
||||||
/// entity.setRotation(45);
|
/// entity.setRotation(sf::degrees(45));
|
||||||
/// window.draw(entity);
|
/// window.draw(entity);
|
||||||
/// \endcode
|
/// \endcode
|
||||||
///
|
///
|
||||||
|
@ -54,7 +54,7 @@ TEST_CASE("[Graphics] sf::Image")
|
|||||||
|
|
||||||
SECTION("Vector2 and std::uint8_t* constructor")
|
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{};
|
std::array<std::uint8_t, 400> pixels{};
|
||||||
for (std::size_t i = 0; i < pixels.size(); i += 4)
|
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 dest(255, 0, 0, 255);
|
||||||
const sf::Color source(5, 255, 78, 232);
|
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 a = static_cast<std::uint8_t>(source.a + (dest.a * (255 - source.a)) / 255);
|
||||||
const auto r = static_cast<std::uint8_t>(
|
const auto r = static_cast<std::uint8_t>(
|
||||||
((source.r * source.a) + ((dest.r * dest.a) * (255 - source.a)) / 255) / a);
|
((source.r * source.a) + ((dest.r * dest.a) * (255 - source.a)) / 255) / a);
|
||||||
|
Loading…
Reference in New Issue
Block a user