SFML community forums

Help => Window => Topic started by: bacondude95 on March 08, 2014, 09:20:13 pm

Title: What is the best way to use an event throughout a program
Post by: bacondude95 on March 08, 2014, 09:20:13 pm
I'm trying to make an event class so it would just be easier to get events and use them. But you can't make a function out of sf::Event like I planned to, and this kind of took away the opportunity of returning event. What would be the best way to use events in a program? I want to limit to limit how many events since only one event can be processed at a time.
Title: Re: What is the best way to use an event throughout a program
Post by: Nexus on March 09, 2014, 11:45:32 am
You usually don't want to pass an SFML event through the whole program, but translate it at some point into a game-logic action or command.

You could have a look at Thor's Action system (http://www.bromeon.ch/libraries/thor/v2.0/tutorial-actions.html), I have developed it exactly for this purpose. You can register functions that are called every time a specific event (or combination of events) is active.