I am creating a benchmark app to test speed of rendering images. I created two functions, one to return RenderWindow and one to use that RenderWindow for applying image there. When I call the second function, it gives me error: No matching constructor for initialisation of 'sf::RenderWindow'
Here are my functions:
sf::RenderWindow newWindow(int w, int h)
{
sf::RenderWindow window;
window.create(sf::VideoMode(w, h), "SFML Benchmark");
return window;
}
void draw(int type, sf::RenderWindow dest) // 0 color small, 1 color big, 2 no color small, 3 no color big
{
sf::Texture img;
switch(type)
{
case 0: if(!img.loadFromFile("colorfull small.jpg")) cout << "Unable to laod image";
case 1: if(!img.loadFromFile("colorfull big.jpg")) cout << "Unable to laod image";
case 2: if(!img.loadFromFile("colorless small.jpg")) cout << "Unable to laod image";
case 3: if(!img.loadFromFile("colorless big.jpg")) cout << "Unable to laod image";
}
sf::Sprite sprite;
sprite.setTexture(img);
dest.draw(sprite);
}
me calling the function in main:
draw(1, newWindow(600, 600));
Thank you.