How to create a thread sfml?

There is a class:

// maingame.cpp
class MainGame
{
private:
 sf::RenderWindow* window;

 void logicalThread();
 void drawThread();

 void run();
}


// maingame.h
MainGame::MainGame(sf::RenderWindow *window)
{
 this->window = window;
}

void MainGame::drawThread()
{
 while (window->isOpen())
{
window->clear();
window->display();
}
}

void MainGame::logicalThread()
{
 while (window->isOpen())
{
///////////////////////
}
}

void MainGame::run()
{
 sf::Thread thread1(&logicalThread);
thread1.launch();

 sf::Thread thread2(&drawThread);
thread2.launch();
}


When compiling, I get this error message:

C:\Qt\Tools\mingw530_32\i686-w64-mingw32\include\c++\SFML\System\Thread.inl:39: error: must use '.*' or '->*' to call pointer-to-member function in '((sf::priv::ThreadFunctor*)this)->sf::priv::ThreadFunctor::m_functor (...)', e.g. '(... ->* ((sf::priv::ThreadFunctor*)this)->sf::priv::ThreadFunctor::m_functor) (...)'
virtual void run() {m_functor();}
^
June 14th 19 at 18:17
1 answer
June 14th 19 at 18:19
Solution

Find more questions by tags C++Development of gamesG++GCCQt