Where Has The RectangleF Gone?
One thing I have noticed when working in XNA is that the good old System.Drawing.RectangleF did not make it into the Microsoft.XNA.Framework! Now this has not been a big deal for most of my projects but I recently find myself moving objects and updating their "Bounding" rectangles to match; the only problem is the positions of the objects were stored in a Vector2 which means I have to do some ugly rounding and generate a new Rectangle each update. To solve this "issue" I implemented my own take on the RectangleF.
My RectangleF includes some methods which I use a lot and one that I put in just to test the concept and might confuse some of you; this function is the "ResizeToRotation" method. What this method does is rotate the points of the current RectangleF and then generates a new RectangleF which contains those points; it works very well for keeping a static AABR that tightly contains the OBR of an object.
Download Source: RectangleF
- shawn's blog
- Login or register to post comments
