Geek-o-Philiac

Wednesday, September 20, 2006

Porting to XNA

I made the decision to port a lot of my framework over to XNA, and it's progressing remarkably smoothly. I don't have any fancy graphics on the screen, but I do have my process tree and event management systems in. I was also easily able to switch from input polling to input event passing, with the next step being abstracting things out a little bit further so that I can switch between the XBox controller and the keyboard seemlessly. Not a hard modification, but not a fun one either.

I've been trying really hard to avoid some of my C++ methods while writing in C#. Reflection is helping a lot, and I've practically eliminated a lot of unsafe type casting. My event management system has become a whole lot cleaner, but I will admit that it does not adhere to the common C# practice involving the use of delegates. Though I had legitimate reasons for doing this, it still feels a bit dirty.

I did buckle and introduce the Singleton in my code. I had great reservations about doing this - it's regarded by many as an anti-pattern for good reason - but a whole lot of my modules need access to core modules, and it would be cumbersome (and in many cases illogical) to pass those modules around to make sure they get where they're needed. I'm still looking for a better way, but until I do I'm hoping that I will not have reason to regret my decision.

0 Comments:

Post a Comment

<< Home