Hello all,
Perhaps I better say this first: I'm not sure if this is a question related to sfml or if I'm just being stupid at C++.
I fear for the latter
I'm using the latest snapshot built on Ubuntu 12.10, my compiler is gcc.
This is my problem:
I'm trying to learn about different techniques for state-changing(from intro to menu etc.).
The one I'm now trying to implement uses a base GameState class which will be derived by all the states(not exceptional).
So that class, which looks something like this:
class Gamestate
{
GameState(){};
virtual void logic() = 0;
virtual void input() = 0;
virtual void render() = 0;
}
I derive in my Intro class.
I have a global sf::RenderWindow* window which I use in my derived class.
My input()-function looks something like this:
void input()
{
sf::Event event;
while (window->pollEvent(event))
{
//process input...
}
}
This all compiles fine but when I try to run this program it gives me a segmentation fault(core dumped).
I'm pretty sure it has nothing to do with my state-system, the debugger tells me the program gives the error after the first call to the RenderWindow out of my Intro-class, in the input function at the first line of pollEvent in Window.cpp.
Yes, I did initialize(is that the right word?) the RenderWindow, I did even call create() right after that just to be sure.
Again, I'm still quite new to C++ and sfml, so it could be something stupid I overlooked.
It would be very nice if someone could help me out with this, I'm already looking at this error for over an hour...
Regards,
Steef