Well, paragui is switching to libsig++ in the next
major version if you want to do gui programming for
SDL. As for SDL itself, I don’t think such a paradigm
is supported, since most of the targets use event
queues. I’m sure it would be possible to implement a
layer on top of the SDL event queue, but who knows how
much work it would take.
— Matthias wrote:> Hi
this is my initial mail in this list
and I want to know, is there a signals and slots
in SDL or is there some other free portable sig &
I think such one is essential
for a fluent gameplay, because searching all the
time through lists may
decrease the performance.
Well, unless you’re getting hundreds of events per frame, it makes no sense to worry about switch() decoding overhead. I can’t see how it could possibly take more than a few tens of cycles to decode an entire SDL message with arguments.
Also note that if you just sort the cases in your switch()es, there will be a single test and a branch-by-table. No compiler I know of will generate switch() code that searches through any form of structure, ever. An if() chain would be the worst possible result, and that only happens when the case values cannot be used to index a jump table.
Anyway, if switch() overhead really is an issue for you, a signal/slots system is definitely the last thing you want. The function call overhead will eat you alive. Also forget about using a normal operating system; Most events you receive will at the very least have travelled through an interrupt handler, a thread safe kernel/user space “gateway” (the “driver API”), and one or more user space libraries.
| David Olofson