Guest User

Untitled

a guest
Aug 8th, 2025
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 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("../data/Roboto-Regular.ttf");
  14.    //const std::u8string u { u8"Текст" };
  15.    auto s=L"Текст  zZaAяЯёЁбБ";
  16.    uint8_t* arr=(uint8_t*)s;
  17.    for (int i=0;i<40;i++){
  18.       printf("%d, ",int8_t(arr[i]));
  19.    }
  20.    sf::Text text(font,s);
  21.    //text.setString(L"Привет, мир!");
  22.    text.setPosition({100, 100});
  23.    text.setCharacterSize(100);
  24.  
  25.    while (window.isOpen()) {
  26.       while (const std::optional event = window.pollEvent()) {
  27.          if (event->is<Event::Closed>()) {
  28.             window.close();
  29.          }
  30.       }
  31.       window.clear(Color(52, 38, 86));
  32.       window.draw(text);
  33.       window.display();
  34.    }
  35.  
  36.    return 0;
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment