SFML/test/integrate/main.cpp
2024-11-13 15:17:06 +01:00

31 lines
675 B
C++

#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode({800, 600}), "SFML window");
const sf::Texture texture("cute_image.jpg");
sf::Sprite sprite(texture);
const sf::Font font("arial.ttf");
sf::Text text(font, "Hello SFML", 50);
sf::Music music("nice_music.ogg");
music.play();
while (window.isOpen())
{
while (const std::optional event = window.pollEvent())
{
if (event->is<sf::Event::Closed>())
window.close();
}
window.clear();
window.draw(sprite);
window.draw(text);
window.display();
}
}