Search Results

Search found 1 results on 1 pages for 'user3966541'.

Page 1/1 | 1 

  • What is wrong with my loop?

    - by user3966541
    I have the following loop and don't understand why it only runs once: std::vector<sf::RectangleShape> shapes; const int res_width = 640; const int res_height = 480; for (int x = 0; x < res_width / 50; x += 50) { for (int y = 0; y < res_height / 50; y += 50) { sf::RectangleShape shape(sf::Vector2f(50, 50)); shape.setPosition(x * 50, y * 50); sf::Color color = (x % 2 == 0) ? sf::Color::Green : sf::Color::Red; shape.setFillColor(sf::Color::Green); shapes.push_back(shape); } }

    Read the article

1