(Note, this is a TGUI / C++ question, not sure if this is where I should post it.)
I'm trying to do this :
void GUIManager::CreateButton(std::string m_identifier, std::string m_buttonText, std::string m_fontPath, void* func, float m_xPos, float m_yPos, float m_width, float m_height)
{
tgui::Button::Ptr m__temp_btn = std::make_shared<tgui::Button>();
m__temp_btn->setFont(m_fontPath);
m__temp_btn->setText(m_buttonText);
m__temp_btn->setPosition(m_xPos, m_yPos);
m__temp_btn->setSize(m_width, m_height);
_buttonList.insert(std::make_pair(m_identifier, m__temp_btn));
_buttonList[m_identifier]->connect("pressed", func); // It's because of this func parameter I get the error,
_gui.add(_buttonList[m_identifier]);
}
Which TGUi doesn't want me to since it gives me this error :
Error C2893 Failed to specialize function template 'unknown-type std::invoke(_Callable &&,_Types &&...)'
What am I doing wrong? :/
(I think this should be enough code to reproduce the error)
Oh, okay.
The function has no parameters, so I replaced void* func in the parameter with :
std::function<void> func
But now I get these errors instead :
Error C2027 use of undefined type 'std::_Get_function_impl<_Fty>'
and
Error C2504 'type': base class undefined
ยจ
I guess this is completely unrelated to both SFML and TGUi, should I post this somewhere else instead?
It should look like this:
std::function<void()> func
The void is the return type and between the brackets you can put the parameters (none in this case).