How should I create a window inside of a class? I am new to this library (I used SDL in the past), and I want to know how to create a window. I may be still learning C++, but I also want to learn how to program by doing. Learning the details of how C++ works is one thing, but being able to apply it to a real-world program is another ball of wax.
Below, I have an example of my first, and failed attempt at trying to do it:
class cGame{
public:
...
private:
...
sf::RenderWindow mainWindow;
};
And then for the main code, I tried to use this code:
bool cGame::Run()
{
mainWindow.Display();
return true; //returns as true
}
// ...
void cGame::Cleanup()
{
//releases all the resources and closes the program
mainWindow.Close(); //closes the window
}
What am I doing wrong?