Emkave

Untitled

Aug 8th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2. #include <string>
  3.  
  4. using namespace sf;
  5.  
  6. int main(void) {
  7. ContextSettings settings;
  8. settings.antiAliasingLevel = 4;
  9. RenderWindow window (RenderWindow(VideoMode({1280, 720}), "Окно", Style::Close, State::Windowed, settings));
  10. window.setFramerateLimit(120);
  11.  
  12. Font font;
  13. font.openFromFile("../YandexSansDisplay-Regular.ttf");
  14. const std::u8string u { u8"Текст" };
  15. sf::Text text(font, sf::String::fromUtf8(u.begin(), u.end()));
  16. //text.setString(L"Привет, мир!");
  17. text.setPosition({100, 100});
  18. text.setCharacterSize(100);
  19.  
  20. while (window.isOpen()) {
  21. while (const std::optional event = window.pollEvent()) {
  22. if (event->is<Event::Closed>()) {
  23. window.close();
  24. }
  25. }
  26. window.clear(Color(52, 38, 86));
  27. window.draw(text);
  28. window.display();
  29. }
  30.  
  31. return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment