Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: What is the best way to use an event throughout a program  (Read 1509 times)

0 Members and 1 Guest are viewing this topic.

bacondude95

  • Newbie
  • *
  • Posts: 11
    • View Profile
What is the best way to use an event throughout a program
« 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: What is the best way to use an event throughout a program
« Reply #1 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, 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.
« Last Edit: March 09, 2014, 11:47:43 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything