Switching to 0.7

Started by Heinrich, 23 September 2014, 13:38:03

texus

You could create an extra boolean in your function, e.g. called "running".

If you e.g. want to change the running variable when a button is pressed you can do
button->connect([&](){ running = false; });

If your callback function contains too much code for being a lambda function you could pass the running variable by reference.
void myFunction(bool&);
button->connect(myFunction, std::ref(running));


Another solution might perhaps be not to have the main loop inside your state.
Your state should have the functions like handleEvent, update an draw while the main loop just calls these functions on the active state.