Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.1 kB
0
Indexable
Never
#include <iostream>
#include <SFML/Graphics.hpp>
int main()
{
    float a,b,h;
    std::cin >> a >> b >> h;



    // create the window
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");

    sf::ConvexShape convex;
    convex.setPointCount(4);
    convex.setPoint(0, sf::Vector2f{0, h});
    convex.setPoint(1, sf::Vector2f{(b-a)/2,0});
    convex.setPoint(2, sf::Vector2f{(b-a) / 2 + a,0});
    convex.setPoint(3, sf::Vector2f{b,h});

    convex.setFillColor(sf::Color(200, 25, 198));

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
        window.clear();
        window.draw(convex);
        window.display();

    }

    return 0;
}

Leave a Comment