Please read the window tutorial carefully, there are limitations about threading and event processing, depending on the OS. Mac OS X is the worst in this regard.
So i read it, an apperantly Mac OS X can not handle multithreading, that isn't within the main thread. However this is what i'm working on
// Start the game loop
while (mainWindow.isOpen())
{
// Process events
sf::Event event;
while (mainWindow.pollEvent(event))
{
// Close window : exit or Pressing Escape Key
if (event.type == sf::Event::Closed || (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape))
{
mainWindow.close();
}
//Everything above works fine
if(sf::Mouse::isButtonPressed(sf::Mouse::Left))//event.type == sf::Event::MouseButtonPressed) if button is pressed go ahead
{
if(sf::Mouse::getPosition(mainWindow).x > 100 && sf::Mouse::getPosition(mainWindow).x < 130) //If pressed button is between the text start, then run
{
mainWindow.close(); //close main window
gameWindow.setVisible(true); //turn game window into on
sf::Event gameEvent;
while(gameWindow.isOpen()) //if game window is on, then run ////The ERROR COMES OUT HERE
{
//Some code in here
// Close window : exit or Pressing Escape Key
if (gameEvent.type == sf::Event::Closed || (gameEvent.type == sf::Event::KeyPressed && gameEvent.key.code == sf::Keyboard::Escape))
{
gameWindow.close();
}
}
}
}
}
I get the threaded problem in this line, while(gameWindow.isOpen())
Not sure how to make that be in the same main thread! How can i work around this? I would like to post the rest of the code but since i'm not trying to release what plans are in stored, i will only present what i believe and what the compiler issues out as error in that section !
I had a small understanding of thread (What they mean), but i never dabble in them so i have no idea how they work!