Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Window.hpp>
- #include <SFML/OpenGL.hpp>
- #include <SFML/Graphics.hpp>
- int main(){
- sf::ContextSettings settings{
- .depthBits=24,
- .stencilBits=8,
- .majorVersion=1,
- .minorVersion=4,
- .attributeFlags=sf::ContextSettings::Default,
- .sRgbCapable=true,
- };
- sf::Context context{settings,sf::Vector2u(1,1)};
- sf::RenderWindow window(sf::VideoMode({800, 600}), " ^^ meow", sf::Style::Default, sf::State::Windowed);
- HWND hwnd = window.getNativeHandle();
- ShowWindow(hwnd, SW_MAXIMIZE);
- window.setVerticalSyncEnabled(true);
- if (not window.setActive(true)){
- // out(1,L"Не удалось активировать окно\n");
- }
- bool running = true;
- sf::Font font;
- if (!font.openFromFile("../data/Roboto-Regular.ttf"))
- {
- return 1;
- }
- // Создание текста
- sf::Text text(font,L"аАёЁяЯaAzZ", 24);
- text.setFillColor(sf::Color::White);
- text.setPosition(sf::Vector2f(50, 50));
- while (running){
- while (const std::optional event = window.pollEvent()){
- if (event->is<sf::Event::Closed>()){
- running = false;
- // out(2,L"close");
- }
- else if (const auto* resized = event->getIf<sf::Event::Resized>()){
- glViewport(0, 0, resized->size.x, resized->size.y);
- // out(2,L"resize to %dx%d\n",resized->size.x,resized->size.y);
- }
- }
- glClearColor(0,0.2,0.0,0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- window.draw(text);
- window.display();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment