Jump to content
  • Advertisement
Sign in to follow this  
algorhythmic

Unity Generic approach to multiple callbacks/event handlers 2

This topic is 5082 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!