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

Author Topic: Event Messaging/Mailing  (Read 21474 times)

0 Members and 2 Guests are viewing this topic.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Event Messaging/Mailing
« on: January 19, 2009, 10:34:43 pm »
I got this idea from Rubygame. In Rubygame they got the classical Event Polling but you can extend the EventQueue class with a MailQueue module which gives EventQueue the ability to have objects subscribed to it together with an event. And when that event is polled it is sent like a mail to each object subscribed to that event making it much easier to make interactive objects.

Would it be possible to add this to SFML? If it is I can help out with writing it.
I think I've written it several times for SDL/Xlib though calling it SignalSender instead.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event Messaging/Mailing
« Reply #1 on: January 19, 2009, 10:45:16 pm »
It can be added on top of SFML very easily with one of the multiple signal/slot libraries available (like boost.signal).

I don't think it requires modifying SFML directly.

And feel free to share some code on the wiki if you implement such a system :)
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Event Messaging/Mailing
« Reply #2 on: January 19, 2009, 10:50:47 pm »
Well since this isn't Ruby I have to implement an abstract base class too. Kinda like Drawable. Ruby has it easy for itself as you don't have to take note to the type of the object when calling functions (When you are actually sending a message to the object).

Though If I get a complete system working. I'll be sure to post it at the Wiki, though under what name?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event Messaging/Mailing
« Reply #3 on: January 19, 2009, 11:06:04 pm »
Well, you don't need any base class. boost.signal and similar libraries provide much more powerful systems. Implementing this using boost would be quite straight-forward, actually.

If you don't know boost I encourage you to take a look at it ;)
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Event Messaging/Mailing
« Reply #4 on: January 19, 2009, 11:29:29 pm »
Looks interesting. Will have a look at it under my Programming Lesson. Don't think the teacher will complain ^_^

Thanks for the tip.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

 

anything