Here's my code
I want to create lines in every 40 px
cout << "enter width: ";
cin >> x;
cout << endl;
cout << "enter height: ";
cin >> y;
sf::RenderWindow window(sf::VideoMode(x*4, y*4), "Window");
/*sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);*/
for (int i = 1; i <= x; ++i)
{
sf::Vertex outlinex[2] =
{
sf::Vertex(sf::Vector2f(i * 40, 0), sf::Color::Blue),
sf::Vertex(sf::Vector2f(i * 40, 100), sf::Color::Blue)
};
window.draw(outlinex, 2, sf::Lines);
}
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
/*window.clear();*/
/*window.draw(outlinex, 2, sf::Lines);*/
window.display();
}
system("pause");
My problem is When I compiled, my lines is blinking
but when I delete
for loop, it stop.
Thanks