SFML community forums
Help => Window => Topic started by: Pixel_Outlaw on January 30, 2011, 11:01:35 pm
-
I'm not sure what to make of these non copyable resources. I'd like my Engine object to own a window and be in charge of that window for the entire duration of the game. I could make the window a global value but this is frowned upon I'm told. Instead I wanted to make an game Engine class that manages resources.
The following code won't work apparently.
class Engine
{
public:
Engine();
~Engine();
//SFML members
sf::RenderWindow my_window;
list<Player> player_list;
};
// methods
Engine::Engine()
{
my_window = sf::RenderWindow(sf::VideoMode(640, 480, 32), "Assult Match"); // this cannot be assigned
my_window.Clear(sf::Color(0,255,64));
my_window.Display();
};
Engine::~Engine()
{
};
-
my_window.Create() method is the way
-
Thanks very much. That seems to have solved the problem.
-
Or even better:
Engine::Engine() :
my_window(sf::VideoMode(640, 480, 32), "Assult Match")
{
...
}