#define SPRITE_AMOUNT 100000
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
int main()
{
RenderWindow MyApp(sf::VideoMode(800, 600, 32), "SFML Graphics");
Image MyImage = Image();
Sprite MySprites[SPRITE_AMOUNT];
MyImage.Create(10,10,Color(120,155,0));
for(int i=0;i<SPRITE_AMOUNT;i++)
{
int j = i%100;
MySprites[i] = Sprite();
MySprites[i].SetImage(MyImage);
MySprites[i].SetPosition(j*10,i);
};
while(MyApp.IsOpened())
{
MyApp.Clear();
Event MyEvent;
MyApp.GetEvent(MyEvent);
if (MyEvent.Type == sf::Event::Closed)
{
MyApp.Close();
}
for(int i=0;i<SPRITE_AMOUNT;i++)
{
MyApp.Draw(MySprites[i]);
};
MyApp.Display();
}
return 0;
}
thats the maximum of reducing, I hope, but the mistake got lost on the way^^ Here I can use 20000 sprites and even more I think without breaking down :wink:
The mistake have to be in my Code!