I’m a bit stuck with how i return my render window from my class, not sure if i have the return type wrong or the syntax or both !
My main.cpp has:
Window Render(800, 600, "Test");
sf::RenderWindow window = Render.Init();
My class for this is:
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));
}
The header for the class:
class Window
{
private:
int ResoX, ResoY;
std::string Title;
sf::RenderWindow screen;
public:
Window(int, int, std::string);
sf::RenderWindow Init();
};
My errors are:
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
Does any one know how i fix this ?
From SFML document(http://www.sfml-dev.org/documentation/1.6/classsf_1_1VideoMode.php#a9478572db06121f70260e6b9dc21704e)
sf::VideoMode constructor is declared as:
which means you can’t pass 3rd parameter as string, you can call it: