XNA Vector2 Type Converter

I was messing around with the XNA development environment the other day and I started to make a componenet that I thought would be pretty cool to use. I got to the point where my Component had a Vector2 public property that I could use in other components but also change it in the Game Designer.The only problem was that Vector2 is a struct and doesn’t have any way to change the values of the Vector 2 in the designer.


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan

<p>I was messing around with the XNA development environment the other day and I started to make a componenet that I thought would be pretty cool to use. I got to the point where my Component had a Vector2 public property that I could use in other components but also change it in the Game Designer.<p />The only problem was that Vector2 is a struct and doesn't have any way to change the values of the Vector 2 in the designer.<p />I thought it was about time I started to learn a bit more about type converters, so I created one for this project based on the above problem.<p /><a href="http://www.kinlan.co.uk/source_samples/Vector2Converter.cs">Vector2Converter</a> is a Type convert that should be added to your exposed Vector2 Public Properties. Once you have it on your property, you will be able to change it through the Game Designer using comma notation. i.e you will see it in the designer as {X: 0, Y: 0}, you can change it by typing in something like: 50, 100 which will then convert the output to {X: 50, Y: 100}.<p />Anyway, I have provided the code [<a href="http://www.kinlan.co.uk/source_samples/Vector2Converter.cs">http://www.kinlan.co.uk/source_samples/Vector2Converter.cs</a>] so you can change it for things like Vector3's and the like.<p />Enjoy.<p /><a href="http://www.kinlan.co.uk/tag/XNA" rel="tag">XNA</a> <a href="http://www.kinlan.co.uk/tag/TypeConverter" rel="tag">TypeConverter</a> <a href="http://www.kinlan.co.uk/tag/.Net" rel="tag">.Net</a> <a href="http://www.kinlan.co.uk/tag/C#" rel="tag">C#</a></p>


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan


Print Share Comment Cite Upload Translate Updates
APA

Paul Kinlan | Sciencx (2006-09-11T00:00:00+00:00) XNA Vector2 Type Converter. Retrieved from https://www.scien.cx/2006/09/11/xna-vector2-type-converter/

MLA
" » XNA Vector2 Type Converter." Paul Kinlan | Sciencx - Monday September 11, 2006, https://www.scien.cx/2006/09/11/xna-vector2-type-converter/
HARVARD
Paul Kinlan | Sciencx Monday September 11, 2006 » XNA Vector2 Type Converter., viewed ,<https://www.scien.cx/2006/09/11/xna-vector2-type-converter/>
VANCOUVER
Paul Kinlan | Sciencx - » XNA Vector2 Type Converter. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2006/09/11/xna-vector2-type-converter/
CHICAGO
" » XNA Vector2 Type Converter." Paul Kinlan | Sciencx - Accessed . https://www.scien.cx/2006/09/11/xna-vector2-type-converter/
IEEE
" » XNA Vector2 Type Converter." Paul Kinlan | Sciencx [Online]. Available: https://www.scien.cx/2006/09/11/xna-vector2-type-converter/. [Accessed: ]
rf:citation
» XNA Vector2 Type Converter | Paul Kinlan | Sciencx | https://www.scien.cx/2006/09/11/xna-vector2-type-converter/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.