Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <string>
- using namespace sf;
- int main(void) {
- ContextSettings settings;
- settings.antiAliasingLevel = 4;
- RenderWindow window (RenderWindow(VideoMode({1280, 720}), "Окно", Style::Close, State::Windowed, settings));
- window.setFramerateLimit(120);
- Font font;
- font.openFromFile("../YandexSansDisplay-Regular.ttf");
- const std::u8string u { u8"Текст" };
- sf::Text text(font, sf::String::fromUtf8(u.begin(), u.end()));
- //text.setString(L"Привет, мир!");
- text.setPosition({100, 100});
- text.setCharacterSize(100);
- while (window.isOpen()) {
- while (const std::optional event = window.pollEvent()) {
- if (event->is<Event::Closed>()) {
- window.close();
- }
- }
- window.clear(Color(52, 38, 86));
- window.draw(text);
- window.display();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment