Handling of global keyboard events

Started by SteffenPloetz, 22 August 2022, 08:45:34

SteffenPloetz

I would like to be able to handle global keyboard events without having to re-implement BackendGuiSFML::mainLoop(). Otherwise, with each new version of TGUI, I would have to compare my mainLoop() implementation with the actual TGUI implementation.

But I haven't found anything how to intervene in handleEvent() or Container::processKeyPressEvent() if they return FALSE. Is a custom implementation of mainLoop() really the only way?

texus

mainLoop mostly exists to simplify my example codes, you would almost always need to use your own main loop in a serious project.

You don't have to copy TGUI's implementation, it is more difficult than what is needed in your code. You only need what is described at the bottom of
https://tgui.eu/tutorials/0.10/backend-sfml-graphics/#main-loop