The window stopped rendering updates made to the code. Here's the code:
#include <SFML/Graphics.hpp>
int main() {
// create window
sf::RenderWindow window(sf::VideoMode(900, 500), "SFML EXP");
sf::CircleShape circle(60);
circle.setFillColor(sf::Color::Green);
circle.setOutlineThickness(3);
circle.setOutlineColor(sf::Color::White);
circle.setPosition(sf::Vector2f(400, 150));
sf::RectangleShape rect(sf::Vector2f(180, 100));
rect.setFillColor(sf::Color::Red);
rect.setOutlineThickness(3);
rect.setOutlineColor(sf::Color::White);
rect.setPosition(sf::Vector2f(250, 250));
sf::ConvexShape triangle; // convex shape - any shape that has all its vertices pointing outwards
triangle.setPointCount(3);
triangle.setPoint(0, sf::Vector2f(450, 200));
triangle.setPoint(1, sf::Vector2f(350, 330));
triangle.setPoint(2, sf::Vector2f(550, 330));
triangle.setFillColor(sf::Color::Cyan);
triangle.setOutlineThickness(3);
triangle.setOutlineColor(sf::Color::Magenta);
// when window is open
while (window.isOpen()) {
sf::Event event;
// look for events
while (window.pollEvent(event)) {
if (event.type == sf::Event::EventType::Closed) {
window.close();
}
}
// render loop
window.clear(sf::Color::Black);
window.draw(circle);
//window.draw(rect);
//window.draw(triangle);
window.display();
}
}
Look how even after I comment out drawing the rect and triangle the window displays them and changes to the shapes positions also doesn't work they just render at the points I previously assigned them, Here's the image:
apparently I can't upload an image even though it's got the mona lisa icon saying insert image here... Sorry
Thank you for your attentiion !!