Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
5
Indexable
#include <SFML/Graphics.hpp>
#include <stdlib.h>
#include <iostream>
#include <chrono>

int main()
{
    sf::RenderWindow window(sf::VideoMode(1920, 1080, 60), "Heat the Angry Loki bobo");
    sf::RectangleShape rectangle(sf::Vector2f(50.f, 50.f));
    rectangle.setSize(sf::Vector2f(800.f, 500.f));
    rectangle.setPosition(600.f, 250.f);
    rectangle.setFillColor(sf::Color(128, 128, 128));
    srand(std::chrono::steady_clock::now().time_since_epoch().count());
    int start = 600;
    int end = 1330;
    int start1 = 250;
    int end1 = 680;
    int x = rand() % (end - start + 1) + start;
    int y = rand() % (end1 - start1 + 1) + start1;
   
    sf::CircleShape shape(70.f);
    shape.setPosition((float)x, (float)y);
    int t = 180;
    while (window.isOpen())
    {
        window.clear();
        window.draw(rectangle);
        
        if (t > 0) {
            window.draw(shape);
            t--;
        }
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        window.display();
    }

    return 0;
}
Editor is loading...
Leave a Comment