vendredi 6 octobre 2017

std::invoke no matching overloaded function found VS 2017

I am new to C++11 and when I'm trying to create a std::thread in my SFML game I receive this erros:

'std::invoke' no matching overloaded function found

and

Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...) noexcept()'

Engine.cpp

void Engine::runEngine(sf::RenderWindow &window)
{
    bool menu = false; 
    std::thread thread(&Audio::playSound,Audio::GAME_OVER);


    while (!menu)
    {
        if (wait)
        {
            audio.stopMusic();

            thread.join(); 
            window.display();

            sf::Event event;

            while (window.pollEvent(event))
            {
                if (event.type == sf::Event::KeyPressed)
                {
                    restart();
                    wait = false;
                }

            }
        }
        if (!wait)
        {
          //...
        }

    }
}

Audio.h

class Audio
{


public:
    Audio(bool load_everything = false, bool menu = false);
    ~Audio();

    enum SoundType
    {
        CRUNCH, CLICK, DRINK,GAME_OVER,T_COUNT
    };


    void loadMusic(bool);
    bool loadSounds();

    void playMusic();
    void stopMusic();
    void playSound(SoundType); 
    void setVolume(bool); 

private:

    Music music;
    Sound sound;
    SoundBuffer bufer[T_COUNT];
};

Audio::playSound

void Audio::playSound(SoundType st)
{
    sound.setBuffer(bufer[st]);
    sound.play(); 
}

Aucun commentaire:

Enregistrer un commentaire