diff --git a/doc/mainpage.hpp b/doc/mainpage.hpp index 140c0de5d..9b444e59c 100644 --- a/doc/mainpage.hpp +++ b/doc/mainpage.hpp @@ -29,9 +29,7 @@ /// sf::Text text(font, "Hello SFML", 50); /// /// // Load a music to play -/// sf::Music music; -/// if (!music.openFromFile("nice_music.ogg")) -/// return EXIT_FAILURE; +/// auto music = sf::Music::openFromFile("nice_music.ogg").value(); /// /// // Play the music /// music.play(); diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 08742b539..e28e15ae2 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -299,14 +299,8 @@ private: /// /// Usage example: /// \code -/// // Declare a new music -/// sf::Music music; -/// -/// // Open it from an audio file -/// if (!music.openFromFile("music.ogg")) -/// { -/// // error... -/// } +/// // Open a music from an audio file +/// auto music = sf::Music::openFromFile("music.ogg").value(); /// /// // Change some parameters /// music.setPosition(0, 1, 10); // change its 3D position diff --git a/include/SFML/Window/Cursor.hpp b/include/SFML/Window/Cursor.hpp index 5bd955632..7db18bc50 100644 --- a/include/SFML/Window/Cursor.hpp +++ b/include/SFML/Window/Cursor.hpp @@ -245,9 +245,8 @@ private: /// /// // ... create window as usual ... /// -/// sf::Cursor cursor; -/// if (cursor.loadFromSystem(sf::Cursor::Type::Hand)) -/// window.setMouseCursor(cursor); +/// const auto cursor = sf::Cursor::loadFromSystem(sf::Cursor::Type::Hand).value(); +/// window.setMouseCursor(cursor); /// \endcode /// /// \see sf::WindowBase::setMouseCursor