SFML community forums
Help => General => Topic started by: MaxPain on November 19, 2020, 03:27:25 pm
-
I am wondering what is the best way to implement the use of sf :: Event in a class and how this is handled.
For example: what is the best way to make a button class that should handle mouse pressed and release.
-
There's no "best way" or rather what fits best, depends on your code (and experience).
I personally, would probably just implement functions like "OnClick()" for the button class and have an additional class, that receives all sf::Event from the event loop, knows all the widgets and determines for a mouse button event which widget is located at the position and calls OnClick for that button instance.