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-05-19 01:06:12 +08:00
|
|
|
/// const auto font = sf::Font::loadFromFile("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
|
|
|
|
/// sf::Music music;
|
|
|
|
/// if (!music.openFromFile("nice_music.ogg"))
|
|
|
|
/// return EXIT_FAILURE;
|
|
|
|
///
|
|
|
|
/// // 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-05-02 09:43:24 +08:00
|
|
|
/// while (const auto event = window.pollEvent())
|
2014-09-30 22:07:25 +08:00
|
|
|
/// {
|
|
|
|
/// // Close window: exit
|
2023-11-04 11:47:14 +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
|
|
|
|
////////////////////////////////////////////////////////////
|