Hi there!
I've researched this issue and tried various things learning that the RenderWindow is non-copyable and all that fun stuff. But, I swear I see other programs doing this that don't have an issue, which I'm guessing I'm simply missing a step.
At the moment, I'm running under Debug mode with the debug libraries linked statically. Basically I have a Camera class with a function DrawHUD that works like so:
void Camera::DrawHUD(sf::RenderWindow &window)
{
testText.setString("Hi! I'm a HUD!");
window.pushGLStates();
window.draw(testText);
window.popGLStates();
}
Basically it all comes down to window.draw() is where it ultimately crashes. Well, that's sort of true, because it only crashes when the program exits, but only if that draw() is called from inside my class.
When it crashes it goes to the file crtexe.c and points to the lines here:
if (has_cctor == 0)
_cexit();
and then proceeds to give me the Unhandled Exception error with ntdll.dll.
It doesn't matter if I pass it as a pointer, and I can't pass it directly because RenderWindow is noncopyable to avoid duplicate windows. So am I just stupid, or?
For more code context, this is basically how it works:
Camera mainCamera;
//...
//WHILE LOOP HERE
mainCamera.DrawHUD(window);
Any ideas? By the way, that testText thing has all the other stuff setup in the class' constructor, but where I put that seemed to not make any difference anyway.