A Generic Helper For XNA Services
The instruction limit has posted an article on a Generic Helper for XNA Services.
Sick of lines like these in your Game Components? :
graphicsService = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService));
Well, me too. And since my efforts to bring it up in the XNA forums were a bit fruitless, I decided to give it a shot.
Here’s a pretty small snippet that will save you tons of typecasts and typeofs.
Just enclose with your favorite namespace declaration.
This can simplify your code when you need to access services from your game components.

No comments
Jump to comment form | comments rss [?] | trackback uri [?]