sorry for late respond :/
i figured out the code that made it slow
it goes something like this
sf::RectangleShape Grect;
sf::RectangleShape Brect;
Brect.setSize(sf::Vector2f(50,50));
Brect.setFillColor(sf::Color::Color(0,0,150));
Grect.setSize(sf::Vector2f(50,50));
Grect.setFillColor(sf::Color::Color(0,200,0));
void drawrect()
{
for(int i=0; i<900; i++)
{
Brect.setPosition(x(i),y(i));
Grect.setPosition(x(i),y(i));
window.draw(Brect);
window.draw(Grect);
}
}
so basically it just draws the same square multiple times at different positions
its kinda weird that it only slows it down initially given that i am always running this code
but any way is there any better way of doing this ?
hmm i tried to read up on it and played around with it but could only make it work with lines :-\
sf::VertexArray lines(sf::LinesStrip, 4);
lines[0].color=sf::Color(255,33,33);
lines[0].position = sf::Vector2f(10, 0);
lines[1].position = sf::Vector2f(20, 0);
lines[2].position = sf::Vector2f(30, 5);
lines[3].position = sf::Vector2f(40, 2);
window.draw(lines);
but couldn't really get it to work with rectangles i tried
sf::VertexArray squares(sf::RectangleShape, 4);
and stuff like that
so i was wondering how do i do it ?