0
我正在創建一個基準測試應用程序來測試渲染圖像的速度。我創建了兩個函數,一個返回RenderWindow,另一個使用RenderWindow在那裏應用圖像。當我把第二個函數,它給我的錯誤:No matching constructor for initialisation of 'sf::RenderWindow'
SFML - 窗口錯誤
這裏是我的功能:
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);
}
我調用該函數在主:
draw(1, newWindow(600, 600));
謝謝。