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

Author Topic: Sig Slot event handling?  (Read 24699 times)

0 Members and 1 Guest are viewing this topic.

jamba

  • Newbie
  • *
  • Posts: 7
    • View Profile
Sig Slot event handling?
« on: April 06, 2008, 02:37:11 pm »
I've just had a wee look at your library and I really like the look of it. I was trying, and failing miserably, to make my own library when my brother suggested I check sfml out and it's great.

The one thing which i think my library did well though was the input handling. Instead of the traditional "while (GetEvents(&event)) {switch (event.type)...}" type thing, you just registered a slot in your initialisation code, and then call "HandleEvents()" and all the signals are emitted.

Is there any chance of anything like this in sfml. IMO it is a much more elegant way of handling events. Boost.Signals is a very nice sig slot library :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sig Slot event handling?
« Reply #1 on: April 06, 2008, 03:14:08 pm »
I agree, it's much more elegant and flexible. But as I don't want to depend on boost, nor wait for the next C++ standard, nor develop my own signal library (which would be quite complex), I've decided to do event handling this way.

But you can perfectly wrap it in your own code using signals, it's very easy ;)
Laurent Gomila - SFML developer

jamba

  • Newbie
  • *
  • Posts: 7
    • View Profile
Sig Slot event handling?
« Reply #2 on: April 06, 2008, 03:23:44 pm »
I might just do that then.

I can understand not wanting to wait for the next standard. Or build your own. But can I ask why not depend on boost? It's a great library and almost definately will become standard eventually. And the two systems could easily coexist.

Still, from what i've seen so far this is a pretty good library anyway. :D

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sig Slot event handling?
« Reply #3 on: April 06, 2008, 04:20:41 pm »
Boost is very good, but it's a very heavy dependency. And one goal of SFML is to use as few dependencies as possible ;)
Laurent Gomila - SFML developer

zarka

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Sig Slot event handling?
« Reply #4 on: April 07, 2008, 02:45:56 pm »
i agree no dependency on boost please :) and especially not boost.signals .. that lib is slow as hell ...
//Zzzarka

dorkfish

  • Newbie
  • *
  • Posts: 38
    • View Profile
Sig Slot event handling?
« Reply #5 on: August 03, 2008, 04:56:50 am »
I hate to resurrect a dead topic, but I would love to see signal/slot support as well. I can also understand that you don't want to rely on a huge library, so I found these: http://sigslot.sourceforge.net/, http://www.s11n.net/sigslot/, and http://libsigc.sourceforge.net/. I thought they might be of interest to you if you would still like to implement sigslot event handling.

Daazku

  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Sig Slot event handling?
« Reply #6 on: August 03, 2008, 05:01:57 am »
Like he said before you can do it yourself and post your code into the wiki.
Pensez à mettre le tag [Résolu] une fois la réponse à votre question trouvée.
Remember to add the tag [Solved] when you got an answer to your question.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Sig Slot event handling?
« Reply #7 on: August 03, 2008, 06:15:15 am »
SFML needs to keep this low-level event handling in order to be easily compatible with other languages.

So if you want signals / slots, you'd better add it yourself on top of SFML.
Laurent Gomila - SFML developer

 

anything