我对如何从课堂上返回渲染窗口有点困惑,不确定我的返回类型是否错误或语法或两者兼而有之!
我的 main.cpp 有:
Window Render(800, 600, "Test");
sf::RenderWindow window = Render.Init();
我的课程是:
Window::Window(int x, int y, std::string title){
ResoX = x;
ResoY = y;
Title = title;
}
sf::RenderWindow Window::Init(){
return screen(sf::VideoMode(ResoX,ResoY,Title));
}
类的标题:
class Window
{
private:
int ResoX, ResoY;
std::string Title;
sf::RenderWindow screen;
public:
Window(int, int, std::string);
sf::RenderWindow Init();
};
我的错误是:
error C2665: 'sf::VideoMode::VideoMode' : none of the 3 overloads could convert all the argument types
could be 'sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)'
while trying to match the argument list '(int, int, std::string)'
error C2064: term does not evaluate to a function taking 1 arguments
有谁知道我如何解决这个问题?