I have some amount of older game code that I am porting over to XNA. All of my objects use x/y (float) vs. Vector2 to describe various positions, etc.
Syntax, etc. aside, is there a good performance based reason to convert my old x/y type units to Vector2, or can I just do a straight port and not have to worry about it?
I’d say the main reason for using
Vector2is that it allows you to use overloaded operators, which makes code easier to read and understand.In terms of performance, there would be so little in it, considering almost any game would be doing much more. If anything 2 floats might be faster, as accessing a variable might be faster than accessing a struct’s field (although as Merlyn has said will probably end up the same anyway).