2014-09-30 22:07:25 +08:00
|
|
|
////////////////////////////////////////////////////////////
|
2022-08-01 02:06:49 +08:00
|
|
|
/// \mainpage SFML Documentation
|
2014-09-30 22:07:25 +08:00
|
|
|
///
|
|
|
|
/// \section welcome Welcome
|
|
|
|
/// Welcome to the official SFML documentation. Here you will find a detailed
|
2020-05-27 05:37:00 +08:00
|
|
|
/// view of all the SFML classes and functions. <br/>
|
2014-09-30 22:07:25 +08:00
|
|
|
/// If you are looking for tutorials, you can visit the official website
|
2018-02-08 20:46:09 +08:00
|
|
|
/// at <a href="https://www.sfml-dev.org/">www.sfml-dev.org</a>.
|
2014-09-30 22:07:25 +08:00
|
|
|
///
|
|
|
|
/// \section example Short example
|
|
|
|
/// Here is a short example, to show you how simple it is to use SFML:
|
|
|
|
///
|
|
|
|
/// \code
|
|
|
|
///
|
|
|
|
/// #include <SFML/Audio.hpp>
|
|
|
|
/// #include <SFML/Graphics.hpp>
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// int main()
|
|
|
|
/// {
|
|
|
|
/// // Create the main window
|
2022-11-22 21:55:52 +08:00
|
|
|
/// sf::RenderWindow window(sf::VideoMode({800, 600}), "SFML window");
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Load a sprite to display
|
2024-05-24 13:05:13 +08:00
|
|
|
/// const auto texture = sf::Texture::loadFromFile("cute_image.jpg").value();
|
2014-09-30 22:07:25 +08:00
|
|
|
/// sf::Sprite sprite(texture);
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Create a graphical text to display
|
2024-06-25 04:08:51 +08:00
|
|
|
/// const auto font = sf::Font::openFromFile("arial.ttf").value();
|
2022-09-06 13:18:29 +08:00
|
|
|
/// sf::Text text(font, "Hello SFML", 50);
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Load a music to play
|
2024-06-11 15:23:05 +08:00
|
|
|
/// auto music = sf::Music::openFromFile("nice_music.ogg").value();
|
2014-09-30 22:07:25 +08:00
|
|
|
///
|
|
|
|
/// // Play the music
|
|
|
|
/// music.play();
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Start the game loop
|
|
|
|
/// while (window.isOpen())
|
|
|
|
/// {
|
|
|
|
/// // Process events
|
2024-06-23 18:30:02 +08:00
|
|
|
/// while (const std::optional event = window.pollEvent())
|
2014-09-30 22:07:25 +08:00
|
|
|
/// {
|
|
|
|
/// // Close window: exit
|
2024-06-23 18:30:02 +08:00
|
|
|
/// if (event->is<sf::Event::Closed>())
|
2014-09-30 22:07:25 +08:00
|
|
|
/// window.close();
|
|
|
|
/// }
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Clear screen
|
|
|
|
/// window.clear();
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Draw the sprite
|
|
|
|
/// window.draw(sprite);
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Draw the string
|
|
|
|
/// window.draw(text);
|
2015-04-01 10:08:23 +08:00
|
|
|
///
|
2014-09-30 22:07:25 +08:00
|
|
|
/// // Update the window
|
|
|
|
/// window.display();
|
|
|
|
/// }
|
|
|
|
/// }
|
|
|
|
/// \endcode
|
|
|
|
////////////////////////////////////////////////////////////
|