U
U
undeadter2017-10-09 20:13:38
Qt
undeadter, 2017-10-09 20:13:38

How to create an sfml stream?

There is such 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:

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 (...)', eg '(... ->* ((sf::priv ::ThreadFunctor*)this)->sf::priv::ThreadFunctor::m_functor) (...)'
virtual void run() {m_functor();}
^

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devalone, 2017-10-09
@undeadter

https://www.sfml-dev.org/documentation/2.0/classsf...
Second example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question