Geeks With Blogs
George Clingerman       XNADevelopment.com

ItsAControlThing I've been playing with a lot of different projects lately trying to work on adding more polish to them. One of the things that I've been trying to do is add in controller images (provided by Microsoft off the Creator's website) when appropriate. So instead of just saying, "Press X to jump!", I stick the X button image into the line of text to pretty it up a little.

Well, that was getting old quick because I was having to do so much manual work lining it all up. Basically, I would have to draw the text, "Press", then I would have to draw an image for the "X" and then I would have to manually position and draw the rest of the text, "to jump!".

So I did what any programmer does when they get tired of doing something over and over again. I wrote something to do that all for me. "It's a Control Thing!" is some new sample code I released on XNADevelopment.com to do just that. No more manual positioning for me. Now I can just write some text like this, "Use the [LTRIGGER] to cycle through your items." and [LTRIGGER] will get automatically replaced by the controller image for the left trigger.

Sigh, life is good.

So if you want to take a peek or improve upon my idea, go for it! The source code is there for you to download, tweak and improve upon. Or if you're content with the way it is, just start using it in your projects like I am mine.

Enjoy and as always, let me know what you think. And please, if you make some cool improvements share them!

Technorati Tags:
Posted on Saturday, September 27, 2008 9:52 PM XNA Development , XNA | Back to top


Comments on this post: XNADevelopment.com - It's a Control Thing!

# re: XNADevelopment.com - It's a Control Thing!
Requesting Gravatar...
I haven't checked it out, but I share your frustration totally.

I wrote something else to solve the same problem a few months ago. Intending to share it with the community sometime too.

My one took a slightly different approach similar to string.Format style.
e.g. DoFunkyStuff("
Press {0} to shoot", ">")

I reckon that, and another useful class I wrote for laying out stuff is the ONLY reason I managed to finish in time for Dream Build Play. Seriously.
Left by Sharky on Sep 28, 2008 1:49 PM

# re: XNADevelopment.com - It's a Control Thing!
Requesting Gravatar...
Yup - I'm also another veteran of the painful ways to work around using controller glyphs & text wars.

Anyways, I'm looking forward to giving this a shot as well.

Thanks again George :)
Left by RobC on Oct 08, 2008 6:49 AM

# re: XNADevelopment.com - It's a Control Thing!
Requesting Gravatar...
this does not work on the xbox 360 does anyone know how to fix this?

please e-mail me if you do
Left by Daniel on May 31, 2009 8:16 PM

# re: XNADevelopment.com - It's a Control Thing!
Requesting Gravatar...
Another bug with this code. The following text does the wrong thing:
"[A][B]" I Haven't looked into this one, because I was frustrated with your code and I found a work around "[A] [B]"
"This is a test [A] [B]" It will display both buttons as the "A" button, because it does a search for the text between the buttons, namely a space, and it finds it before the "A", so it uses the A button.
I'll have the code fixed within the week.
Left by McKay Salisbury on Apr 12, 2010 11:34 AM

Your comment:
 (will show your gravatar)


Copyright © George Clingerman | Powered by: GeeksWithBlogs.net