Sign in to follow this  

Unity Generic approach to multiple callbacks/event handlers 2

This topic is 4867 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've just been reading this retired thread and was wondering (given it's age) if any of the involved parties (or anyone else for that matter) had made any progress on it. Here Cheers [Edited by - algorhythmic on August 19, 2004 9:19:40 AM]

Share this post


Link to post
Share on other sites
I havent read your link, but I'm currently doing some research before I start coding, and here are some links I found useful for creating a messagesystem. (I hope this is what you were looking for)


//signal slot system intro.
http://doc.trolltech.com/3.0/signalsandslots.html

//event pool
http://www.codeproject.com/csharp/EventPool.asp
//eventmanager
http://www.codeproject.com/csharp/eventmanager.asp

//observer pattern i c#
http://www.c-sharpcenter.com/Tutorial/Observer.asp

//Variant design pattern
http://www.gamedev.net/reference/articles/article2029.asp

//Event notification pattern
http://www.ubilab.org/publications/print_versions/pdf/tapos-96-event.pdf

Share this post


Link to post
Share on other sites
I was looking for a non-virtual way to do it, and I managed to with a hideous hack that I cannot generally recommended (explcitly specify the class a function is called on using a template parameter of the derived type).

I think it was something like this:

template<class CRTP>
struct Hack
{
bool DoSomething()
{
return this->CRTP::DoSomething();
}
};

struct Ugly : Hack<Ugly>
{
bool DoSomething()
{
return false;
}
};





If virtual-ness is ok, then you can use boost::function, Loki::Functor, or a signal & slot library (boost has one, and Qt/trolltech does too).

Share this post


Link to post
Share on other sites

This topic is 4867 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this