Hey,
I've been using SFML to create a game. I've decided to make the main game class completely static because passing around parent classes in C++ is somewhat messy. This does, of course, mean that all classes have access to the game class even if they don't deserve it but I'm willing to make that sacrifice.
When I tried to add a static RenderWindow to the class, however, I started getting access violations at 0x00000004 on the initializer line in the implementation of the class.
Here's the code necessary to reproduce the problem:
StaticClass.h:
#include <SFML/Graphics.hpp>
class StaticClass
{
public:
static sf::RenderWindow renderWindow;
};
StaticClass.cpp:
#include "StaticClass.h"
sf::RenderWindow StaticClass::renderWindow;
Is this a bug? I don't get an access violation if I replace the class of the static member variable; I changed it to sf::Text and everything worked.
Thanks.
Edit: I'm using SFML 2.1