1
Window / SFML 2: "Failed to activate the window's context"
« on: February 10, 2010, 01:12:12 am »
Im running SFML 2 revision 1395 on windows 7 x64 using msvc 2008. When the code below is run it outputs "Failed to activate the window's context". Am I doing something wrong?
Thanks.
Edit: updated the code with working code.
Thanks.
Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
sf::Window *window;
bool good;
void ThreadFunc(void* data)
{
sf::Context context; //Added this line
window->Create(sf::VideoMode(640,480), "test");
window->SetActive(false); //Added this line
good = true;
while (1)
sf::Sleep(1);
}
int main()
{
good = false;
window = new sf::Window();
sf::Thread mythread(&ThreadFunc, NULL);
mythread.Launch();
while (!good)
sf::Sleep(0.001f);
sf::Context context;
window->SetActive(true);
mythread.Terminate();
delete window;
return 0;
}
Edit: updated the code with working code.