Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - evgn

Pages: [1]
1
General / 'argument': conversion from 'int' to 'T' possible loss of data
« on: August 16, 2023, 07:31:08 pm »
[code=cpp][color=limegreen]#include <SFML/Graphics.hpp>

int main()
{

    sf::RenderWindow window(sf::VideoMode(1280, 720), "hmmmm");

    window.setFramerateLimit(30);

    //draw

    short int a[1280][720] = { 0 };

    sf::RectangleShape pix;

    pix.setSize(sf::Vector2f(1,1));

    pix.setPosition(sf::Vector2f( 640, 0));

    a[640][0] = 1;




    //graphics


    window.clear();

    window.draw(pix);

    for (int y = 1; y <= 719;y++)
    {
        for (int x = 1; x <= 1279; x++)
        {
            pix.setPosition(sf::Vector2f(x, y));

            if ( (a[x-1][y-1] + a[x+1][y-1]) % 2 == 1)
            {
                window.draw(pix);

                a[x][y] = 1;

            }
               

        }
    }

    window.display();





    //later



    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
            if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
            {
                window.close();
            }
        }


    }


    return 0;
}

Pages: [1]
anything