The order of the parameters is wrong.
should be
(because TGUI always passes your bound parameters first before the optional parameters such as the item)
If you want to change the speed variable inside your callback then you also have to use std::ref, to prevent the speed from being copied by TGUI:
Code Select
double popupMenuCallback1(tgui::String item, double& speed)
should be
Code Select
double popupMenuCallback1(double& speed, tgui::String item)
(because TGUI always passes your bound parameters first before the optional parameters such as the item)
If you want to change the speed variable inside your callback then you also have to use std::ref, to prevent the speed from being copied by TGUI:
Code Select
popupMenu->onItemSelect(&popupMenuCallback1, std::ref(speed));