Jump to content
  • Advertisement
Sign in to follow this  
NEXUSKill

Delegates & parameter lists, need help

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

I'm working on a small XNA 2d game framework, I came across a problem when implementing the Input system, the system is quite powerful and flexible but one feature it lacks is the ability to have custom parameter lists for delegate functions. Right now the delegate functions called upon input events have no parameters, and deciding on the types of parameters is something I want to leave to the user of the system, not to the system itself. Is there a way to send into a function an undetermined ammount and type of parameters so that it may internaly cast them to the proper types and do whatever with them?

Share this post


Link to post
Share on other sites
Advertisement
I dont see how that will work out, the point is that I need the same delegate to be able to recieve very different sets of arguments, IE an argument list that only the function called by the delegate knows what they are, how many and how to use them

Share this post


Link to post
Share on other sites
If you have the delegate take a single object parameter, the calling methods can pass in any arbitrary container class containing all the parameters you need. The receiving delegate will need to know to cast to the correct type though.

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!