Jump to content
  • Advertisement
Sign in to follow this  
maxdub

[.net] Event System

This topic is 3978 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

Hey All, How would I go about creating an event system that would be able to span C# and Native C++. Ideally, I would like to have a class (possibly in managed c++) that contains a RegisterEvent(eventname, funcptr) function and a FireEvent(eventname) function. So I can call/create as many events as I wish. Any insight and/or reference links/books would be greatly appreciated!! max [Edited by - maxdub on October 26, 2007 8:09:53 PM]

Share this post


Link to post
Share on other sites
Advertisement
Can you explain more about what you are doing and why? So we can see if we can help. Also can you explain why the current event system doesn't work for you?

theTroll

Share this post


Link to post
Share on other sites
Hey, sorry, I'll try to be a bit more specific with my problem.

Alright, I need my event system to be able to take in a member function from any class that can call eventsystem->RegisterEvent and map it to a string. So then when I call eventsystem->FireEvent and pass it the string value. It should be able to go ahead and call the function that I had mapped to it earlier.


having a map with the string as the key and a delegate as the value would work perfectly if it was possible, but apparently its not since delegate is a keyword, not a type. :( and maps dont work in mamaged c++

map<string, delegate> events;



hopefully that was a bit more clear :)

[Edited by - maxdub on October 27, 2007 9:00:48 PM]

Share this post


Link to post
Share on other sites
alright, i figured out my problem. What I did was I ended up wrapping the event in its own class with a register and a invoke method. I then was able to map each event to a string by using the generic dictionary. Now I have a data driven event system that can interop between C#, managed C++, and native C++ :D

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!